}
// Execute a CLI Statement
public void executeCLIStatement(String statement) throws CharacterCodingException, TException, TimedOutException, NotFoundException, NoSuchFieldException, InvalidRequestException, UnavailableException, InstantiationException, IllegalAccessException, ClassNotFoundException
{
Tree tree = CliCompiler.compileQuery(statement);
try
{
switch (tree.getType())
{
case CliParser.NODE_EXIT:
cleanupAndExit();
break;
case CliParser.NODE_THRIFT_GET:
executeGet(tree);
break;
case CliParser.NODE_THRIFT_GET_WITH_CONDITIONS:
executeGetWithConditions(tree);
break;
case CliParser.NODE_HELP:
executeHelp(tree);
break;
case CliParser.NODE_THRIFT_SET:
executeSet(tree);
break;
case CliParser.NODE_THRIFT_DEL:
executeDelete(tree);
break;
case CliParser.NODE_THRIFT_COUNT:
executeCount(tree);
break;
case CliParser.NODE_ADD_KEYSPACE:
executeAddKeySpace(tree.getChild(0));
break;
case CliParser.NODE_ADD_COLUMN_FAMILY:
executeAddColumnFamily(tree.getChild(0));
break;
case CliParser.NODE_UPDATE_KEYSPACE:
executeUpdateKeySpace(tree.getChild(0));
break;
case CliParser.NODE_UPDATE_COLUMN_FAMILY:
executeUpdateColumnFamily(tree.getChild(0));
break;
case CliParser.NODE_DEL_COLUMN_FAMILY:
executeDelColumnFamily(tree);
break;
case CliParser.NODE_DEL_KEYSPACE:
executeDelKeySpace(tree);
break;
case CliParser.NODE_SHOW_CLUSTER_NAME:
executeShowClusterName();
break;
case CliParser.NODE_SHOW_VERSION:
executeShowVersion();
break;
case CliParser.NODE_SHOW_KEYSPACES:
executeShowKeySpaces();
break;
case CliParser.NODE_SHOW_SCHEMA:
executeShowSchema(tree);
break;
case CliParser.NODE_DESCRIBE:
executeDescribe(tree);
break;
case CliParser.NODE_DESCRIBE_CLUSTER:
executeDescribeCluster();
break;
case CliParser.NODE_USE_TABLE:
executeUseKeySpace(tree);
break;
case CliParser.NODE_TRACE_NEXT_QUERY:
executeTraceNextQuery();
break;
case CliParser.NODE_CONNECT:
executeConnect(tree);
break;
case CliParser.NODE_LIST:
executeList(tree);
break;
case CliParser.NODE_TRUNCATE:
executeTruncate(tree.getChild(0).getText());
break;
case CliParser.NODE_ASSUME:
executeAssumeStatement(tree);
break;
case CliParser.NODE_CONSISTENCY_LEVEL:
executeConsistencyLevelStatement(tree);
break;
case CliParser.NODE_THRIFT_INCR:
executeIncr(tree, 1L);
break;
case CliParser.NODE_THRIFT_DECR:
executeIncr(tree, -1L);
break;
case CliParser.NODE_DROP_INDEX:
executeDropIndex(tree);
break;
case CliParser.NODE_NO_OP:
// comment lines come here; they are treated as no ops.
break;
default:
sessionState.err.println("Invalid Statement (Type: " + tree.getType() + ")");
if (sessionState.batch)
System.exit(2);
break;
}
}