diff options
Diffstat (limited to 'qlparser/querytree.cc')
-rw-r--r-- | qlparser/querytree.cc | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/qlparser/querytree.cc b/qlparser/querytree.cc index 4a14ed6..412a2a5 100644 --- a/qlparser/querytree.cc +++ b/qlparser/querytree.cc @@ -160,6 +160,9 @@ QueryTree::optimize( unsigned int currentOptimizationLevel ) } } + if (isValidOptimizationLevel(currentOptimizationLevel) == false) + throw r_Error(r_Error::r_Error_InvalidOptimizationLevel); + optimizationFnc(currentOptimizationLevel, rootNode); RMDBGIF( 1, RMDebug::module_qlparser, "QueryTree", \ @@ -487,3 +490,17 @@ void QueryTree::rewriteDomainObjects(r_Minterval *greatDomain, string *greatIter void QueryTree::addCString( char *str ) { lexedCStringList.push_back( str ); } + +bool QueryTree::isValidOptimizationLevel( int level ) +{ + switch (level) + { + case STANDARDIZATION: + case SIMPLIFICATION: + case SUBEXPRESSIONS: + return true; + + default: + return false; + } +} |