Beispiel #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;
	  }
      }
  }
Beispiel #2
0
void TpchSchema::createindex(string createText)
{
	cout << endl;
	cout << createText << endl;

	boost::timer theTimer;
    ddlpackage::SqlParser parser;
    parser.Parse(createText.c_str());
    if (parser.Good())
    {
        const ddlpackage::ParseTree &ptree = parser.GetParseTree();
        try
            {
                CreateIndexProcessor processor;
                //processor.setDebugLevel(CreateIndexProcessor::VERBOSE);

                SqlStatement &stmt = *ptree.fList[0];
                CreateIndexProcessor::DDLResult result;
				boost::shared_ptr<erydbSystemCatalog> systemCatalogPtr =
        		erydbSystemCatalog::makeerydbSystemCatalog( 1 );
                result = processor.processPackage(dynamic_cast<CreateIndexStatement&>(stmt));
                systemCatalogPtr->removeerydbSystemCatalog(1);
                std::cout << "return: " << result.result << std::endl;
            }
        catch(...)
        {

            throw;
        }
    }
	cout << "Create index took :" << theTimer.elapsed() << " seconds to complete." << endl;
}
Beispiel #3
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;
	  }
      }
  }