xref: /trunk/main/connectivity/inc/connectivity/sqliterator.hxx (revision 914d351e5f5b84e4342a86d6ab8d4aca7308b9bd)
1caf5cd79SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3caf5cd79SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4caf5cd79SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5caf5cd79SAndrew Rist  * distributed with this work for additional information
6caf5cd79SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7caf5cd79SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8caf5cd79SAndrew Rist  * "License"); you may not use this file except in compliance
9caf5cd79SAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11caf5cd79SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13caf5cd79SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14caf5cd79SAndrew Rist  * software distributed under the License is distributed on an
15caf5cd79SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16caf5cd79SAndrew Rist  * KIND, either express or implied.  See the License for the
17caf5cd79SAndrew Rist  * specific language governing permissions and limitations
18caf5cd79SAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20caf5cd79SAndrew Rist  *************************************************************/
21caf5cd79SAndrew Rist 
22caf5cd79SAndrew Rist 
23cdf0e10cSrcweir #ifndef _CONNECTIVITY_PARSE_SQLITERATOR_HXX_
24cdf0e10cSrcweir #define _CONNECTIVITY_PARSE_SQLITERATOR_HXX_
25cdf0e10cSrcweir 
26cdf0e10cSrcweir #include "connectivity/dbtoolsdllapi.hxx"
27cdf0e10cSrcweir #include "connectivity/sqlnode.hxx"
28cdf0e10cSrcweir #include <connectivity/IParseContext.hxx>
29cdf0e10cSrcweir #include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
30cdf0e10cSrcweir #include <com/sun/star/sdbc/DataType.hpp>
31cdf0e10cSrcweir #include <com/sun/star/sdbc/SQLWarning.hpp>
32cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp>
33cdf0e10cSrcweir #include "connectivity/CommonTools.hxx"
34cdf0e10cSrcweir #include <vos/ref.hxx>
35cdf0e10cSrcweir #include <cppuhelper/weak.hxx>
36cdf0e10cSrcweir 
37cdf0e10cSrcweir #include <map>
38cdf0e10cSrcweir #include <memory>
39cdf0e10cSrcweir #include <vector>
40cdf0e10cSrcweir 
41cdf0e10cSrcweir namespace connectivity
42cdf0e10cSrcweir {
43cdf0e10cSrcweir 
44cdf0e10cSrcweir     class OSQLParseNode;
45cdf0e10cSrcweir     class OSQLParser;
46cdf0e10cSrcweir 
47cdf0e10cSrcweir     typedef ::std::pair<const OSQLParseNode*,const OSQLParseNode* > TNodePair;
48cdf0e10cSrcweir 
49cdf0e10cSrcweir     enum OSQLStatementType {
50cdf0e10cSrcweir         SQL_STATEMENT_UNKNOWN,
51cdf0e10cSrcweir         SQL_STATEMENT_SELECT,
52cdf0e10cSrcweir         SQL_STATEMENT_INSERT,
53cdf0e10cSrcweir         SQL_STATEMENT_UPDATE,
54cdf0e10cSrcweir         SQL_STATEMENT_DELETE,
55cdf0e10cSrcweir         SQL_STATEMENT_ODBC_CALL,
56cdf0e10cSrcweir         SQL_STATEMENT_CREATE_TABLE
57cdf0e10cSrcweir     };
58cdf0e10cSrcweir 
59cdf0e10cSrcweir     struct OSQLParseTreeIteratorImpl;
60cdf0e10cSrcweir 
61cdf0e10cSrcweir     class OOO_DLLPUBLIC_DBTOOLS OSQLParseTreeIterator
62cdf0e10cSrcweir     {
63cdf0e10cSrcweir     private:
64*7de601c3SJohn Bampton         ::com::sun::star::sdbc::SQLException            m_aErrors;          // contains the error while iterating through the statement
65cdf0e10cSrcweir         const OSQLParseNode*                            m_pParseTree;       // aktueller ParseTree
66cdf0e10cSrcweir         const OSQLParser&                               m_rParser;          // if set used for general error messages from the context
67cdf0e10cSrcweir         OSQLStatementType                               m_eStatementType;   // Art des Statements
68cdf0e10cSrcweir         ::vos::ORef<OSQLColumns>                        m_aSelectColumns;   // alle Spalten aus dem Select-Clause
69cdf0e10cSrcweir         ::vos::ORef<OSQLColumns>                        m_aParameters;      // all parameters
70cdf0e10cSrcweir         ::vos::ORef<OSQLColumns>                        m_aGroupColumns;    // the group by columns
71cdf0e10cSrcweir         ::vos::ORef<OSQLColumns>                        m_aOrderColumns;    // the order by columns
72cdf0e10cSrcweir         ::vos::ORef<OSQLColumns>                        m_aCreateColumns;   // the columns for Create table clause
73cdf0e10cSrcweir 
74cdf0e10cSrcweir         ::std::auto_ptr< OSQLParseTreeIteratorImpl >    m_pImpl;
75cdf0e10cSrcweir 
76cdf0e10cSrcweir         void                traverseParameter(const OSQLParseNode* _pParseNode,const OSQLParseNode* _pColumnRef,const ::rtl::OUString& _aColumnName,const ::rtl::OUString& _aTableRange, const ::rtl::OUString& _rColumnAlias);
77cdf0e10cSrcweir         // F"ugt eine Tabelle in die Map ein
78cdf0e10cSrcweir         void                traverseOneTableName( OSQLTables& _rTables,const OSQLParseNode * pTableName, const ::rtl::OUString & rTableRange );
79cdf0e10cSrcweir         void                traverseORCriteria(OSQLParseNode * pSearchCondition);
80cdf0e10cSrcweir         void                traverseANDCriteria(OSQLParseNode * pSearchCondition);
81cdf0e10cSrcweir         void                traverseOnePredicate(
82cdf0e10cSrcweir                                                 OSQLParseNode * pColumnRef,
83cdf0e10cSrcweir                                                 ::rtl::OUString& aValue,
84cdf0e10cSrcweir                                                 OSQLParseNode * pParameter);
85cdf0e10cSrcweir         void traverseByColumnNames(const OSQLParseNode* pSelectNode,sal_Bool _bOrder);
86cdf0e10cSrcweir         void                traverseParameters(const OSQLParseNode* pSelectNode);
87cdf0e10cSrcweir 
88cdf0e10cSrcweir         const OSQLParseNode*    getTableNode( OSQLTables& _rTables, const OSQLParseNode* pTableRef, ::rtl::OUString& aTableRange );
89cdf0e10cSrcweir         void                    getQualified_join( OSQLTables& _rTables, const OSQLParseNode *pTableRef, ::rtl::OUString& aTableRange );
90cdf0e10cSrcweir         void                    getSelect_statement(OSQLTables& _rTables,const OSQLParseNode* pSelect);
91cdf0e10cSrcweir         ::rtl::OUString         getUniqueColumnName(const ::rtl::OUString & rColumnName)    const;
92cdf0e10cSrcweir 
93cdf0e10cSrcweir         /** finds the column with a given name, belonging to a given table, in a given tables collection
94cdf0e10cSrcweir             @param  _rTables
95cdf0e10cSrcweir                 the tables collection to look in
96cdf0e10cSrcweir             @param  rColumnName
97cdf0e10cSrcweir                 the column name to look for
98cdf0e10cSrcweir             @param  rTableRange
99cdf0e10cSrcweir                 the table alias name
100cdf0e10cSrcweir             @return
101cdf0e10cSrcweir                 the desired column object, or <NULL/> if no such column could be found
102cdf0e10cSrcweir         */
103cdf0e10cSrcweir         static ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > findColumn(
104cdf0e10cSrcweir             const OSQLTables& _rTables, const ::rtl::OUString & rColumnName, const ::rtl::OUString & rTableRange );
105cdf0e10cSrcweir 
106cdf0e10cSrcweir         /** finds a column with a given name, belonging to a given table
107cdf0e10cSrcweir             @param  rColumnName
108cdf0e10cSrcweir                 the column name to look for
109cdf0e10cSrcweir             @param  rTableRange
110cdf0e10cSrcweir                     the table alias name
111cdf0e10cSrcweir             @param  _bLookInSubTables
112cdf0e10cSrcweir                 <TRUE/> if and only if not only our direct tables, but also our sub tables (from sub selects)
113cdf0e10cSrcweir                 should be searched
114cdf0e10cSrcweir             @return
115cdf0e10cSrcweir         */
116cdf0e10cSrcweir         ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > findColumn(
117cdf0e10cSrcweir             const ::rtl::OUString & rColumnName, const ::rtl::OUString & rTableRange, bool _bLookInSubTables );
118cdf0e10cSrcweir 
119cdf0e10cSrcweir       protected:
120cdf0e10cSrcweir         void setSelectColumnName(::vos::ORef<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);
121cdf0e10cSrcweir         void appendColumns(::vos::ORef<OSQLColumns>& _rColumns,const ::rtl::OUString& _rTableAlias,const OSQLTable& _rTable);
122cdf0e10cSrcweir         // Weitere Member-Variable, die in den "set"-Funktionen zur
123cdf0e10cSrcweir         // Verfuegung stehen sollen, koennen in der abgeleiteten Klasse
124cdf0e10cSrcweir         // definiert werden und z. B. in deren Konstruktor initialisiert
125cdf0e10cSrcweir         // bzw. nach Benutzung der "traverse"-Routinen mit Hilfe weiterer
126cdf0e10cSrcweir         // Funktionen abgefragt werden.
127cdf0e10cSrcweir 
128cdf0e10cSrcweir 
129cdf0e10cSrcweir       private:
130cdf0e10cSrcweir         OSQLParseTreeIterator();                                        // never implemented
131cdf0e10cSrcweir         OSQLParseTreeIterator(const OSQLParseTreeIterator & rIter);     // never implemented
132cdf0e10cSrcweir 
133cdf0e10cSrcweir       public:
134cdf0e10cSrcweir         OSQLParseTreeIterator(
135cdf0e10cSrcweir             const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection,
136cdf0e10cSrcweir             const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& _rxTables,
137cdf0e10cSrcweir             const OSQLParser& _rParser,
138cdf0e10cSrcweir             const OSQLParseNode* pRoot = NULL );
139cdf0e10cSrcweir         ~OSQLParseTreeIterator();
140cdf0e10cSrcweir 
operator new(size_t nSize)141cdf0e10cSrcweir         inline static void * SAL_CALL operator new( size_t nSize ) SAL_THROW( () )
142cdf0e10cSrcweir             { return ::rtl_allocateMemory( nSize ); }
operator new(size_t,void * _pHint)143cdf0e10cSrcweir         inline static void * SAL_CALL operator new( size_t,void* _pHint ) SAL_THROW( () )
144cdf0e10cSrcweir             { return _pHint; }
operator delete(void * pMem)145cdf0e10cSrcweir         inline static void SAL_CALL operator delete( void * pMem ) SAL_THROW( () )
146cdf0e10cSrcweir             { ::rtl_freeMemory( pMem ); }
operator delete(void *,void *)147cdf0e10cSrcweir         inline static void SAL_CALL operator delete( void *,void* ) SAL_THROW( () )
148cdf0e10cSrcweir             {  }
149cdf0e10cSrcweir 
150cdf0e10cSrcweir         void dispose();
151cdf0e10cSrcweir         bool isCaseSensitive() const;
152cdf0e10cSrcweir         // Der zu analysierende/zu traversierende Parse Tree:
153cdf0e10cSrcweir         // bei "Ubergabe von NULL wird der aktuelle Parsetree gel"oscht und der Fehlerstatus gecleared
154cdf0e10cSrcweir         void setParseTree(const OSQLParseNode * pNewParseTree);
155cdf0e10cSrcweir //      void setParser(const OSQLParser* _pParser) { m_pParser = _pParser; }
getParseTree() const156cdf0e10cSrcweir         const OSQLParseNode * getParseTree() const { return m_pParseTree; };
157cdf0e10cSrcweir 
158cdf0e10cSrcweir         // Teilbaueme bei einem select statement
159cdf0e10cSrcweir         const OSQLParseNode* getWhereTree() const;
160cdf0e10cSrcweir         const OSQLParseNode* getOrderTree() const;
161cdf0e10cSrcweir         const OSQLParseNode* getGroupByTree() const;
162cdf0e10cSrcweir         const OSQLParseNode* getHavingTree() const;
163cdf0e10cSrcweir 
164cdf0e10cSrcweir         const OSQLParseNode* getSimpleWhereTree() const;
165cdf0e10cSrcweir         const OSQLParseNode* getSimpleOrderTree() const;
166cdf0e10cSrcweir         const OSQLParseNode* getSimpleGroupByTree() const;
167cdf0e10cSrcweir         const OSQLParseNode* getSimpleHavingTree() const;
168cdf0e10cSrcweir 
16907a3d7f1SPedro Giffuni         /** returns the errors which occurred during parsing.
170cdf0e10cSrcweir 
171cdf0e10cSrcweir             The returned object contains a chain (via SQLException::NextException) of SQLExceptions.
172cdf0e10cSrcweir         */
getErrors() const173cdf0e10cSrcweir         inline const ::com::sun::star::sdbc::SQLException&   getErrors() const { return m_aErrors; }
hasErrors() const174cdf0e10cSrcweir         inline bool hasErrors() const { return m_aErrors.Message.getLength() > 0; }
175cdf0e10cSrcweir 
176cdf0e10cSrcweir         // Statement-Typ (wird bereits in setParseTree gesetzt):
getStatementType() const177cdf0e10cSrcweir         OSQLStatementType getStatementType() const { return m_eStatementType; }
178cdf0e10cSrcweir 
179cdf0e10cSrcweir         /** traverses the complete statement tree, and fills all our data with
180cdf0e10cSrcweir             the information obatined during traversal.
181cdf0e10cSrcweir 
182cdf0e10cSrcweir             Implemented by calling the single traverse* methods in the proper
183cdf0e10cSrcweir             order (depending on the statement type).
184cdf0e10cSrcweir         */
185cdf0e10cSrcweir         void traverseAll();
186cdf0e10cSrcweir 
187cdf0e10cSrcweir         enum TraversalParts
188cdf0e10cSrcweir         {
189cdf0e10cSrcweir             Parameters      = 0x0001,
190cdf0e10cSrcweir             TableNames      = 0x0002,
191cdf0e10cSrcweir             SelectColumns   = 0x0006,   // note that this includes TableNames. No SelectColumns without TableNames
192cdf0e10cSrcweir 
193cdf0e10cSrcweir             // Those are not implemented currently
194cdf0e10cSrcweir             // GroupColumns    = 0x0008,
195cdf0e10cSrcweir             // OrderColumns    = 0x0010,
196cdf0e10cSrcweir             // SelectColumns   = 0x0020,
197cdf0e10cSrcweir             // CreateColumns   = 0x0040,
198cdf0e10cSrcweir 
199cdf0e10cSrcweir             All             = 0xFFFF
200cdf0e10cSrcweir         };
201cdf0e10cSrcweir         /** traverses selected parts of the statement tree, and fills our data with
202cdf0e10cSrcweir             the information obtained during traversal
203cdf0e10cSrcweir 
204cdf0e10cSrcweir             @param _nIncludeMask
205cdf0e10cSrcweir                 set of TraversalParts bits, specifying which information is to be collected.
206cdf0e10cSrcweir                 Note TraversalParts is currently not
207cdf0e10cSrcweir         */
208cdf0e10cSrcweir         void traverseSome( sal_uInt32 _nIncludeMask );
209cdf0e10cSrcweir 
210cdf0e10cSrcweir         // Die TableRangeMap enth"alt alle Tabellen unter dem zugeh"origen Rangenamen der zuerst gefunden wird
211cdf0e10cSrcweir         const OSQLTables& getTables() const;
212cdf0e10cSrcweir 
getSelectColumns() const213cdf0e10cSrcweir         ::vos::ORef<OSQLColumns> getSelectColumns() const { return m_aSelectColumns;}
getGroupColumns() const214cdf0e10cSrcweir         ::vos::ORef<OSQLColumns> getGroupColumns() const { return m_aGroupColumns;}
getOrderColumns() const215cdf0e10cSrcweir         ::vos::ORef<OSQLColumns> getOrderColumns() const { return m_aOrderColumns;}
getParameters() const216cdf0e10cSrcweir         ::vos::ORef<OSQLColumns> getParameters()    const { return m_aParameters; }
getCreateColumns() const217cdf0e10cSrcweir         ::vos::ORef<OSQLColumns> getCreateColumns() const { return m_aCreateColumns;}
218cdf0e10cSrcweir 
219cdf0e10cSrcweir         /** return the columname and the table range
220cdf0e10cSrcweir             @param  _pColumnRef
221cdf0e10cSrcweir                 The column ref parse node.
222cdf0e10cSrcweir             @param  _rColumnName
223cdf0e10cSrcweir                 The column name to be set.
224cdf0e10cSrcweir             @param  _rTableRange
225cdf0e10cSrcweir                 The table range to be set.
226cdf0e10cSrcweir         */
227cdf0e10cSrcweir         void getColumnRange(    const OSQLParseNode* _pColumnRef,
228cdf0e10cSrcweir                                 ::rtl::OUString &_rColumnName,
229cdf0e10cSrcweir                                 ::rtl::OUString& _rTableRange) const;
230cdf0e10cSrcweir 
231cdf0e10cSrcweir         /** retrieves a column's name, table range, and alias
232cdf0e10cSrcweir 
233cdf0e10cSrcweir             @param  _pColumnRef
234cdf0e10cSrcweir                 The column_ref parse node.
235cdf0e10cSrcweir             @param  _out_rColumnName
236cdf0e10cSrcweir                 The column name to be set.
237cdf0e10cSrcweir             @param  _out_rTableRange
238cdf0e10cSrcweir                 The table range to be set.
239cdf0e10cSrcweir             @param _out_rColumnAliasIfPresent
240cdf0e10cSrcweir                 If the column specified by _pColumnRef is part of the select columns, and contains a column alias there,
241cdf0e10cSrcweir                 this alias is returned here.
242cdf0e10cSrcweir         */
243cdf0e10cSrcweir         void getColumnRange(    const OSQLParseNode* _pColumnRef,
244cdf0e10cSrcweir                                 ::rtl::OUString& _out_rColumnName,
245cdf0e10cSrcweir                                 ::rtl::OUString& _out_rTableRange,
246cdf0e10cSrcweir                                 ::rtl::OUString& _out_rColumnAliasIfPresent
247cdf0e10cSrcweir                                 ) const;
248cdf0e10cSrcweir 
249cdf0e10cSrcweir         /** return the alias name of a column
250cdf0e10cSrcweir             @param  _pDerivedColumn
251cdf0e10cSrcweir                 The parse node where SQL_ISRULE(_pDerivedColumn,derived_column) must be true
252cdf0e10cSrcweir             @return
253cdf0e10cSrcweir                 The alias name of the column or an empty string.
254cdf0e10cSrcweir         */
255cdf0e10cSrcweir         static ::rtl::OUString getColumnAlias(const OSQLParseNode* _pDerivedColumn);
256cdf0e10cSrcweir 
257cdf0e10cSrcweir         /** return the columname and the table range
258cdf0e10cSrcweir             @param  _pColumnRef
259cdf0e10cSrcweir                 The column ref parse node.
260cdf0e10cSrcweir             @param  _xMetaData
261cdf0e10cSrcweir                 The database meta data.
262cdf0e10cSrcweir             @param  _rColumnName
263cdf0e10cSrcweir                 The column name to be set.
264cdf0e10cSrcweir             @param  _rTableRange
265cdf0e10cSrcweir                 The table range to be set.
266cdf0e10cSrcweir         */
267cdf0e10cSrcweir         static void getColumnRange( const OSQLParseNode* _pColumnRef,
268cdf0e10cSrcweir                                     const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection,
269cdf0e10cSrcweir                                     ::rtl::OUString &_rColumnName,
270cdf0e10cSrcweir                                     ::rtl::OUString& _rTableRange);
271cdf0e10cSrcweir 
272cdf0e10cSrcweir         // Ermittelt fuer eine Funktion, Spalten den zugehoeren TableRange,
273cdf0e10cSrcweir         // wenn nicht eindeutig, dann leer
274cdf0e10cSrcweir         sal_Bool getColumnTableRange(const OSQLParseNode* pNode, ::rtl::OUString &rTableRange) const;
275cdf0e10cSrcweir 
276cdf0e10cSrcweir         // return true when the tableNode is a rule like catalog_name, schema_name or table_name
277cdf0e10cSrcweir         sal_Bool isTableNode(const OSQLParseNode* _pTableNode) const;
278cdf0e10cSrcweir 
279cdf0e10cSrcweir         // tries to find the correct type of the function
280cdf0e10cSrcweir         sal_Int32 getFunctionReturnType(const OSQLParseNode* _pNode );
281cdf0e10cSrcweir 
282cdf0e10cSrcweir         // returns a lis of all joined columns
283cdf0e10cSrcweir         ::std::vector< TNodePair >& getJoinConditions() const;
284cdf0e10cSrcweir 
285cdf0e10cSrcweir     private:
286cdf0e10cSrcweir         /** traverses the list of table names, and filles _rTables
287cdf0e10cSrcweir         */
288cdf0e10cSrcweir         bool traverseTableNames( OSQLTables& _rTables );
289cdf0e10cSrcweir 
290cdf0e10cSrcweir         /// traverses columns in a SELECT statement
291cdf0e10cSrcweir         bool traverseSelectColumnNames(const OSQLParseNode* pSelectNode);
292cdf0e10cSrcweir         /// traverses columns in a CREATE TABLE statement
293cdf0e10cSrcweir         void traverseCreateColumns(const OSQLParseNode* pSelectNode);
294cdf0e10cSrcweir 
295cdf0e10cSrcweir         bool traverseOrderByColumnNames(const OSQLParseNode* pSelectNode);
296cdf0e10cSrcweir         bool traverseGroupByColumnNames(const OSQLParseNode* pSelectNode);
297cdf0e10cSrcweir 
298cdf0e10cSrcweir         bool traverseSelectionCriteria(const OSQLParseNode* pSelectNode);
299cdf0e10cSrcweir 
300cdf0e10cSrcweir     private:
301cdf0e10cSrcweir         /** constructs a new iterator, which inherits some of the settings from a parent iterator
302cdf0e10cSrcweir         */
303cdf0e10cSrcweir         OSQLParseTreeIterator(
304cdf0e10cSrcweir             const OSQLParseTreeIterator& _rParentIterator,
305cdf0e10cSrcweir             const OSQLParser& _rParser,
306cdf0e10cSrcweir             const OSQLParseNode* pRoot );
307cdf0e10cSrcweir 
308cdf0e10cSrcweir         /** creates a table object and inserts it into our tables collection
309cdf0e10cSrcweir 
310cdf0e10cSrcweir             only used when we're iterating through a CREATE TABLE statement
311cdf0e10cSrcweir         */
312cdf0e10cSrcweir         OSQLTable   impl_createTableObject(
313cdf0e10cSrcweir             const ::rtl::OUString& rTableName, const ::rtl::OUString& rCatalogName, const ::rtl::OUString& rSchemaName );
314cdf0e10cSrcweir 
315cdf0e10cSrcweir         /** locates a record source (a table or query) with the given name
316cdf0e10cSrcweir         */
317cdf0e10cSrcweir         OSQLTable   impl_locateRecordSource(
318cdf0e10cSrcweir             const ::rtl::OUString& _rComposedName
319cdf0e10cSrcweir         );
320cdf0e10cSrcweir 
321cdf0e10cSrcweir         /** implementation for both traverseAll and traverseSome
322cdf0e10cSrcweir         */
323cdf0e10cSrcweir         void    impl_traverse( sal_uInt32 _nIncludeMask );
324cdf0e10cSrcweir 
325cdf0e10cSrcweir         /** retrieves the parameter columns of the given query
326cdf0e10cSrcweir         */
327cdf0e10cSrcweir         void    impl_getQueryParameterColumns( const OSQLTable& _rQuery );
328cdf0e10cSrcweir 
329cdf0e10cSrcweir         void setOrderByColumnName(const ::rtl::OUString & rColumnName, const ::rtl::OUString & rTableRange, sal_Bool bAscending);
330cdf0e10cSrcweir         void setGroupByColumnName(const ::rtl::OUString & rColumnName, const ::rtl::OUString & rTableRange);
331cdf0e10cSrcweir 
332cdf0e10cSrcweir     private:
333cdf0e10cSrcweir         /** appends an SQLException corresponding to the given error code to our error collection
334cdf0e10cSrcweir 
335cdf0e10cSrcweir             @param  _eError
33607a3d7f1SPedro Giffuni                 the code of the error which occurred
337cdf0e10cSrcweir             @param  _pReplaceToken1
33807a3d7f1SPedro Giffuni                 if not <NULL/>, the first occurrence of '#' in the error message will be replaced
339cdf0e10cSrcweir                 with the given token
340cdf0e10cSrcweir             @param  _pReplaceToken2
34107a3d7f1SPedro Giffuni                 if not <NULL/>, and if _rReplaceToken1 is not <NULL/>, the second occurrence of '#'
342cdf0e10cSrcweir                 in the error message will be replaced with _rReplaceToken2
343cdf0e10cSrcweir         */
344cdf0e10cSrcweir         void impl_appendError( IParseContext::ErrorCode _eError,
345cdf0e10cSrcweir             const ::rtl::OUString* _pReplaceToken1 = NULL, const ::rtl::OUString* _pReplaceToken2 = NULL );
346cdf0e10cSrcweir 
347cdf0e10cSrcweir         /** appends an SQLException corresponding to the given error code to our error collection
348cdf0e10cSrcweir         */
349cdf0e10cSrcweir         void impl_appendError( const ::com::sun::star::sdbc::SQLException& _rError );
350cdf0e10cSrcweir 
351cdf0e10cSrcweir         /** resets our errors
352cdf0e10cSrcweir         */
impl_resetErrors()353cdf0e10cSrcweir         inline void impl_resetErrors()
354cdf0e10cSrcweir         {
355cdf0e10cSrcweir             m_aErrors = ::com::sun::star::sdbc::SQLException();
356cdf0e10cSrcweir         }
357cdf0e10cSrcweir         void impl_fillJoinConditions(const OSQLParseNode* i_pJoinCondition);
358cdf0e10cSrcweir     };
359cdf0e10cSrcweir }
360cdf0e10cSrcweir 
361cdf0e10cSrcweir #endif // _CONNECTIVITY_PARSE_SQLITERATOR_HXX_
362