Tag: cws_src680_qiq User: fs Date: 2006/07/04 00:11:21 Modified: dba/connectivity/inc/connectivity/sqlnode.hxx
Log: #i51143# 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.104.5&r2=1.17.104.6 Delta lines: +53 -23 --------------------- --- sqlnode.hxx 27 Jun 2006 13:50:14 -0000 1.17.104.5 +++ sqlnode.hxx 4 Jul 2006 07:11:18 -0000 1.17.104.6 @@ -4,9 +4,9 @@ * * $RCSfile: sqlnode.hxx,v $ * - * $Revision: 1.17.104.5 $ + * $Revision: 1.17.104.6 $ * - * last change: $Author: fs $ $Date: 2006/06/27 13:50:14 $ + * last change: $Author: fs $ $Date: 2006/07/04 07:11:18 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -49,6 +49,8 @@ #endif #include <vector> #include <functional> +#include <set> +#include <boost/shared_ptr.hpp> // forward declarations namespace com @@ -91,6 +93,7 @@ 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}; + typedef ::std::set< ::rtl::OUString > QueryNameSet; //================================================================== //= SQLParseNodeParameter //================================================================== @@ -100,21 +103,33 @@ const ::rtl::OUString aIdentifierQuote; const ::rtl::OUString aCatalogSeparator; OSQLParser* pParser; + ::boost::shared_ptr< QueryNameSet > pSubQueryHistory; ::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 ; + 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)? + bool bCaseSensistiveIdentCompare : 1; /// should identifiers be compared case-sensitively? - SQLParseNodeParameter( const ::rtl::OUString& _rIdentifierQuote, const ::rtl::OUString& _rCatalogSep, + 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 ); + const ::com::sun::star::lang::Locale& _rLocale, + const IParseContext* _pContext, + bool _bIntl, + bool _bQuote, + sal_Char _cDecSep, + bool _bPredicate, + bool _bParseToSDBC, + bool _bCaseSensistiveIdentCompare + ); + ~SQLParseNodeParameter(); }; //========================================================================== @@ -292,10 +307,28 @@ the SQLParser used to create the node. This is needed in case we need to parse sub queries which are present in the SQL statement - those sub queries need to be parsed, too, to check whether they contain nested sub queries. + + @param _pErrorHolder + takes the error which occured while generating the statement, if any. Might be <NULL/>, + in this case the error is not reported back, and can only be recognized by examing the + return value. + + @return + <TRUE/> if and only if the parsing was successful.<br/> + + Currently, there's only one condition how this method can fail: If it contains a nested + query which causes a cycle. E.g., consider a statement <code>SELECT * from "foo"</code>, + where <code>bar </code> is a query defined as <code>SELECT * FROM "bar"</code>, where + <code>bar</code> is defined as <code>SELECT * FROM "foo"</code>. This statement obviously + cannot be parsed to an executable statement. + + If this method returns <FALSE/>, you're encouraged to check and handle the error in + <arg>_pErrorHolder</arg>. */ - void parseNodeToExecutableStatement( ::rtl::OUString& _out_rString, + bool parseNodeToExecutableStatement( ::rtl::OUString& _out_rString, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection, - OSQLParser& _rParser ) const; + OSQLParser& _rParser, + ::com::sun::star::sdbc::SQLException* _pErrorHolder ) const; void parseNodeToStr(::rtl::OUString& rString, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData > & xMeta, @@ -403,20 +436,17 @@ bool _bPredicate, bool _bSubstitute) const; - virtual void parseNodeToStr(::rtl::OUString& rString, - const SQLParseNodeParameter& rParam) const; private: - void likeNodeToStr(::rtl::OUString& rString, - const SQLParseNodeParameter& rParam) const; - void tableRangeNodeToStr(::rtl::OUString& rString, - const SQLParseNodeParameter& rParam) const; + void impl_parseNodeToString_throw( ::rtl::OUString& rString, const SQLParseNodeParameter& rParam) const; + void impl_parseLikeNodeToString_throw( ::rtl::OUString& rString, const SQLParseNodeParameter& rParam ) const; + void impl_parseTableRangeNodeToString_throw( ::rtl::OUString& rString, const SQLParseNodeParameter& rParam ) const; /** parses a table_name node into a SQL statement particle. @return <TRUE/> if and only if parsing was successful, <FALSE/> if default handling should be applied. */ - bool tableNameNodeToStr( ::rtl::OUString& rString, const SQLParseNodeParameter& rParam ) const; + bool impl_parseTableNameNodeToString_throw( ::rtl::OUString& rString, const SQLParseNodeParameter& rParam ) const; sal_Bool addDateValue(::rtl::OUString& rString, const SQLParseNodeParameter& rParam) const; ::rtl::OUString convertDateTimeString(const SQLParseNodeParameter& rParam, const ::rtl::OUString& rString) const; --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
