Tag: cws_src680_qiq User: fs Date: 06/05/10 03:18:39 Modified: /dba/connectivity/inc/connectivity/ sqlnode.hxx
Log: #i51143# +parseNodeToExecutableStatement / +getKnownRuleID / some code cleanup File Changes: Directory: /dba/connectivity/inc/connectivity/ ============================================== File [changed]: sqlnode.hxx Url: http://dba.openoffice.org/source/browse/dba/connectivity/inc/connectivity/sqlnode.hxx?r1=1.17&r2=1.17.104.1 Delta lines: +93 -66 --------------------- --- sqlnode.hxx 8 Sep 2005 05:02:22 -0000 1.17 +++ sqlnode.hxx 10 May 2006 10:18:36 -0000 1.17.104.1 @@ -4,9 +4,9 @@ * * $RCSfile: sqlnode.hxx,v $ * - * $Revision: 1.17 $ + * $Revision: 1.17.104.1 $ * - * last change: $Author: rt $ $Date: 2005/09/08 05:02:22 $ + * last change: $Author: fs $ $Date: 2006/05/10 10:18:36 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -69,6 +69,10 @@ { class XNumberFormatter; } + namespace container + { + class XNameAccess; + } } } } @@ -87,6 +91,31 @@ SQL_NODE_EQUAL,SQL_NODE_LESS,SQL_NODE_GREAT,SQL_NODE_LESSEQ,SQL_NODE_GREATEQ,SQL_NODE_NOTEQUAL, SQL_NODE_PUNCTUATION, SQL_NODE_AMMSC, SQL_NODE_ACCESS_DATE,SQL_NODE_DATE}; + //================================================================== + //= SQLParseNodeParameter + //================================================================== + struct SQLParseNodeParameter + { + const ::com::sun::star::lang::Locale& rLocale; + const ::rtl::OUString aIdentifierQuote; + const ::rtl::OUString aCatalogSeparator; + ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter > xFormatter; + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xField; + ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > xQueries; // see bParseToSDBCLevel + const IParseContext& m_rContext; + sal_Char cDecSep ; + bool bQuote : 1; /// should we quote identifiers? + bool bInternational : 1; /// should we internationalize keywords and placeholders? + bool bPredicate : 1; /// are we going to parse a mere predicate? + bool bParseToSDBCLevel : 1; /// should we create an SDBC-level statement (e.g. with substituted sub queries)? + + SQLParseNodeParameter( const ::rtl::OUString& _rIdentifierQuote, const ::rtl::OUString& _rCatalogSep, + const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& _xFormatter, + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _xField, + const ::com::sun::star::lang::Locale& _rLocale, const IParseContext* _pContext, + bool _bIntl, bool _bQuote, sal_Char _cDecSep, bool _bPredicate, bool _bParseToSDBC ); + }; + //========================================================================== //= OSQLParseNode //========================================================================== @@ -102,32 +131,6 @@ 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! - protected: - struct SQLParseNodeParameter - { - const ::com::sun::star::lang::Locale& rLocale; - const ::rtl::OUString aIdentifierQuote; - const ::rtl::OUString aCatalogSeparator; - ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter > xFormatter; - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xField; - const IParseContext* m_pContext; - sal_Char cDecSep ; - sal_Bool bQuote : 1; - sal_Bool bInternational : 1; - sal_Bool bPredicate : 1; - - SQLParseNodeParameter(const ::rtl::OUString& _rIdentifierQuote, - const ::rtl::OUString& _rCatalogSep, - const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter > & _xFormatter, - const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & _xField, - const ::com::sun::star::lang::Locale& _rIntl, - const IParseContext* _pContext, - sal_Bool _bIntl = sal_False, - sal_Bool _bQuote= sal_True, - sal_Char _cDecSep = '.', - sal_Bool _bPredicate = sal_False); - }; - public: enum Rule { @@ -216,7 +219,8 @@ base_table_element_commalist, data_type, column_def, - rule_count // letzter_wert + rule_count, // letzter_wert + UNKNOWN_RULE // ID indicating that a node is no rule with a matching Rule-enum value (see getKnownRuleID) }; // must be ascii encoding for the value @@ -266,6 +270,22 @@ void replaceNodeValue(const ::rtl::OUString& rTableAlias,const ::rtl::OUString& rColumnName); + /** parses the node to a string which can be passed to a driver's connection for execution + + Any particles of the parse tree which represent application-level features - such + as queries appearing in the FROM part - are subsituted, so that the resulting statement can + be executed at an SDBC-level connection. + + @param _out_rString + is an output parameter taking the resulting SQL statement + @param _rxConnection + the connection relative to which to parse. This must be an SDB-level connection (e.g. + support the XQueriesSupplier interface) for the method to be able to do all necessary + substitutions. + */ + void parseNodeToExecutableStatement( ::rtl::OUString& _out_rString, + const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection ) const; + void parseNodeToStr(::rtl::OUString& rString, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData > & xMeta, const IParseContext* pContext = NULL, @@ -299,6 +319,12 @@ // RuleId liefert die RuleId der Regel des Knotens (nur bei 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()) sal_uInt32 getTokenID() const {return m_nNodeID;} @@ -358,10 +384,11 @@ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & _xField, const ::com::sun::star::lang::Locale& rIntl, const IParseContext* pContext, - sal_Bool _bIntl, - sal_Bool _bQuote, + bool _bIntl, + bool _bQuote, sal_Char _cDecSep, - sal_Bool bPredicate) const; + bool _bPredicate, + bool _bSubstitute) const; virtual void parseNodeToStr(::rtl::OUString& rString, const SQLParseNodeParameter& rParam) const; --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
