diff options
Diffstat (limited to 'connectivity/inc/connectivity')
-rw-r--r-- | connectivity/inc/connectivity/CommonTools.hxx | 4 | ||||
-rw-r--r-- | connectivity/inc/connectivity/dbtools.hxx | 2 | ||||
-rw-r--r-- | connectivity/inc/connectivity/sqliterator.hxx | 30 | ||||
-rw-r--r-- | connectivity/inc/connectivity/sqlnode.hxx | 47 | ||||
-rw-r--r-- | connectivity/inc/connectivity/sqlparse.hxx | 15 |
5 files changed, 47 insertions, 51 deletions
diff --git a/connectivity/inc/connectivity/CommonTools.hxx b/connectivity/inc/connectivity/CommonTools.hxx index dd8e480f730d..e483ab949f4a 100644 --- a/connectivity/inc/connectivity/CommonTools.hxx +++ b/connectivity/inc/connectivity/CommonTools.hxx @@ -54,6 +54,10 @@ namespace connectivity { //------------------------------------------------------------------------------ OOO_DLLPUBLIC_DBTOOLS sal_Bool match(const sal_Unicode* pWild, const sal_Unicode* pStr, const sal_Unicode cEscape); + inline sal_Bool match(const ::rtl::OUString &rWild, const ::rtl::OUString &rStr, const sal_Unicode cEscape) + { + return match(rWild.getStr(), rStr.getStr(), cEscape); + } //------------------------------------------------------------------------------ OOO_DLLPUBLIC_DBTOOLS rtl::OUString toString(const ::com::sun::star::uno::Any& rValue); OOO_DLLPUBLIC_DBTOOLS rtl::OUString toDateString(const ::com::sun::star::util::Date& rDate); diff --git a/connectivity/inc/connectivity/dbtools.hxx b/connectivity/inc/connectivity/dbtools.hxx index 3319fbd40ed3..3555025d370f 100644 --- a/connectivity/inc/connectivity/dbtools.hxx +++ b/connectivity/inc/connectivity/dbtools.hxx @@ -613,7 +613,7 @@ namespace dbtools const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XParameters>& _xParameters, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& _xConnection, const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& _rxHandler, - const ::std::bit_vector& _aParametersSet = ::std::bit_vector()); + const ::std::vector<bool, std::allocator<bool> >& _aParametersSet = ::std::vector<bool, std::allocator<bool> >()); /** call the appropiate set method for the specific sql type @see com::sun::star::sdbc::DataType @param _xParams the parameters where to set the value diff --git a/connectivity/inc/connectivity/sqliterator.hxx b/connectivity/inc/connectivity/sqliterator.hxx index 37919a8e7dc7..71299b857cda 100644 --- a/connectivity/inc/connectivity/sqliterator.hxx +++ b/connectivity/inc/connectivity/sqliterator.hxx @@ -67,10 +67,10 @@ namespace connectivity { private: ::com::sun::star::sdbc::SQLException m_aErrors; // conatins the error while iterating through the statement - const OSQLParseNode* m_pParseTree; // aktueller ParseTree + const OSQLParseNode* m_pParseTree; // current ParseTree const OSQLParser& m_rParser; // if set used for general error messages from the context - OSQLStatementType m_eStatementType; // Art des Statements - ::rtl::Reference<OSQLColumns> m_aSelectColumns; // alle Spalten aus dem Select-Clause + OSQLStatementType m_eStatementType; + ::rtl::Reference<OSQLColumns> m_aSelectColumns; // all columns from the Select clause ::rtl::Reference<OSQLColumns> m_aParameters; // all parameters ::rtl::Reference<OSQLColumns> m_aGroupColumns; // the group by columns ::rtl::Reference<OSQLColumns> m_aOrderColumns; // the order by columns @@ -79,7 +79,7 @@ namespace connectivity ::std::auto_ptr< OSQLParseTreeIteratorImpl > m_pImpl; void traverseParameter(const OSQLParseNode* _pParseNode,const OSQLParseNode* _pColumnRef,const ::rtl::OUString& _aColumnName,const ::rtl::OUString& _aTableRange, const ::rtl::OUString& _rColumnAlias); - // F"ugt eine Tabelle in die Map ein + // inserts a table into the map void traverseOneTableName( OSQLTables& _rTables,const OSQLParseNode * pTableName, const ::rtl::OUString & rTableRange ); void traverseORCriteria(OSQLParseNode * pSearchCondition); void traverseANDCriteria(OSQLParseNode * pSearchCondition); @@ -124,11 +124,10 @@ namespace connectivity protected: void setSelectColumnName(::rtl::Reference<OSQLColumns>& _rColumns,const ::rtl::OUString & rColumnName,const ::rtl::OUString & rColumnAlias, const ::rtl::OUString & rTableRange,sal_Bool bFkt=sal_False,sal_Int32 _nType = com::sun::star::sdbc::DataType::VARCHAR,sal_Bool bAggFkt=sal_False); void appendColumns(::rtl::Reference<OSQLColumns>& _rColumns,const ::rtl::OUString& _rTableAlias,const OSQLTable& _rTable); - // Weitere Member-Variable, die in den "set"-Funktionen zur - // Verfuegung stehen sollen, koennen in der abgeleiteten Klasse - // definiert werden und z. B. in deren Konstruktor initialisiert - // bzw. nach Benutzung der "traverse"-Routinen mit Hilfe weiterer - // Funktionen abgefragt werden. + // Other member variables that should be available in the "set" functions + // can be defined in the derived class. They can be initialized + // in its constructor and, after the "traverse" routines have been used, + // they can be queried using other functions. private: @@ -154,13 +153,13 @@ namespace connectivity void dispose(); bool isCaseSensitive() const; - // Der zu analysierende/zu traversierende Parse Tree: - // bei "Ubergabe von NULL wird der aktuelle Parsetree gel"oscht und der Fehlerstatus gecleared + // The parse tree to be analysed/traversed: + // If NULL is passed, the current parse tree will be deleted and the error status cleared. void setParseTree(const OSQLParseNode * pNewParseTree); // void setParser(const OSQLParser* _pParser) { m_pParser = _pParser; } const OSQLParseNode * getParseTree() const { return m_pParseTree; }; - // Teilbaueme bei einem select statement + // subtrees in case of a select statement const OSQLParseNode* getWhereTree() const; const OSQLParseNode* getOrderTree() const; const OSQLParseNode* getGroupByTree() const; @@ -178,7 +177,7 @@ namespace connectivity inline const ::com::sun::star::sdbc::SQLException& getErrors() const { return m_aErrors; } inline bool hasErrors() const { return m_aErrors.Message.getLength() > 0; } - // Statement-Typ (wird bereits in setParseTree gesetzt): + // statement type (already set in setParseTree): OSQLStatementType getStatementType() const { return m_eStatementType; } /** traverses the complete statement tree, and fills all our data with @@ -212,7 +211,7 @@ namespace connectivity */ void traverseSome( sal_uInt32 _nIncludeMask ); - // Die TableRangeMap enth"alt alle Tabellen unter dem zugeh"origen Rangenamen der zuerst gefunden wird + // The TableRangeMap contains all tables associated with the range name found first. const OSQLTables& getTables() const; ::rtl::Reference<OSQLColumns> getSelectColumns() const { return m_aSelectColumns;} @@ -274,8 +273,7 @@ namespace connectivity ::rtl::OUString &_rColumnName, ::rtl::OUString& _rTableRange); - // Ermittelt fuer eine Funktion, Spalten den zugehoeren TableRange, - // wenn nicht eindeutig, dann leer + // empty if ambiguous sal_Bool getColumnTableRange(const OSQLParseNode* pNode, ::rtl::OUString &rTableRange) const; // return true when the tableNode is a rule like catalog_name, schema_name or table_name diff --git a/connectivity/inc/connectivity/sqlnode.hxx b/connectivity/inc/connectivity/sqlnode.hxx index a05384b3ae4c..f7182c34df75 100644 --- a/connectivity/inc/connectivity/sqlnode.hxx +++ b/connectivity/inc/connectivity/sqlnode.hxx @@ -124,13 +124,16 @@ namespace connectivity friend class OSQLParser; OSQLParseNodes m_aChildren; - OSQLParseNode* m_pParent; // pParent fuer Reuckverkettung im Baum - ::rtl::OUString m_aNodeValue; // Token-Name oder leer bei Regeln oder ::rtl::OUString bei - // ::rtl::OUString, INT, usw. -Werten - SQLNodeType m_eNodeType; // s. o. - sal_uInt32 m_nNodeID; // ::com::sun::star::chaos::Rule ID (bei IsRule()) oder Token ID (bei !IsRule()) - // ::com::sun::star::chaos::Rule IDs und Token IDs koennen nicht anhand des Wertes - // unterschieden werden, dafuer ist IsRule() abzufragen! + OSQLParseNode* m_pParent; // pParent for reverse linkage in the tree + ::rtl::OUString m_aNodeValue; // token name, or empty in case of rules, + // or ::rtl::OUString in case of + // ::rtl::OUString, INT, etc. + SQLNodeType m_eNodeType; // see above + sal_uInt32 m_nNodeID; // ::com::sun::star::chaos::Rule ID (if IsRule()) + // or Token ID (if !IsRule()) + // ::com::sun::star::chaos::Rule IDs and Token IDs can't + // be distinguished by their values, + // IsRule has to be used for that! public: enum Rule { @@ -233,7 +236,7 @@ namespace connectivity other_like_predicate_part_2, between_predicate_part_2, cast_spec, - rule_count, // letzter_wert + rule_count, // last value UNKNOWN_RULE // ID indicating that a node is no rule with a matching Rule-enum value (see getKnownRuleID) }; @@ -254,22 +257,19 @@ namespace connectivity SQLNodeType _eNodeType, sal_uInt32 _nNodeID = 0); - // Kopiert den entsprechenden ParseNode + // copies the respective ParseNode OSQLParseNode(const OSQLParseNode& rParseNode); OSQLParseNode& operator=(const OSQLParseNode& rParseNode); sal_Bool operator==(OSQLParseNode& rParseNode) const; - // Destruktor raeumt rekursiv den Baum ab + // destructor destructs the tree recursively virtual ~OSQLParseNode(); - // Parent gibt den Zeiger auf den Parent zurueck OSQLParseNode* getParent() const {return m_pParent;}; - // SetParent setzt den Parent-Zeiger eines ParseNodes void setParent(OSQLParseNode* pParseNode) {m_pParent = pParseNode;}; - // ChildCount liefert die Anzahl der Kinder eines Knotens sal_uInt32 count() const {return m_aChildren.size();}; inline OSQLParseNode* getChild(sal_uInt32 nPos) const; @@ -350,42 +350,37 @@ namespace connectivity OSQLParseNode* getByRule(OSQLParseNode::Rule eRule) const; #if OSL_DEBUG_LEVEL > 0 - // zeigt den ParseTree mit tabs und linefeeds + // shows the ParseTree with tabs and linefeeds void showParseTree( ::rtl::OUString& rString ) const; void showParseTree( ::rtl::OUStringBuffer& _inout_rBuf, sal_uInt32 nLevel ) const; #endif - // GetNodeType gibt den Knotentyp zurueck SQLNodeType getNodeType() const {return m_eNodeType;}; - // RuleId liefert die RuleId der Regel des Knotens (nur bei IsRule()) + // RuleId returns the RuleID of the node's rule (only if IsRule()) sal_uInt32 getRuleID() const {return m_nNodeID;} /** returns the ID of the rule represented by the node - If the node does not represent a rule, UNKNOWN_RULE is returned */ Rule getKnownRuleID() const; - // RuleId liefert die TokenId des Tokens des Knotens (nur bei ! IsRule()) + // returns the TokenId of the node's token (only if !isRule()) sal_uInt32 getTokenID() const {return m_nNodeID;} - // IsRule testet ob ein Node eine Regel (NonTerminal) ist - // Achtung : Regeln koenne auch Blaetter sein, z.B. leere Listen + // IsRule tests whether a node is a rule (NonTerminal) + // ATTENTION: rules can be leaves, for example empty lists sal_Bool isRule() const { return (m_eNodeType == SQL_NODE_RULE) || (m_eNodeType == SQL_NODE_LISTRULE) || (m_eNodeType == SQL_NODE_COMMALISTRULE);} - // IsToken testet ob ein Node ein Token (Terminal) ist - sal_Bool isToken() const {return !isRule();} // ein Token ist keine Regel + // IsToken tests whether a Node is a Token (Terminal but not a rule) + sal_Bool isToken() const {return !isRule();} - // TokenValue liefert den NodeValue eines Tokens const ::rtl::OUString& getTokenValue() const {return m_aNodeValue;} - // SetTokenValue setzt den NodeValue void setTokenValue(const ::rtl::OUString& rString) { if (isToken()) m_aNodeValue = rString;} - // IsLeaf testet ob ein Node ein Blatt ist sal_Bool isLeaf() const {return m_aChildren.empty();} // negate only a searchcondition, any other rule could cause a gpf @@ -424,7 +419,7 @@ namespace connectivity static ::rtl::OUString getTableRange(const OSQLParseNode* _pTableRef); protected: - // ParseNodeToStr konkateniert alle Token (Blaetter) des ParseNodes + // ParseNodeToStr konkateniert alle Token (leaves) des ParseNodes void parseNodeToStr(::rtl::OUString& rString, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter > & xFormatter, diff --git a/connectivity/inc/connectivity/sqlparse.hxx b/connectivity/inc/connectivity/sqlparse.hxx index 7c634595e44c..e7420d6c48c3 100644 --- a/connectivity/inc/connectivity/sqlparse.hxx +++ b/connectivity/inc/connectivity/sqlparse.hxx @@ -208,24 +208,23 @@ namespace connectivity /// access to the SQLError instance owned by this parser const SQLError& getErrorHelper() const; - // TokenIDToStr: Token-Name zu einer Token-Nr. + // TokenIDToStr: token name belonging to a token number. static ::rtl::OString TokenIDToStr(sal_uInt32 nTokenID, const IParseContext* pContext = NULL); - // StrToTokenID: Token-Nr. zu einem Token-Namen. + // StrToTokenID: token number belonging to a token name. // static sal_uInt32 StrToTokenID(const ::rtl::OString & rName); - // RuleIDToStr gibt den zu einer RuleID gehoerenden ::rtl::OUString zurueck - // (Leerstring, falls nicht gefunden) + // (empty string if not found) static ::rtl::OUString RuleIDToStr(sal_uInt32 nRuleID); - // StrToRuleID berechnet zu einem ::rtl::OUString die RuleID (d.h. ::com::sun::star::sdbcx::Index in yytname) - // (0, falls nicht gefunden). Die Suche nach der ID aufgrund eines Strings ist - // extrem ineffizient (sequentielle Suche nach ::rtl::OUString)! + // StrToRuleID calculates the RuleID for a ::rtl::OUString (that is, ::com::sun::star::sdbcx::Index in yytname) + // (0 if not found). The search for an ID based on a String is + // extremely inefficient (sequential search for ::rtl::OUString)! static sal_uInt32 StrToRuleID(const ::rtl::OString & rValue); static OSQLParseNode::Rule RuleIDToRule( sal_uInt32 _nRule ); - // RuleId mit enum, wesentlich effizienter + // RuleId with enum, far more efficient static sal_uInt32 RuleID(OSQLParseNode::Rule eRule); // compares the _sFunctionName with all known function names and return the DataType of the return value static sal_Int32 getFunctionReturnType(const ::rtl::OUString& _sFunctionName, const IParseContext* pContext = NULL); |