Removing obsolete 'vtctl Query'.

This commit is contained in:
Alain Jobart 2015-05-28 15:19:59 -07:00
Родитель f2d76eda2a
Коммит 880baf3828
1 изменённых файлов: 0 добавлений и 42 удалений

Просмотреть файл

@ -19,7 +19,6 @@ import (
"github.com/youtube/vitess/go/flagutil"
"github.com/youtube/vitess/go/jscfg"
"github.com/youtube/vitess/go/netutil"
"github.com/youtube/vitess/go/vt/client2"
hk "github.com/youtube/vitess/go/vt/hook"
"github.com/youtube/vitess/go/vt/key"
"github.com/youtube/vitess/go/vt/logutil"
@ -98,9 +97,6 @@ var commands = []commandGroup{
command{"HealthStream", commandHealthStream,
"<tablet alias>",
"Streams the health status out of a tablet."},
command{"Query", commandQuery,
"<cell> <keyspace> <query>",
"Send a SQL query to a tablet."},
command{"Sleep", commandSleep,
"<tablet alias> <duration>",
"Block the action queue for the specified duration (mostly for testing)."},
@ -378,34 +374,6 @@ func dumpTablets(ctx context.Context, wr *wrangler.Wrangler, tabletAliases []top
return nil
}
func kquery(wr *wrangler.Wrangler, cell, keyspace, query string) error {
sconn, err := client2.Dial(wr.TopoServer(), cell, keyspace, "master", false, 5*time.Second)
if err != nil {
return err
}
rows, err := sconn.Exec(query, nil)
if err != nil {
return err
}
cols := rows.Columns()
wr.Logger().Printf("%v\n", strings.Join(cols, "\t"))
rowStrs := make([]string, len(cols)+1)
for row := rows.Next(); row != nil; row = rows.Next() {
for i, value := range row {
switch value.(type) {
case []byte:
rowStrs[i] = fmt.Sprintf("%q", value)
default:
rowStrs[i] = fmt.Sprintf("%v", value)
}
}
wr.Logger().Printf("%v\n", strings.Join(rowStrs, "\t"))
}
return nil
}
// getFileParam returns a string containing either flag is not "",
// or the content of the file named flagFile
func getFileParam(flag, flagFile, name string) (string, error) {
@ -857,16 +825,6 @@ func commandHealthStream(ctx context.Context, wr *wrangler.Wrangler, subFlags *f
return errFunc()
}
func commandQuery(ctx context.Context, wr *wrangler.Wrangler, subFlags *flag.FlagSet, args []string) error {
if err := subFlags.Parse(args); err != nil {
return err
}
if subFlags.NArg() != 3 {
return fmt.Errorf("action Query requires 3")
}
return kquery(wr, subFlags.Arg(0), subFlags.Arg(1), subFlags.Arg(2))
}
func commandSleep(ctx context.Context, wr *wrangler.Wrangler, subFlags *flag.FlagSet, args []string) error {
if err := subFlags.Parse(args); err != nil {
return err