diff options
-rw-r--r-- | connectivity/source/parse/sqliterator.cxx | 132 | ||||
-rw-r--r-- | connectivity/source/parse/sqlnode.cxx | 106 |
2 files changed, 117 insertions, 121 deletions
diff --git a/connectivity/source/parse/sqliterator.cxx b/connectivity/source/parse/sqliterator.cxx index ae316890b05d..6a3b15761e27 100644 --- a/connectivity/source/parse/sqliterator.cxx +++ b/connectivity/source/parse/sqliterator.cxx @@ -72,8 +72,8 @@ namespace connectivity Reference< XNameAccess > m_xTableContainer; Reference< XNameAccess > m_xQueryContainer; - ::boost::shared_ptr< OSQLTables > m_pTables; /// all tables which participate in the SQL statement - ::boost::shared_ptr< OSQLTables > m_pSubTables; /// all tables from sub queries not the tables from the select tables + ::boost::shared_ptr< OSQLTables > m_pTables; // all tables which participate in the SQL statement + ::boost::shared_ptr< OSQLTables > m_pSubTables; // all tables from sub queries not the tables from the select tables ::boost::shared_ptr< QueryNameSet > m_pForbiddenQueryNames; sal_uInt32 m_nIncludeMask; @@ -216,14 +216,14 @@ void OSQLParseTreeIterator::setParseTree(const OSQLParseNode * pNewParseTree) return; } - // falls m_pParseTree aber keine Connection, dann Fehler + // If m_pParseTree, but no connection then return if ( !m_pImpl->m_xTableContainer.is() ) return; m_aErrors = SQLException(); - // Statement-Typ ermitteln ... + // Determine statement type ... if (SQL_ISRULE(m_pParseTree,select_statement) || SQL_ISRULE(m_pParseTree,union_statement) ) { m_eStatementType = SQL_STATEMENT_SELECT; @@ -456,7 +456,7 @@ void OSQLParseTreeIterator::traverseOneTableName( OSQLTables& _rTables,const OSQ ::rtl::OUString aSchema,aTableName,aComposedName; ::rtl::OUString aTableRange(rTableRange); - // Tabellenname abholen + // Get table name OSQLParseNode::getTableComponents(pTableName,aCatalog,aSchema,aTableName,m_pImpl->m_xDatabaseMetaData); // create the composed name like DOMAIN.USER.TABLE1 @@ -479,16 +479,16 @@ void OSQLParseTreeIterator::traverseOneTableName( OSQLTables& _rTables,const OSQ //----------------------------------------------------------------------------- void OSQLParseTreeIterator::impl_fillJoinConditions(const OSQLParseNode* i_pJoinCondition) { - if (i_pJoinCondition->count() == 3 && // Ausdruck is geklammert + if (i_pJoinCondition->count() == 3 && // Expression with brackets SQL_ISPUNCTUATION(i_pJoinCondition->getChild(0),"(") && SQL_ISPUNCTUATION(i_pJoinCondition->getChild(2),")")) { impl_fillJoinConditions(i_pJoinCondition->getChild(1)); } - else if (SQL_ISRULEOR2(i_pJoinCondition,search_condition,boolean_term) && // AND/OR-Verknuepfung: + else if (SQL_ISRULEOR2(i_pJoinCondition,search_condition,boolean_term) && // AND/OR logic operation: i_pJoinCondition->count() == 3) { - // nur AND Verkn�pfung zulassen + // Only allow AND logic operation if ( SQL_ISTOKEN(i_pJoinCondition->getChild(1),AND) ) { impl_fillJoinConditions(i_pJoinCondition->getChild(0)); @@ -498,7 +498,7 @@ void OSQLParseTreeIterator::impl_fillJoinConditions(const OSQLParseNode* i_pJoin else if (SQL_ISRULE(i_pJoinCondition,comparison_predicate)) { // only the comparison of columns is allowed - OSL_ENSURE(i_pJoinCondition->count() == 3,"OQueryDesignView::InsertJoinConnection: Fehler im Parse Tree"); + OSL_ENSURE(i_pJoinCondition->count() == 3,"OQueryDesignView::InsertJoinConnection: error in the parse tree"); if (SQL_ISRULE(i_pJoinCondition->getChild(0),column_ref) && SQL_ISRULE(i_pJoinCondition->getChild(2),column_ref) && i_pJoinCondition->getChild(1)->getNodeType() == SQL_NODE_EQUAL) @@ -540,7 +540,7 @@ void OSQLParseTreeIterator::getQualified_join( OSQLTables& _rTables, const OSQLP else { const OSQLParseNode* pColumnCommalist = pJoin_spec->getChild(2); - // Alle Columns in der column_commalist ... + // All columns in the column_commalist ... for (sal_uInt32 i = 0; i < pColumnCommalist->count(); i++) { const OSQLParseNode * pCol = pColumnCommalist->getChild(i); @@ -631,7 +631,7 @@ void OSQLParseTreeIterator::getSelect_statement(OSQLTables& _rTables,const OSQLP const OSQLParseNode* pTableName = NULL; ::rtl::OUString aTableRange; for (sal_uInt32 i = 0; i < pTableRefCommalist->count(); i++) - { // from clause durchlaufen + { // Process FROM clause aTableRange = ::rtl::OUString(); const OSQLParseNode* pTableListElement = pTableRefCommalist->getChild(i); @@ -641,10 +641,10 @@ void OSQLParseTreeIterator::getSelect_statement(OSQLTables& _rTables,const OSQLP } else if ( SQL_ISRULE( pTableListElement, table_ref ) ) { - // Tabellenreferenz kann aus Tabellennamen, Tabellennamen (+),'('joined_table')'(+) bestehen + // Table refereneces can be made up of table names, table names (+),'('joined_table')'(+) pTableName = pTableListElement->getChild(0); if( isTableNode( pTableName ) ) - { // Tabellennamen gefunden + { // Found table names aTableRange = OSQLParseNode::getTableRange(pTableListElement); traverseOneTableName( _rTables, pTableName, aTableRange ); } @@ -762,7 +762,7 @@ namespace } } else if(SQL_ISRULE(_pColumnRef,general_set_fct) || SQL_ISRULE(_pColumnRef,set_fct_spec)) - { // Funktion + { // Function _pColumnRef->parseNodeToStr( _out_rColumnName, _rxConnection ); } else if(_pColumnRef->getNodeType() == SQL_NODE_NAME) @@ -803,14 +803,14 @@ void OSQLParseTreeIterator::getColumnRange( const OSQLParseNode* _pColumnRef, sal_Bool OSQLParseTreeIterator::getColumnTableRange(const OSQLParseNode* pNode, ::rtl::OUString &rTableRange) const { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseTreeIterator::getColumnTableRange" ); - // Ermitteln ob alle Spalten zu einer Tabelle gehoeren + // See if all columns belong to one table if (SQL_ISRULE(pNode,column_ref)) { ::rtl::OUString aColName, aTableRange; getColumnRange(pNode, aColName, aTableRange); if (aTableRange.isEmpty()) // keinen gefunden { - // dann die Spalte in den Tabellen suchen + // Look for the columns in the tables for (ConstOSQLTablesIterator aIter = m_pImpl->m_pTables->begin(); aIter != m_pImpl->m_pTables->end(); ++aIter) { if (aIter->second.is()) @@ -936,7 +936,7 @@ bool OSQLParseTreeIterator::traverseSelectColumnNames(const OSQLParseNode* pSele } static ::rtl::OUString aEmptyString; - // nyi: mehr Pruefung auf korrekte Struktur! + // nyi: more checks for correct structure! if (pSelectNode->getChild(2)->isRule() && SQL_ISPUNCTUATION(pSelectNode->getChild(2)->getChild(0),"*")) { // SELECT * ... @@ -957,7 +957,7 @@ bool OSQLParseTreeIterator::traverseSelectColumnNames(const OSQLParseNode* pSele pColumnRef->getChild(0)->count() == 3 && SQL_ISPUNCTUATION(pColumnRef->getChild(0)->getChild(2),"*")) { - // alle Spalten der Tabelle + // All the table's columns ::rtl::OUString aTableRange; pColumnRef->getChild(0)->parseNodeToStr( aTableRange, m_pImpl->m_xConnection, NULL, sal_False, sal_False ); setSelectColumnName(m_aSelectColumns,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("*")), aEmptyString,aTableRange); @@ -965,7 +965,7 @@ bool OSQLParseTreeIterator::traverseSelectColumnNames(const OSQLParseNode* pSele } else if (SQL_ISRULE(pColumnRef,derived_column)) { - ::rtl::OUString aColumnAlias(getColumnAlias(pColumnRef)); // kann leer sein + ::rtl::OUString aColumnAlias(getColumnAlias(pColumnRef)); // can be empty ::rtl::OUString sColumnName; ::rtl::OUString aTableRange; sal_Int32 nType = DataType::VARCHAR; @@ -981,20 +981,20 @@ bool OSQLParseTreeIterator::traverseSelectColumnNames(const OSQLParseNode* pSele if (SQL_ISRULE(pColumnRef,column_ref)) { getColumnRange(pColumnRef,sColumnName,aTableRange); - OSL_ENSURE(!sColumnName.isEmpty(),"Columnname darf nicht leer sein"); + OSL_ENSURE(!sColumnName.isEmpty(),"Column name must not be empty!"); } else /*if (SQL_ISRULE(pColumnRef,general_set_fct) || SQL_ISRULE(pColumnRef,set_fct_spec) || SQL_ISRULE(pColumnRef,position_exp) || SQL_ISRULE(pColumnRef,extract_exp) || SQL_ISRULE(pColumnRef,length_exp) || SQL_ISRULE(pColumnRef,char_value_fct)|| SQL_ISRULE(pColumnRef,num_value_exp) || SQL_ISRULE(pColumnRef,term))*/ { - /* Funktionsaufruf vorhanden */ + // Function call present pColumnRef->parseNodeToStr( sColumnName, m_pImpl->m_xConnection, NULL, sal_False, sal_True ); ::rtl::OUString sTableRange; // check if the column is also a parameter traverseORCriteria(pColumnRef); // num_value_exp - // gehoeren alle beteiligten Spalten der Funktion zu einer Tabelle + // Do all involved columns of the function belong to one table? if (m_pImpl->m_pTables->size() == 1) { aTableRange = m_pImpl->m_pTables->begin()->first; @@ -1097,13 +1097,13 @@ void OSQLParseTreeIterator::traverseByColumnNames(const OSQLParseNode* pSelectNo sColumnName = ::rtl::OUString(); if ( SQL_ISRULE(pColumnRef,column_ref) ) { - // Column-Name (und TableRange): + // Column name (and TableRange): if(SQL_ISRULE(pColumnRef,column_ref)) getColumnRange(pColumnRef,sColumnName,aTableRange); - else // eine Expression + else // an expression pColumnRef->parseNodeToStr( sColumnName, m_pImpl->m_xConnection, NULL, sal_False, sal_False ); - OSL_ENSURE(!sColumnName.isEmpty(),"sColumnName darf nicht leer sein"); + OSL_ENSURE(!sColumnName.isEmpty(),"sColumnName must not be empty!"); } else { // here I found a predicate @@ -1212,8 +1212,8 @@ bool OSQLParseTreeIterator::traverseSelectionCriteria(const OSQLParseNode* pSele return false; - // Parse Tree analysieren (je nach Statement-Typ) - // und Zeiger auf WHERE-Klausel setzen: + // Analyse parse tree (depending on statement type) + // and set pointer to WHERE clause: OSQLParseNode * pWhereClause = NULL; if (m_eStatementType == SQL_STATEMENT_SELECT) @@ -1241,25 +1241,24 @@ bool OSQLParseTreeIterator::traverseSelectionCriteria(const OSQLParseNode* pSele // nyi OSL_FAIL("OSQLParseTreeIterator::getSelectionCriteria: positioned nyi"); } else { - // Anderes Statement. Keine Selektionskriterien. + // Other statement, no selection criteria return false; } if (! SQL_ISRULE(pWhereClause,where_clause)) { - // Die Where Clause ist meistens optional, d. h. es koennte sich auch - // um "optional_where_clause" handeln. + // The WHERE clause is optional most of the time; which means it could be a "optional_where_clause". OSL_ENSURE(SQL_ISRULE(pWhereClause,opt_where_clause),"OSQLParseTreeIterator: error in parse tree!"); return false; } - // Wenn es aber eine where_clause ist, dann darf sie nicht leer sein: + // But if it's a where_clause, then it must not be empty OSL_ENSURE(pWhereClause->count() == 2,"OSQLParseTreeIterator: error in parse tree!"); OSQLParseNode * pComparisonPredicate = pWhereClause->getChild(1); OSL_ENSURE(pComparisonPredicate != NULL,"OSQLParseTreeIterator: error in parse tree!"); // - // Und nun die Vergleichskriterien abarbeiten (rekursiv, alles ist erstmal ein OR-Kriterium): + // Process the comparison criteria now (recursively, for a start everything is an OR criterion) // traverseORCriteria(pComparisonPredicate); @@ -1279,28 +1278,27 @@ void OSQLParseTreeIterator::traverseORCriteria(OSQLParseNode * pSearchCondition) SQL_ISPUNCTUATION(pSearchCondition->getChild(2),")") ) { - // Runde Klammern um den Ausdruck + // Round brackets around the expression traverseORCriteria(pSearchCondition->getChild(1)); } else if (SQL_ISRULE(pSearchCondition,search_condition) && pSearchCondition->count() == 3 && SQL_ISTOKEN(pSearchCondition->getChild(1),OR)) { - // OR-Verknuepfung: - + // OR logic operation for (int i = 0; i < 3; i++) { - if (i == 1) continue; // Schluesselwort OR ueberspringen + if (i == 1) continue; // Skip OR keyword - // Ist das erste Element wieder eine OR-Verknuepfung? + // Is the first element an OR again? if (i == 0 && SQL_ISRULE(pSearchCondition->getChild(0),search_condition) && pSearchCondition->getChild(0)->count() == 3 && SQL_ISTOKEN(pSearchCondition->getChild(0)->getChild(1),OR)) { - // Dann rekursiv absteigen ... + // Then process recursively traverseORCriteria(pSearchCondition->getChild(0)); } else { - // AND-Kriterien ... + // AND criteria traverseANDCriteria(pSearchCondition->getChild(i)); // if (! aIteratorStatus.IsSuccessful()) break; } @@ -1308,13 +1306,13 @@ void OSQLParseTreeIterator::traverseORCriteria(OSQLParseNode * pSearchCondition) // if (! aIteratorStatus.IsSuccessful()) break; } } else { - // Nur *ein* Kriterium oder eine AND-Verknuepfung von Kriterien. - // Direkt die AND-Kriterien behandeln. + // Only *one* criterion or one AND logical operation of criteria + // Process the AND criteria directly traverseANDCriteria(pSearchCondition); // if (! aIteratorStatus.IsSuccessful()) return; } - // Fehler einfach weiterreichen. + // Just pass on the error } //----------------------------------------------------------------------------- @@ -1330,32 +1328,32 @@ void OSQLParseTreeIterator::traverseANDCriteria(OSQLParseNode * pSearchCondition SQL_ISPUNCTUATION(pSearchCondition->getChild(2),")") ) { - // Runde Klammern + // Round brackets traverseANDCriteria(pSearchCondition->getChild(1)); } - // Das erste Element ist eine OR-Verknuepfung + // The first element is an OR logical operation else if ( SQL_ISRULE(pSearchCondition,search_condition) && pSearchCondition->count() == 3 ) { - // Dann rekursiv absteigen (dieselbe Row benutzen) ... + // Then process recursively (use the same row) ... traverseORCriteria(pSearchCondition->getChild(0)); // if (! aIteratorStatus.IsSuccessful()) // return; - // Und mit dem rechten Child weitermachen: + // Continue with the right child traverseANDCriteria(pSearchCondition->getChild(2)); } - // Das erste Element ist (wieder) eine AND-Verknuepfung + // The first element is an AND logical operation (again) else if ( SQL_ISRULE(pSearchCondition,boolean_term) && pSearchCondition->count() == 3 ) { - // Dann rekursiv absteigen (dieselbe Row benutzen) ... + // Then process recursively (use the same row) traverseANDCriteria(pSearchCondition->getChild(0)); // if (! aIteratorStatus.IsSuccessful()) // return; - // Und mit dem rechten Child weitermachen: + // Continue with the right child traverseANDCriteria(pSearchCondition->getChild(2)); } - // Sonst einzelne Suchkriterien wie =, !=, ..., LIKE, IS NULL usw. behandeln: + // Else, process single search criteria (like =, !=, ..., LIKE, IS NULL etc.) else if (SQL_ISRULE(pSearchCondition,comparison_predicate) ) { ::rtl::OUString aValue; @@ -1389,7 +1387,7 @@ void OSQLParseTreeIterator::traverseANDCriteria(OSQLParseNode * pSearchCondition if (SQL_ISRULE(pNum_value_exp,parameter)) pParam = pNum_value_exp; else if(pNum_value_exp->isToken()) - // Normaler Wert + // Normal value aValue = pNum_value_exp->getTokenValue(); else { @@ -1442,7 +1440,7 @@ void OSQLParseTreeIterator::traverseANDCriteria(OSQLParseNode * pSearchCondition traverseOnePredicate(pSearchCondition->getChild(0),aString,pSearchCondition->getChild(0)); traverseOnePredicate(pSearchCondition->getChild(2),aString,pSearchCondition->getChild(2)); } - // Fehler einfach weiterreichen. + // Just pass on the error } //----------------------------------------------------------------------------- void OSQLParseTreeIterator::traverseParameter(const OSQLParseNode* _pParseNode @@ -1589,7 +1587,7 @@ void OSQLParseTreeIterator::traverseOnePredicate( if ( !pParseNode ) return; - // Column-Name (und TableRange): + // Column name (and TableRange): ::rtl::OUString aColumnName, aTableRange, sColumnAlias; getColumnRange( pColumnRef, aColumnName, aTableRange, sColumnAlias); @@ -1659,7 +1657,7 @@ void OSQLParseTreeIterator::impl_traverse( sal_uInt32 _nIncludeMask ) } } -// Dummy-Implementationen: +// Dummy implementations //----------------------------------------------------------------------------- OSQLTable OSQLParseTreeIterator::impl_createTableObject( const ::rtl::OUString& rTableName, @@ -1816,7 +1814,7 @@ void OSQLParseTreeIterator::setSelectColumnName(::rtl::Reference<OSQLColumns>& _ _rColumns->get().push_back(xCol); } } - else // ColumnName und Tablename vorhanden + else // ColumnName and TableName exist { ConstOSQLTablesIterator aFind = m_pImpl->m_pTables->find(rTableRange); @@ -1859,7 +1857,7 @@ void OSQLParseTreeIterator::setSelectColumnName(::rtl::Reference<OSQLColumns>& _ else bError = sal_True; - // Tabelle existiert nicht oder Feld nicht vorhanden + // Table does not exist or lacking field if (bError) { ::rtl::OUString aNewColName(getUniqueColumnName(rColumnAlias)); @@ -1953,8 +1951,8 @@ const OSQLParseNode* OSQLParseTreeIterator::getWhereTree() const if (!m_pParseTree) return NULL; - // Parse Tree analysieren (je nach Statement-Typ) - // und Zeiger auf WHERE-Klausel setzen: + // Analyse parse tree (depending on statement type) + // and set pointer to WHERE clause: OSQLParseNode * pWhereClause = NULL; if(getStatementType() == SQL_STATEMENT_SELECT) { @@ -1985,8 +1983,8 @@ const OSQLParseNode* OSQLParseTreeIterator::getOrderTree() const if (!m_pParseTree || getStatementType() != SQL_STATEMENT_SELECT) return NULL; - // Parse Tree analysieren (je nach Statement-Typ) - // und Zeiger auf ORDER-Klausel setzen: + // Analyse parse tree (depending on statement type) + // and set pointer to ORDER clause: OSQLParseNode * pOrderClause = NULL; OSL_ENSURE(m_pParseTree->count() >= 4,"ParseTreeIterator: error in parse tree!"); OSQLParseNode * pTableExp = m_pParseTree->getChild(3); @@ -2007,8 +2005,8 @@ const OSQLParseNode* OSQLParseTreeIterator::getGroupByTree() const if (!m_pParseTree || getStatementType() != SQL_STATEMENT_SELECT) return NULL; - // Parse Tree analysieren (je nach Statement-Typ) - // und Zeiger auf ORDER-Klausel setzen: + // Analyse parse tree (depending on statement type) + // and set pointer to ORDER clause: OSQLParseNode * pGroupClause = NULL; OSL_ENSURE(m_pParseTree->count() >= 4,"ParseTreeIterator: error in parse tree!"); OSQLParseNode * pTableExp = m_pParseTree->getChild(3); @@ -2028,8 +2026,8 @@ const OSQLParseNode* OSQLParseTreeIterator::getHavingTree() const if (!m_pParseTree || getStatementType() != SQL_STATEMENT_SELECT) return NULL; - // Parse Tree analysieren (je nach Statement-Typ) - // und Zeiger auf ORDER-Klausel setzen: + // Analyse parse tree (depending on statement type) + // and set pointer to ORDER clause: OSQLParseNode * pHavingClause = NULL; OSL_ENSURE(m_pParseTree->count() >= 4,"ParseTreeIterator: error in parse tree!"); OSQLParseNode * pTableExp = m_pParseTree->getChild(3); @@ -2038,7 +2036,7 @@ const OSQLParseNode* OSQLParseTreeIterator::getHavingTree() const OSL_ENSURE(pTableExp->count() == TABLE_EXPRESSION_CHILD_COUNT,"OSQLParseTreeIterator: error in parse tree!"); pHavingClause = pTableExp->getChild(3); - // Wenn es aber eine order_by ist, dann darf sie nicht leer sein: + // If it is an order_by, then it must not be empty if(pHavingClause->count() < 1) pHavingClause = NULL; return pHavingClause; @@ -2116,7 +2114,7 @@ Reference< XPropertySet > OSQLParseTreeIterator::findColumn(const OSQLTables& _r if( xColumns.is() && xColumns->hasByName(rColumnName) && (xColumns->getByName(rColumnName) >>= xColumn) ) { OSL_ENSURE(xColumn.is(),"Column isn't a propertyset!"); - break; // diese Column darf nur einmal vorkommen + break; // This column must only exits once } } } @@ -2186,7 +2184,7 @@ sal_Int32 OSQLParseTreeIterator::getFunctionReturnType(const OSQLParseNode* _pNo ::rtl::OUString sColumnName; ::rtl::OUString aTableRange; getColumnRange(pValueExp,sColumnName,aTableRange); - OSL_ENSURE(!sColumnName.isEmpty(),"Columnname darf nicht leer sein"); + OSL_ENSURE(!sColumnName.isEmpty(),"Columnname must not be empty!"); Reference<XPropertySet> xColumn = findColumn( sColumnName, aTableRange, true ); if ( xColumn.is() ) diff --git a/connectivity/source/parse/sqlnode.cxx b/connectivity/source/parse/sqlnode.cxx index d076f57bbd0c..7b4e4dd9ad54 100644 --- a/connectivity/source/parse/sqlnode.cxx +++ b/connectivity/source/parse/sqlnode.cxx @@ -129,7 +129,7 @@ namespace { ::rtl::OUString rNewValue = rQuot; rNewValue += rValue; - sal_Int32 nIndex = (sal_Int32)-1; // Quotes durch zweifache Quotes ersetzen, sonst kriegt der Parser Probleme + sal_Int32 nIndex = (sal_Int32)-1; // Replace quotes with double quotes or the parser gets into problems if (!rQuot.isEmpty()) { @@ -363,7 +363,7 @@ void OSQLParseNode::impl_parseNodeToString_throw(::rtl::OUStringBuffer& rString, return; } - // einmal auswerten wieviel Subtrees dieser Knoten besitzt + // Lets see how many nodes this subtree has sal_uInt32 nCount = count(); bool bHandled = false; @@ -412,9 +412,9 @@ void OSQLParseNode::impl_parseNodeToString_throw(::rtl::OUStringBuffer& rString, break; case like_predicate: - // je nachdem ob international angegeben wird oder nicht wird like anders behandelt - // interanational: *, ? sind Platzhalter - // sonst SQL92 konform: %, _ + // Depending on whether international is given, LIKE is treated differently + // international: *, ? are placeholders + // else SQL92 conform: %, _ impl_parseLikeNodeToString_throw( rString, rParam ); bHandled = true; break; @@ -428,7 +428,7 @@ void OSQLParseNode::impl_parseNodeToString_throw(::rtl::OUStringBuffer& rString, { if (!addDateValue(rString, rParam)) { - // Funktionsname nicht quoten + // Do not quote function name SQLParseNodeParameter aNewParam(rParam); aNewParam.bQuote = ( SQL_ISRULE(this,length_exp) || SQL_ISRULE(this,char_value_fct) ); @@ -443,7 +443,7 @@ void OSQLParseNode::impl_parseNodeToString_throw(::rtl::OUStringBuffer& rString, { pSubTree->impl_parseNodeToString_throw( aStringPara, aNewParam ); - // bei den CommaListen zwischen alle Subtrees Commas setzen + // In the comma lists, put commas in-between all subtrees if ((m_eNodeType == SQL_NODE_COMMALISTRULE) && (i < (nCount - 1))) aStringPara.appendAscii(","); } @@ -527,7 +527,7 @@ void OSQLParseNode::impl_parseNodeToString_throw(::rtl::OUStringBuffer& rString, pSubTree->impl_parseNodeToString_throw( rString, aNewParam ); ++i; - // bei den CommaListen zwischen alle Subtrees Commas setzen + // In the comma lists, put commas in-between all subtrees if ((m_eNodeType == SQL_NODE_COMMALISTRULE) && (i != m_aChildren.end())) rString.appendAscii(","); } @@ -537,7 +537,7 @@ void OSQLParseNode::impl_parseNodeToString_throw(::rtl::OUStringBuffer& rString, pSubTree->impl_parseNodeToString_throw( rString, aNewParam ); ++i; - // bei den CommaListen zwischen alle Subtrees Commas setzen + // In the comma lists, put commas in-between all subtrees if ((m_eNodeType == SQL_NODE_COMMALISTRULE) && (i != m_aChildren.end())) { if (SQL_ISRULE(this,value_exp_commalist) && rParam.bPredicate) @@ -877,7 +877,7 @@ OSQLParseNode* OSQLParser::convertNode(sal_Int32 nType,OSQLParseNode*& pLiteral) case DataType::FLOAT: case DataType::REAL: case DataType::DOUBLE: - // kill thousand seperators if any + // kill thousand seperators if any killThousandSeparator(pReturn); break; case DataType::CHAR: @@ -1236,7 +1236,7 @@ OSQLParseNode* OSQLParser::predicateTree(::rtl::OUString& rErrorMessage, const : m_pParseTree = NULL; m_sErrorMessage= ::rtl::OUString(); - // ... und den Parser anwerfen ... + // Start the parser if (SQLyyparse() != 0) { m_sFieldName= ::rtl::OUString(); @@ -1266,11 +1266,10 @@ OSQLParseNode* OSQLParser::predicateTree(::rtl::OUString& rErrorMessage, const : m_nFormatKey = 0; m_nDateFormatKey = 0; - // Das Ergebnis liefern (den Root Parse Node): + // Return the result (the root parse node): - // Stattdessen setzt die Parse-Routine jetzt den Member pParseTree - // - einfach diesen zurueckliefern: - OSL_ENSURE(m_pParseTree != NULL,"OSQLParser: Parser hat keinen ParseTree geliefert"); + // Instead, the parse method sets the member pParseTree and simply returns that + OSL_ENSURE(m_pParseTree != NULL,"OSQLParser: Parser did not return a ParseTree!"); return m_pParseTree; } } @@ -1296,7 +1295,7 @@ OSQLParser::OSQLParser(const ::com::sun::star::uno::Reference< ::com::sun::star: #endif ::osl::MutexGuard aGuard(getMutex()); - // do we have to initialize the data + // Do we have to initialize the data? if (s_nRefCount == 0) { s_pScanner = new OSQLScanner(); @@ -1306,7 +1305,7 @@ OSQLParser::OSQLParser(const ::com::sun::star::uno::Reference< ::com::sun::star: if(!s_xLocaleData.is()) s_xLocaleData = Reference<XLocaleData>(m_xServiceFactory->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.i18n.LocaleData"))),UNO_QUERY); - // auf 0 zuruecksetzen + // reset to 0 memset(OSQLParser::s_nRuleIDs,0,sizeof(OSQLParser::s_nRuleIDs[0]) * (OSQLParseNode::rule_count+1)); struct @@ -1442,7 +1441,7 @@ OSQLParser::~OSQLParser() { { ::osl::MutexGuard aGuard(getMutex()); - OSL_ENSURE(s_nRefCount > 0, "OSQLParser::~OSQLParser() : suspicious call : have a refcount of 0 !"); + OSL_ENSURE(s_nRefCount > 0, "OSQLParser::~OSQLParser() : suspicious call : has a refcount of 0 !"); if (!--s_nRefCount) { s_pScanner->setScanner(sal_True); @@ -1451,7 +1450,7 @@ OSQLParser::~OSQLParser() delete s_pGarbageCollector; s_pGarbageCollector = NULL; - // is only set the first time so we should delete it only when there no more instances + // Is only set the first time, so we should delete it only when there are no more instances s_xLocaleData = NULL; RuleIDMap aEmpty; @@ -1560,7 +1559,7 @@ OSQLParseNode::OSQLParseNode(const sal_Char * pNewValue, { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseNode::OSQLParseNode" ); - OSL_ENSURE(m_eNodeType >= SQL_NODE_RULE && m_eNodeType <= SQL_NODE_CONCAT,"OSQLParseNode: mit unzulaessigem NodeType konstruiert"); + OSL_ENSURE(m_eNodeType >= SQL_NODE_RULE && m_eNodeType <= SQL_NODE_CONCAT,"OSQLParseNode: created with invalid NodeType"); } //----------------------------------------------------------------------------- OSQLParseNode::OSQLParseNode(const ::rtl::OString &_rNewValue, @@ -1573,7 +1572,7 @@ OSQLParseNode::OSQLParseNode(const ::rtl::OString &_rNewValue, { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseNode::OSQLParseNode" ); - OSL_ENSURE(m_eNodeType >= SQL_NODE_RULE && m_eNodeType <= SQL_NODE_CONCAT,"OSQLParseNode: mit unzulaessigem NodeType konstruiert"); + OSL_ENSURE(m_eNodeType >= SQL_NODE_RULE && m_eNodeType <= SQL_NODE_CONCAT,"OSQLParseNode: created with invalid NodeType"); } //----------------------------------------------------------------------------- OSQLParseNode::OSQLParseNode(const sal_Unicode * pNewValue, @@ -1586,7 +1585,7 @@ OSQLParseNode::OSQLParseNode(const sal_Unicode * pNewValue, { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseNode::OSQLParseNode" ); - OSL_ENSURE(m_eNodeType >= SQL_NODE_RULE && m_eNodeType <= SQL_NODE_CONCAT,"OSQLParseNode: mit unzulaessigem NodeType konstruiert"); + OSL_ENSURE(m_eNodeType >= SQL_NODE_RULE && m_eNodeType <= SQL_NODE_CONCAT,"OSQLParseNode: created with invalid NodeType"); } //----------------------------------------------------------------------------- OSQLParseNode::OSQLParseNode(const ::rtl::OUString &_rNewValue, @@ -1599,29 +1598,28 @@ OSQLParseNode::OSQLParseNode(const ::rtl::OUString &_rNewValue, { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseNode::OSQLParseNode" ); - OSL_ENSURE(m_eNodeType >= SQL_NODE_RULE && m_eNodeType <= SQL_NODE_CONCAT,"OSQLParseNode: mit unzulaessigem NodeType konstruiert"); + OSL_ENSURE(m_eNodeType >= SQL_NODE_RULE && m_eNodeType <= SQL_NODE_CONCAT,"OSQLParseNode: created with invalid NodeType"); } //----------------------------------------------------------------------------- OSQLParseNode::OSQLParseNode(const OSQLParseNode& rParseNode) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseNode::OSQLParseNode" ); - // klemm den getParent auf NULL + // Set the getParent to NULL m_pParent = NULL; - // kopiere die member + // Copy the members m_aNodeValue = rParseNode.m_aNodeValue; m_eNodeType = rParseNode.m_eNodeType; m_nNodeID = rParseNode.m_nNodeID; - // denk dran, dass von Container abgeleitet wurde, laut SV-Help erzeugt - // copy-Constructor des Containers einen neuen Container mit den gleichen - // Zeigern als Inhalt -> d.h. nach dem Kopieren des Container wird fuer - // alle Zeiger ungleich NULL eine Kopie hergestellt und anstelle des alten - // Zeigers wieder eingehangen. + // Remember that we derived from Container. According to SV-Help the Container's + // copy ctor creates a new Container with the same pointers for content. + // This means after copying the Container, for all non-NULL pointers a copy is + // created and reattached instead of the old pointer. - // wenn kein Blatt, dann SubTrees bearbeiten + // If not a leaf, then process SubTrees for (OSQLParseNodes::const_iterator i = rParseNode.m_aChildren.begin(); i != rParseNode.m_aChildren.end(); ++i) append(new OSQLParseNode(**i)); @@ -1632,7 +1630,7 @@ OSQLParseNode& OSQLParseNode::operator=(const OSQLParseNode& rParseNode) { if (this != &rParseNode) { - // kopiere die member - pParent bleibt der alte + // Copy the members - pParent remains the same m_aNodeValue = rParseNode.m_aNodeValue; m_eNodeType = rParseNode.m_eNodeType; m_nNodeID = rParseNode.m_nNodeID; @@ -1653,7 +1651,7 @@ OSQLParseNode& OSQLParseNode::operator=(const OSQLParseNode& rParseNode) //----------------------------------------------------------------------------- sal_Bool OSQLParseNode::operator==(OSQLParseNode& rParseNode) const { - // die member muessen gleich sein + // The members must be equal sal_Bool bResult = (m_nNodeID == rParseNode.m_nNodeID) && (m_eNodeType == rParseNode.m_eNodeType) && (m_aNodeValue == rParseNode.m_aNodeValue) && @@ -1683,14 +1681,14 @@ void OSQLParseNode::append(OSQLParseNode* pNewNode) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseNode::append" ); - OSL_ENSURE(pNewNode != NULL, "OSQLParseNode: ungueltiger NewSubTree"); - OSL_ENSURE(pNewNode->getParent() == NULL, "OSQLParseNode: Knoten ist kein Waise"); + OSL_ENSURE(pNewNode != NULL, "OSQLParseNode: invalid NewSubTree"); + OSL_ENSURE(pNewNode->getParent() == NULL, "OSQLParseNode: Node is not an orphan"); OSL_ENSURE(::std::find(m_aChildren.begin(), m_aChildren.end(), pNewNode) == m_aChildren.end(), "OSQLParseNode::append() Node already element of parent"); - // stelle Verbindung zum getParent her: + // Create connection to getParent pNewNode->setParent( this ); - // und haenge den SubTree hinten an + // and attach the SubTree at the end m_aChildren.push_back(pNewNode); } // ----------------------------------------------------------------------------- @@ -1936,7 +1934,7 @@ void OSQLParseNode::negateSearchCondition(OSQLParseNode*& pSearchCondition,sal_B replaceAndReset(pSearchCondition,pBooleanTest); if (!bNegate) - negateSearchCondition(pSearchCondition,sal_True); // negate all deeper values + negateSearchCondition(pSearchCondition,sal_True); // negate all deeper values } // row_value_constructor comparison row_value_constructor // row_value_constructor comparison any_all_some subquery @@ -2132,7 +2130,7 @@ void OSQLParseNode::absorptions(OSQLParseNode*& pSearchCondition) void OSQLParseNode::compress(OSQLParseNode *&pSearchCondition) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseNode::compress" ); - if(!pSearchCondition) // no where condition at entry point + if(!pSearchCondition) // no WHERE condition at entry point return; OSQLParseNode::eraseBraces(pSearchCondition); @@ -2252,7 +2250,7 @@ void OSQLParseNode::showParseTree( ::rtl::OUStringBuffer& _inout_rBuffer, sal_uI if ( !isToken() ) { - // Regelnamen als rule: ... + // Rule name as rule _inout_rBuffer.appendAscii( "RULE_ID: " ); _inout_rBuffer.append( (sal_Int32)getRuleID() ); _inout_rBuffer.append( sal_Unicode( '(' ) ); @@ -2260,7 +2258,7 @@ void OSQLParseNode::showParseTree( ::rtl::OUStringBuffer& _inout_rBuffer, sal_uI _inout_rBuffer.append( sal_Unicode( ')' ) ); _inout_rBuffer.append( sal_Unicode( '\n' ) ); - // hol dir den ersten Subtree + // Get the first sub tree for ( OSQLParseNodes::const_iterator i = m_aChildren.begin(); i != m_aChildren.end(); ++i @@ -2269,7 +2267,7 @@ void OSQLParseNode::showParseTree( ::rtl::OUStringBuffer& _inout_rBuffer, sal_uI } else { - // ein Token gefunden + // Found a token switch (m_eNodeType) { @@ -2360,20 +2358,20 @@ void OSQLParseNode::showParseTree( ::rtl::OUStringBuffer& _inout_rBuffer, sal_uI } #endif // OSL_DEBUG_LEVEL > 0 // ----------------------------------------------------------------------------- -// Insert-Methoden +// Insert methods //----------------------------------------------------------------------------- void OSQLParseNode::insert(sal_uInt32 nPos, OSQLParseNode* pNewSubTree) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseNode::insert" ); - OSL_ENSURE(pNewSubTree != NULL, "OSQLParseNode: ungueltiger NewSubTree"); - OSL_ENSURE(pNewSubTree->getParent() == NULL, "OSQLParseNode: Knoten ist kein Waise"); + OSL_ENSURE(pNewSubTree != NULL, "OSQLParseNode: invalid NewSubTree"); + OSL_ENSURE(pNewSubTree->getParent() == NULL, "OSQLParseNode: Node is not an orphan"); - // stelle Verbindung zum getParent her: + // Create connection to getParent pNewSubTree->setParent( this ); m_aChildren.insert(m_aChildren.begin() + nPos, pNewSubTree); } -// removeAt-Methoden +// removeAt methods //----------------------------------------------------------------------------- OSQLParseNode* OSQLParseNode::removeAt(sal_uInt32 nPos) { @@ -2382,7 +2380,7 @@ OSQLParseNode* OSQLParseNode::removeAt(sal_uInt32 nPos) OSQLParseNodes::iterator aPos(m_aChildren.begin() + nPos); OSQLParseNode* pNode = *aPos; - // setze den getParent des removeten auf NULL + // Set the getParent of the removed node to NULL pNode->setParent( NULL ); m_aChildren.erase(aPos); @@ -2392,11 +2390,11 @@ OSQLParseNode* OSQLParseNode::removeAt(sal_uInt32 nPos) OSQLParseNode* OSQLParseNode::remove(OSQLParseNode* pSubTree) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseNode::remove" ); - OSL_ENSURE(pSubTree != NULL, "OSQLParseNode: ungueltiger SubTree"); + OSL_ENSURE(pSubTree != NULL, "OSQLParseNode: invalid SubTree"); OSQLParseNodes::iterator aPos = ::std::find(m_aChildren.begin(), m_aChildren.end(), pSubTree); if (aPos != m_aChildren.end()) { - // setze den getParent des removeten auf NULL + // Set the getParent of the removed node to NULL pSubTree->setParent( NULL ); m_aChildren.erase(aPos); return pSubTree; @@ -2405,7 +2403,7 @@ OSQLParseNode* OSQLParseNode::remove(OSQLParseNode* pSubTree) return NULL; } -// Replace-Methoden +// Replace methods //----------------------------------------------------------------------------- OSQLParseNode* OSQLParseNode::replaceAt(sal_uInt32 nPos, OSQLParseNode* pNewSubNode) { @@ -2418,7 +2416,7 @@ OSQLParseNode* OSQLParseNode::replaceAt(sal_uInt32 nPos, OSQLParseNode* pNewSubN OSQLParseNode* pOldSubNode = m_aChildren[nPos]; - // stelle Verbindung zum getParent her: + // Create connection to getParent pNewSubNode->setParent( this ); pOldSubNode->setParent( NULL ); @@ -2446,8 +2444,8 @@ OSQLParseNode* OSQLParseNode::replace (OSQLParseNode* pOldSubNode, OSQLParseNode void OSQLParseNode::parseLeaf(::rtl::OUStringBuffer& rString, const SQLParseNodeParameter& rParam) const { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "parse", "Ocke.Janssen@sun.com", "OSQLParseNode::parseLeaf" ); - // ein Blatt ist gefunden - // Inhalt dem Ausgabestring anfuegen + // Found a leaf + // Append content to the output string switch (m_eNodeType) { case SQL_NODE_KEYWORD: |