void QueryParser::testDeath(string _zap) { try { TreeNode *tree = parser->parse(_zap).release(); tree->putToString(); QParser::DeathRmver *rmver = new QParser::DeathRmver(this); TreeNode *nt = tree->clone(); rmver->rmvDeath(nt); } catch (...) { } }
int QueryParser::testParse (string query, TreeNode *&/*qTree*/) { string zap = "EMP where SAL = (EMP where NAME=\"KUBA\").SAL;"; if (false && (query == zap)){ TreeNode *tree = parser->parse(zap).release(); //printf( "po parsowaniu treeNode: %d. \n", tree); cout << "Odczyt z drzewka, ktore przekazuje:" << endl; cout << "--------------------------------------" << endl; tree->putToString(); cout << "\n--------------------------------------" << endl; QParser::Optimiser *opt = new QParser::Optimiser(); int reslt; cout << "now the following tree will be evaluated statically.." << endl; TreeNode *nt = tree->clone(); if ((reslt = opt->stEvalTest(nt)) != 0) fprintf (stderr, "static evaluation did not work out...\n"); else { cout << "static evaluatioin OK, result: "<< reslt << endl; fprintf (stderr, "now I will try to optimise the tree..\n"); cout << "OPTYMALIZUJE--------------------------------------------------------"<< endl; //cout << "przed optymalizacjia" << endl; //nt->putToString(); //cout << "-----------" << endl; int ooptres = nt->optimizeTree(); cout << "KONIEC OPTYMALIZACJI-------------------------------------------------------"<< endl; /*the nt tree needs to be 'rolled' up: (in case the nonalgopnode we were operating on was the root... */ while (nt->getParent() != NULL) nt = nt->getParent(); fprintf (stderr, "__%d__", ooptres); cout << "po JEDNYM PRZEBIEGU optymalizacji" << endl; nt->putToString(); cout << "-----------" << endl; fprintf (stderr, "end of optimisation.\n"); } cout << "TEST END__---------------------------------------------------------------------------------" << endl; } cout << "koniec parseIt\n"; return 0; }