当前位置: 首页>>代码示例>>Java>>正文


Java CliMain.processStatement方法代码示例

本文整理汇总了Java中org.apache.cassandra.cli.CliMain.processStatement方法的典型用法代码示例。如果您正苦于以下问题:Java CliMain.processStatement方法的具体用法?Java CliMain.processStatement怎么用?Java CliMain.processStatement使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.cassandra.cli.CliMain的用法示例。


在下文中一共展示了CliMain.processStatement方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setupDataByCli

import org.apache.cassandra.cli.CliMain; //导入方法依赖的package包/类
protected static void setupDataByCli(String[] statements) throws CharacterCodingException, ClassNotFoundException, TException, TimedOutException, NotFoundException, InvalidRequestException, NoSuchFieldException, UnavailableException, IllegalAccessException, InstantiationException
{
    // new error/output streams for CliSessionState
    ByteArrayOutputStream errStream = new ByteArrayOutputStream();
    ByteArrayOutputStream outStream = new ByteArrayOutputStream();

    // checking if we can connect to the running cassandra node on localhost
    CliMain.connect("127.0.0.1", 9170);

    // setting new output stream
    CliMain.sessionState.setOut(new PrintStream(outStream));
    CliMain.sessionState.setErr(new PrintStream(errStream));

    // re-creating keyspace for tests
    try
    {
        // dropping in case it exists e.g. could be left from previous run
        CliMain.processStatement("drop keyspace thriftKs;");
    }
    catch (Exception e)
    {
    }

    for (String statement : statements)
    {
        errStream.reset();
        System.out.println("Executing statement: " + statement);
        CliMain.processStatement(statement);
        String result = outStream.toString();
        System.out.println("result: " + result);
        outStream.reset(); // reset stream so we have only output from next statement all the time
        errStream.reset(); // no errors to the end user.
    }
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:35,代码来源:PigTestBase.java

示例2: executeCliStatements

import org.apache.cassandra.cli.CliMain; //导入方法依赖的package包/类
private void executeCliStatements(String[] statements) throws CharacterCodingException, ClassNotFoundException, TException, TimedOutException, NotFoundException, InvalidRequestException, NoSuchFieldException, UnavailableException, IllegalAccessException, InstantiationException
{
    CliMain.connect("127.0.0.1", 9170);
    try
    {
        for (String stmt : statements)
            CliMain.processStatement(stmt);
    }
    catch (Exception e)
    {
    }
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:13,代码来源:ThriftColumnFamilyTest.java

示例3: cliSchema

import org.apache.cassandra.cli.CliMain; //导入方法依赖的package包/类
private void cliSchema() throws URISyntaxException, IOException, NotFoundException, InvalidRequestException, NoSuchFieldException, UnavailableException, IllegalAccessException, InstantiationException, TException, ClassNotFoundException, TimedOutException {
  CliMain.connect(_host, _port);
  InputStream in = Thread.currentThread().getContextClassLoader().getResourceAsStream(SQL_FILE_PATH);
  BufferedReader br = new BufferedReader(new InputStreamReader(in, "UTF-8"));
  String line = null;
  while ((line = br.readLine()) != null) {
    CliMain.processStatement(line);
  }
  br.close();
  CliMain.disconnect();
}
 
开发者ID:faustineinsun,项目名称:WiseCrowdRec,代码行数:12,代码来源:AstyanaxCassandraManipulator.java

示例4: initialSchema

import org.apache.cassandra.cli.CliMain; //导入方法依赖的package包/类
public void initialSchema() throws URISyntaxException, IOException, NotFoundException, InvalidRequestException, NoSuchFieldException, UnavailableException, IllegalAccessException, InstantiationException, TException, ClassNotFoundException, TimedOutException {
  CliMain.connect(_host, _port);
  InputStream in = Thread.currentThread().getContextClassLoader().getResourceAsStream(_sqlFilePath);
  BufferedReader br = new BufferedReader(new InputStreamReader(in, "UTF-8"));
  String line = null;
  while ((line = br.readLine()) != null) {
    CliMain.processStatement(line);
  }
  br.close();
  CliMain.disconnect();
}
 
开发者ID:faustineinsun,项目名称:WiseCrowdRec,代码行数:12,代码来源:PelopsCassandraManipulator.java

示例5: createColumnFamily

import org.apache.cassandra.cli.CliMain; //导入方法依赖的package包/类
private void createColumnFamily(String ks, String cf, String statement) throws CharacterCodingException, ClassNotFoundException, TException, TimedOutException, NotFoundException, InvalidRequestException, NoSuchFieldException, UnavailableException, IllegalAccessException, InstantiationException
{
    CliMain.connect("127.0.0.1", 9170);
    try
    {
        CliMain.processStatement("use " + ks + ";");
        CliMain.processStatement("drop column family " + cf + ";");
    }
    catch (Exception e)
    {
    }
    CliMain.processStatement(statement);
}
 
开发者ID:wso2,项目名称:wso2-cassandra,代码行数:14,代码来源:ThriftColumnFamilyTest.java


注:本文中的org.apache.cassandra.cli.CliMain.processStatement方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。