From: <ibr...@us...> - 2011-08-07 23:00:31
|
Revision: 4023 http://tora.svn.sourceforge.net/tora/?rev=4023&view=rev Author: ibre5041 Date: 2011-08-07 23:00:25 +0000 (Sun, 07 Aug 2011) Log Message: ----------- Modified Paths: -------------- branches/tora-trotl/sandbox/tsqlparseoracle.cpp branches/tora-trotl/src/parsing/tsqlparseoracle.cpp Modified: branches/tora-trotl/sandbox/tsqlparseoracle.cpp =================================================================== --- branches/tora-trotl/sandbox/tsqlparseoracle.cpp 2011-08-07 21:31:21 UTC (rev 4022) +++ branches/tora-trotl/sandbox/tsqlparseoracle.cpp 2011-08-07 23:00:25 UTC (rev 4023) @@ -347,12 +347,58 @@ void OracleSQLStatement::scanTree() { + QVector<QString> identifier; + bool dotFound = false; for(SQLParser::Statement::token_const_iterator i=begin(); i!=end(); ++i) { Token const &node = *i; switch(node.getTokenType()) { + case Token::L_SCHEMANAME: + case Token::L_TABLEALIAS: case Token::L_TABLENAME: + case Token::L_IDENTIFIER: + if(dotFound || identifier.empty()) + { + identifier.push_back(node.toString().toUpper()); + } else { + if(!identifier.empty()) + { + Identifier i(identifier); + _mIdentifiers.push_back(Identifier(identifier)); + identifier.clear(); + std::cout << "Push A: " << i.toString().toStdString() << ' ' << node.toString().toStdString() << std::endl; + } + identifier.push_back(node.toString().toUpper()); + } + dotFound = false; + break; + default: + if(node.toString().compare(QString('.')) == 0) + { + dotFound = true; + continue; + } + if(!identifier.empty()) + { + _mIdentifiers.push_back(Identifier(identifier)); + identifier.clear(); + } + dotFound = false; + } + } + if(!identifier.empty()) + { + _mIdentifiers.push_back(identifier); + identifier.clear(); + } + + for(SQLParser::Statement::token_const_iterator i=begin(); i!=end(); ++i) + { + Token const &node = *i; + switch(node.getTokenType()) + { + case Token::L_TABLENAME: _mTablesSet.insert( node.toString().toUpper()); break; case Token::L_SCHEMANAME: Modified: branches/tora-trotl/src/parsing/tsqlparseoracle.cpp =================================================================== --- branches/tora-trotl/src/parsing/tsqlparseoracle.cpp 2011-08-07 21:31:21 UTC (rev 4022) +++ branches/tora-trotl/src/parsing/tsqlparseoracle.cpp 2011-08-07 23:00:25 UTC (rev 4023) @@ -347,12 +347,58 @@ void OracleSQLStatement::scanTree() { + QVector<QString> identifier; + bool dotFound = false; for(SQLParser::Statement::token_const_iterator i=begin(); i!=end(); ++i) { Token const &node = *i; switch(node.getTokenType()) { + case Token::L_SCHEMANAME: + case Token::L_TABLEALIAS: case Token::L_TABLENAME: + case Token::L_IDENTIFIER: + if(dotFound || identifier.empty()) + { + identifier.push_back(node.toString().toUpper()); + } else { + if(!identifier.empty()) + { + Identifier i(identifier); + _mIdentifiers.push_back(Identifier(identifier)); + identifier.clear(); + std::cout << "Push A: " << i.toString().toStdString() << ' ' << node.toString().toStdString() << std::endl; + } + identifier.push_back(node.toString().toUpper()); + } + dotFound = false; + break; + default: + if(node.toString().compare(QString('.')) == 0) + { + dotFound = true; + continue; + } + if(!identifier.empty()) + { + _mIdentifiers.push_back(Identifier(identifier)); + identifier.clear(); + } + dotFound = false; + } + } + if(!identifier.empty()) + { + _mIdentifiers.push_back(identifier); + identifier.clear(); + } + + for(SQLParser::Statement::token_const_iterator i=begin(); i!=end(); ++i) + { + Token const &node = *i; + switch(node.getTokenType()) + { + case Token::L_TABLENAME: _mTablesSet.insert( node.toString().toUpper()); break; case Token::L_SCHEMANAME: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |