Exemple #1
0
  void test_createindex()
  {
    cout << "Begining create index test ... " << endl;
    std::string sqlbuf = "CREATE  INDEX test1_idx ON tpch.nation (n_nationkey)";
    cout << sqlbuf << endl;
 
    SqlParser parser;
    parser.Parse(sqlbuf.c_str());
    if (parser.Good())
      {
	const ParseTree &ptree = parser.GetParseTree();

        cout << "Parser succeeded." << endl;
        cout << ptree.fList.size() << " " << "SQL statements" << endl;
        cout << ptree.fSqlText << endl;

	try
	  {
	    CreateIndexProcessor processor;
	    processor.setDebugLevel(CreateIndexProcessor::VERBOSE);
	    SqlStatement &stmt = *ptree.fList[0];
	    CreateIndexProcessor::DDLResult result;
	    DISPLAY(stmt.fSessionID);

	    result = processor.processPackage(dynamic_cast<CreateIndexStatement&>(stmt));

	    std::cout << "return: " << result.result << std::endl;
	  }
	catch(...)
	  {
	    throw;
	  }
      }
  }
Exemple #2
0
  void test_createindextest(std::string& sqlbuf)
  {
    cout << "Begining create index test ..." << endl;
     cout << sqlbuf << endl;

    SqlParser parser;
    parser.Parse(sqlbuf.c_str());
    if (parser.Good())
      {
	const ParseTree &ptree = parser.GetParseTree();
	cout << ptree.fSqlText << endl;

	try
	  {
	    CreateIndexProcessor processor;
	    processor.setDebugLevel(CreateIndexProcessor::VERBOSE);

	    SqlStatement &stmt = *ptree.fList[0];
	    CreateIndexProcessor::DDLResult result = processor.processPackage(dynamic_cast<CreateIndexStatement&>(stmt));
	    std::cout << "return: " << result.result << std::endl;
	  }
	catch(...)
	  {
	    throw;
	  }
      }
  }