1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
29*cdf0e10cSrcweir #include "precompiled_connectivity.hxx"
30*cdf0e10cSrcweir #include "file/fanalyzer.hxx"
31*cdf0e10cSrcweir #include "connectivity/sqlparse.hxx"
32*cdf0e10cSrcweir #include <osl/diagnose.h>
33*cdf0e10cSrcweir #include <tools/debug.hxx>
34*cdf0e10cSrcweir #include <comphelper/extract.hxx>
35*cdf0e10cSrcweir #include "connectivity/sqlnode.hxx"
36*cdf0e10cSrcweir #include "connectivity/dbexception.hxx"
37*cdf0e10cSrcweir #include "file/FConnection.hxx"
38*cdf0e10cSrcweir #include "resource/file_res.hrc"
39*cdf0e10cSrcweir 
40*cdf0e10cSrcweir using namespace ::connectivity;
41*cdf0e10cSrcweir using namespace ::connectivity::file;
42*cdf0e10cSrcweir using namespace ::com::sun::star::uno;
43*cdf0e10cSrcweir using namespace ::com::sun::star::beans;
44*cdf0e10cSrcweir using namespace ::com::sun::star::sdbc;
45*cdf0e10cSrcweir using namespace ::com::sun::star::container;
46*cdf0e10cSrcweir 
47*cdf0e10cSrcweir DBG_NAME( file_OSQLAnalyzer )
48*cdf0e10cSrcweir //------------------------------------------------------------------
49*cdf0e10cSrcweir OSQLAnalyzer::OSQLAnalyzer(OConnection* _pConnection)
50*cdf0e10cSrcweir 			   :m_pConnection(_pConnection)
51*cdf0e10cSrcweir                ,m_bHasSelectionCode(sal_False)
52*cdf0e10cSrcweir                ,m_bSelectionFirstTime(sal_True)
53*cdf0e10cSrcweir {
54*cdf0e10cSrcweir 	DBG_CTOR( file_OSQLAnalyzer, NULL );
55*cdf0e10cSrcweir 	m_aCompiler = new OPredicateCompiler(this);
56*cdf0e10cSrcweir 	m_aInterpreter = new OPredicateInterpreter(m_aCompiler);
57*cdf0e10cSrcweir }
58*cdf0e10cSrcweir 
59*cdf0e10cSrcweir // -----------------------------------------------------------------------------
60*cdf0e10cSrcweir OSQLAnalyzer::~OSQLAnalyzer()
61*cdf0e10cSrcweir {
62*cdf0e10cSrcweir 	DBG_DTOR( file_OSQLAnalyzer, NULL );
63*cdf0e10cSrcweir }
64*cdf0e10cSrcweir 
65*cdf0e10cSrcweir // -----------------------------------------------------------------------------
66*cdf0e10cSrcweir void OSQLAnalyzer::setIndexes(const Reference< XNameAccess>& _xIndexes)
67*cdf0e10cSrcweir {
68*cdf0e10cSrcweir 	m_aCompiler->m_xIndexes = _xIndexes;
69*cdf0e10cSrcweir }
70*cdf0e10cSrcweir //------------------------------------------------------------------
71*cdf0e10cSrcweir void OSQLAnalyzer::start(OSQLParseNode* pSQLParseNode)
72*cdf0e10cSrcweir {
73*cdf0e10cSrcweir 	if (SQL_ISRULE(pSQLParseNode,select_statement))
74*cdf0e10cSrcweir 	{
75*cdf0e10cSrcweir 		DBG_ASSERT(pSQLParseNode->count() >= 4,"OFILECursor: Fehler im Parse Tree");
76*cdf0e10cSrcweir 
77*cdf0e10cSrcweir 		// check that we don't use anything other than count(*) as function
78*cdf0e10cSrcweir 		OSQLParseNode* pSelection = pSQLParseNode->getChild(2);
79*cdf0e10cSrcweir 		if ( SQL_ISRULE(pSelection,scalar_exp_commalist) )
80*cdf0e10cSrcweir 		{
81*cdf0e10cSrcweir 			for (sal_uInt32 i = 0; i < pSelection->count(); i++)
82*cdf0e10cSrcweir 			{
83*cdf0e10cSrcweir 				OSQLParseNode *pColumnRef = pSelection->getChild(i)->getChild(0);
84*cdf0e10cSrcweir 				if (	( SQL_ISRULE(pColumnRef,set_fct_spec) && pColumnRef->count() == 4 )
85*cdf0e10cSrcweir 					||	SQL_ISRULE(pColumnRef,char_value_fct)
86*cdf0e10cSrcweir 					||	SQL_ISRULE(pColumnRef,char_substring_fct)
87*cdf0e10cSrcweir 					||	SQL_ISRULE(pColumnRef,position_exp)
88*cdf0e10cSrcweir 					||	SQL_ISRULE(pColumnRef,fold)
89*cdf0e10cSrcweir 					||	SQL_ISRULE(pColumnRef,length_exp)
90*cdf0e10cSrcweir                     ||	SQL_ISRULE(pColumnRef,num_value_exp)
91*cdf0e10cSrcweir                     ||	SQL_ISRULE(pColumnRef,term)
92*cdf0e10cSrcweir                     ||	SQL_ISRULE(pColumnRef,factor)
93*cdf0e10cSrcweir 					||	SQL_ISRULE(pColumnRef,set_fct_spec) )
94*cdf0e10cSrcweir 				{
95*cdf0e10cSrcweir 					::vos::ORef<OPredicateCompiler>		pCompiler = new OPredicateCompiler(this);
96*cdf0e10cSrcweir 					pCompiler->setOrigColumns(m_aCompiler->getOrigColumns());
97*cdf0e10cSrcweir 					::vos::ORef<OPredicateInterpreter>	pInterpreter = new OPredicateInterpreter(pCompiler);
98*cdf0e10cSrcweir 					pCompiler->execute( pColumnRef );
99*cdf0e10cSrcweir 					m_aSelectionEvaluations.push_back( TPredicates(pCompiler,pInterpreter) );
100*cdf0e10cSrcweir 				}
101*cdf0e10cSrcweir 				else if ( ( SQL_ISRULE(pColumnRef,general_set_fct) && pColumnRef->count() != 4 ) )
102*cdf0e10cSrcweir 				{
103*cdf0e10cSrcweir 					m_pConnection->throwGenericSQLException(STR_QUERY_COMPLEX_COUNT,NULL);
104*cdf0e10cSrcweir 				}
105*cdf0e10cSrcweir 				else
106*cdf0e10cSrcweir                 {
107*cdf0e10cSrcweir                     if  (   SQL_ISPUNCTUATION( pColumnRef, "*" )
108*cdf0e10cSrcweir                         ||  (   SQL_ISRULE( pColumnRef, column_ref )
109*cdf0e10cSrcweir                             &&  ( pColumnRef->count() == 3 )
110*cdf0e10cSrcweir                             &&  ( pColumnRef->getChild(0)->getNodeType() == SQL_NODE_NAME )
111*cdf0e10cSrcweir                             &&  SQL_ISPUNCTUATION( pColumnRef->getChild(1), "." )
112*cdf0e10cSrcweir                             &&  SQL_ISRULE( pColumnRef->getChild(2), column_val )
113*cdf0e10cSrcweir                             &&  SQL_ISPUNCTUATION( pColumnRef->getChild(2)->getChild(0), "*" )
114*cdf0e10cSrcweir                             )
115*cdf0e10cSrcweir                         )
116*cdf0e10cSrcweir                     {
117*cdf0e10cSrcweir                         // push one element for each column of our table
118*cdf0e10cSrcweir                         const Reference< XNameAccess > xColumnNames( m_aCompiler->getOrigColumns() );
119*cdf0e10cSrcweir                         const Sequence< ::rtl::OUString > aColumnNames( xColumnNames->getElementNames() );
120*cdf0e10cSrcweir                         for ( sal_Int32 j=0; j<aColumnNames.getLength(); ++j )
121*cdf0e10cSrcweir 					        m_aSelectionEvaluations.push_back( TPredicates() );
122*cdf0e10cSrcweir                     }
123*cdf0e10cSrcweir                     else
124*cdf0e10cSrcweir 					    m_aSelectionEvaluations.push_back( TPredicates() );
125*cdf0e10cSrcweir                 }
126*cdf0e10cSrcweir 			}
127*cdf0e10cSrcweir 		}
128*cdf0e10cSrcweir 	}
129*cdf0e10cSrcweir 
130*cdf0e10cSrcweir 	m_aCompiler->start(pSQLParseNode);
131*cdf0e10cSrcweir }
132*cdf0e10cSrcweir 
133*cdf0e10cSrcweir //------------------------------------------------------------------
134*cdf0e10cSrcweir void OSQLAnalyzer::bindRow(OCodeList& rCodeList,const OValueRefRow& _pRow,OEvaluateSetList& _rEvaluateSetList)
135*cdf0e10cSrcweir {
136*cdf0e10cSrcweir 	// Zaehlen, wieviele Kriterien
137*cdf0e10cSrcweir 	// wenn nur ein Kriterium, und das entsprechende Feld ist indiziert
138*cdf0e10cSrcweir 	// dann wird der Index verwendet
139*cdf0e10cSrcweir 
140*cdf0e10cSrcweir 	OEvaluateSet*		pEvaluateSet = NULL;
141*cdf0e10cSrcweir 
142*cdf0e10cSrcweir 	for (OCodeList::iterator aIter = rCodeList.begin(); aIter != rCodeList.end(); ++aIter)
143*cdf0e10cSrcweir 	{
144*cdf0e10cSrcweir 		OOperandAttr* pAttr = PTR_CAST(OOperandAttr,(*aIter));
145*cdf0e10cSrcweir 		if (pAttr)
146*cdf0e10cSrcweir 		{
147*cdf0e10cSrcweir 			if (pAttr->isIndexed() && !m_aCompiler->hasORCondition())
148*cdf0e10cSrcweir 			{
149*cdf0e10cSrcweir 				OCode* pCode1 = *(aIter + 1);
150*cdf0e10cSrcweir 				OCode* pCode2 = *(aIter + 2);
151*cdf0e10cSrcweir 
152*cdf0e10cSrcweir 				if (PTR_CAST(OOperand,pCode1))
153*cdf0e10cSrcweir 					pEvaluateSet = pAttr->preProcess(PTR_CAST(OBoolOperator,pCode2), PTR_CAST(OOperand,pCode1));
154*cdf0e10cSrcweir 				else
155*cdf0e10cSrcweir 					pEvaluateSet = pAttr->preProcess(PTR_CAST(OBoolOperator,pCode1));
156*cdf0e10cSrcweir 			}
157*cdf0e10cSrcweir 
158*cdf0e10cSrcweir 			if (pEvaluateSet)
159*cdf0e10cSrcweir 			{
160*cdf0e10cSrcweir 				_rEvaluateSetList.push_back(pEvaluateSet);
161*cdf0e10cSrcweir 				pEvaluateSet = NULL;
162*cdf0e10cSrcweir 			}
163*cdf0e10cSrcweir 			pAttr->bindValue(_pRow);
164*cdf0e10cSrcweir 		}
165*cdf0e10cSrcweir 	}
166*cdf0e10cSrcweir }
167*cdf0e10cSrcweir //------------------------------------------------------------------
168*cdf0e10cSrcweir void OSQLAnalyzer::bindSelectRow(const OValueRefRow& _pRow)
169*cdf0e10cSrcweir {
170*cdf0e10cSrcweir 	// first the select part
171*cdf0e10cSrcweir 	OEvaluateSetList	aEvaluateSetList;
172*cdf0e10cSrcweir 	for ( ::std::vector< TPredicates >::iterator aIter = m_aSelectionEvaluations.begin(); aIter != m_aSelectionEvaluations.end();++aIter)
173*cdf0e10cSrcweir 	{
174*cdf0e10cSrcweir 		if ( aIter->first.isValid() )
175*cdf0e10cSrcweir 			bindRow( aIter->first->m_aCodeList,_pRow,aEvaluateSetList);
176*cdf0e10cSrcweir 	}
177*cdf0e10cSrcweir }
178*cdf0e10cSrcweir //------------------------------------------------------------------
179*cdf0e10cSrcweir ::std::vector<sal_Int32>* OSQLAnalyzer::bindEvaluationRow(OValueRefRow& _pRow)
180*cdf0e10cSrcweir {
181*cdf0e10cSrcweir 	OEvaluateSetList	aEvaluateSetList;
182*cdf0e10cSrcweir 	bindRow( m_aCompiler->m_aCodeList,_pRow,aEvaluateSetList);
183*cdf0e10cSrcweir 
184*cdf0e10cSrcweir 	::std::vector<sal_Int32>*	pKeySet		 = NULL;
185*cdf0e10cSrcweir 	OEvaluateSet*				pEvaluateSet = NULL;
186*cdf0e10cSrcweir 
187*cdf0e10cSrcweir 	// Keyset erzeugen mit kleinster Liste
188*cdf0e10cSrcweir 	if(!aEvaluateSetList.empty())
189*cdf0e10cSrcweir 	{
190*cdf0e10cSrcweir 		// welche Liste hat den kleinsten count ?
191*cdf0e10cSrcweir 		OEvaluateSetList::iterator i = aEvaluateSetList.begin();
192*cdf0e10cSrcweir 		pEvaluateSet = *(i);
193*cdf0e10cSrcweir 		for(++i; i != aEvaluateSetList.end();++i)
194*cdf0e10cSrcweir 		{
195*cdf0e10cSrcweir 			OEvaluateSet*	pEvaluateSetComp = (*i);
196*cdf0e10cSrcweir 			for(OEvaluateSet::reverse_iterator j = pEvaluateSet->rbegin(); j != pEvaluateSet->rend(); ++j)
197*cdf0e10cSrcweir 			{
198*cdf0e10cSrcweir 				if (pEvaluateSetComp->find(j->second) != pEvaluateSetComp->end())
199*cdf0e10cSrcweir 					pEvaluateSet->erase(j->second);
200*cdf0e10cSrcweir 			}
201*cdf0e10cSrcweir 		}
202*cdf0e10cSrcweir 		pKeySet = new ::std::vector<sal_Int32>(pEvaluateSet->size());
203*cdf0e10cSrcweir 		sal_Int32 k=0;
204*cdf0e10cSrcweir 		for(OEvaluateSet::iterator j = pEvaluateSet->begin(); j != pEvaluateSet->end(); ++j,++k)
205*cdf0e10cSrcweir 		{
206*cdf0e10cSrcweir 			(*pKeySet)[k] = j->second;
207*cdf0e10cSrcweir 		}
208*cdf0e10cSrcweir 
209*cdf0e10cSrcweir 		// alle loeschen
210*cdf0e10cSrcweir 		for(i = aEvaluateSetList.begin(); i != aEvaluateSetList.end();++i)
211*cdf0e10cSrcweir 			delete (*i);
212*cdf0e10cSrcweir 	}
213*cdf0e10cSrcweir 
214*cdf0e10cSrcweir 	return pKeySet;
215*cdf0e10cSrcweir }
216*cdf0e10cSrcweir 
217*cdf0e10cSrcweir //------------------------------------------------------------------
218*cdf0e10cSrcweir void OSQLAnalyzer::describeParam(::vos::ORef<OSQLColumns> rParameterColumns)
219*cdf0e10cSrcweir {
220*cdf0e10cSrcweir 	OCodeList& rCodeList	= m_aCompiler->m_aCodeList;
221*cdf0e10cSrcweir 	OCodeStack aCodeStack;
222*cdf0e10cSrcweir 
223*cdf0e10cSrcweir 	if (!rCodeList.size())
224*cdf0e10cSrcweir         return;     // kein Praedikat
225*cdf0e10cSrcweir 	if (!rParameterColumns->get().size())
226*cdf0e10cSrcweir 		return; // keine Parameter
227*cdf0e10cSrcweir 
228*cdf0e10cSrcweir     // Anlegen von Columns, die eine genauere Beschreibung fuer die enthalten
229*cdf0e10cSrcweir 	::vos::ORef<OSQLColumns> aNewParamColumns = new OSQLColumns(*rParameterColumns);
230*cdf0e10cSrcweir 
231*cdf0e10cSrcweir 
232*cdf0e10cSrcweir     // Anlegen einer Testzeile, wird benoetigt um die Parameter zu beschreiben
233*cdf0e10cSrcweir 	OValueRefRow aParameterRow  = new OValueRefVector(rParameterColumns->get().size());
234*cdf0e10cSrcweir 	bindParameterRow(aParameterRow);
235*cdf0e10cSrcweir 
236*cdf0e10cSrcweir 	OValueRefRow aTestRow = new OValueRefVector(Reference< XIndexAccess>(m_aCompiler->getOrigColumns(),UNO_QUERY)->getCount());
237*cdf0e10cSrcweir 	delete bindEvaluationRow(aTestRow);					// Binden der Attribute an die Values
238*cdf0e10cSrcweir 
239*cdf0e10cSrcweir 	for(OCodeList::iterator aIter = rCodeList.begin(); aIter != rCodeList.end(); ++aIter)
240*cdf0e10cSrcweir 	{
241*cdf0e10cSrcweir 		OOperand* pOperand = PTR_CAST(OOperand,(*aIter));
242*cdf0e10cSrcweir 		OOperator* pOperator = PTR_CAST(OOperator,(*aIter));
243*cdf0e10cSrcweir 		if (pOperand)
244*cdf0e10cSrcweir 			aCodeStack.push(pOperand);
245*cdf0e10cSrcweir 		else
246*cdf0e10cSrcweir 		{
247*cdf0e10cSrcweir             if (pOperator->getRequestedOperands() == 2)     // bei zwei Operatoren ist es moeglich
248*cdf0e10cSrcweir 			{												// einen Parameter weiter zu spezifizieren
249*cdf0e10cSrcweir 				OOperandParam *pParam  = PTR_CAST(OOperandParam,aCodeStack.top());
250*cdf0e10cSrcweir 				if (pParam)  // Anpassen des ParameterTyps, wenn der linke Operand ein Attribut ist
251*cdf0e10cSrcweir 				{
252*cdf0e10cSrcweir 					OOperandAttr *pLeft	 = PTR_CAST(OOperandAttr,*(rCodeList.end() - 2));
253*cdf0e10cSrcweir 					if (pLeft)
254*cdf0e10cSrcweir 					{
255*cdf0e10cSrcweir 						Reference< XPropertySet> xCol;
256*cdf0e10cSrcweir 						Reference< XIndexAccess>(m_aCompiler->getOrigColumns(),UNO_QUERY)->getByIndex(pLeft->getRowPos()) >>= xCol;
257*cdf0e10cSrcweir                         OSL_ENSURE(xCol.is(), "Ungueltige Struktur");
258*cdf0e10cSrcweir 						pParam->describe(xCol, aNewParamColumns);
259*cdf0e10cSrcweir 					}
260*cdf0e10cSrcweir 				}
261*cdf0e10cSrcweir 			}
262*cdf0e10cSrcweir 			pOperator->Exec(aCodeStack);
263*cdf0e10cSrcweir 		}
264*cdf0e10cSrcweir 	}
265*cdf0e10cSrcweir 	OOperand* pOperand = aCodeStack.top();
266*cdf0e10cSrcweir 	aCodeStack.pop();
267*cdf0e10cSrcweir 
268*cdf0e10cSrcweir 	OSL_ENSURE(aCodeStack.size() == 0, "StackFehler");
269*cdf0e10cSrcweir 	OSL_ENSURE(pOperand, "StackFehler");
270*cdf0e10cSrcweir 	if (IS_TYPE(OOperandResult,pOperand))
271*cdf0e10cSrcweir 		delete pOperand;
272*cdf0e10cSrcweir 	else
273*cdf0e10cSrcweir 		OSL_ENSURE(0,"Illegal here!");
274*cdf0e10cSrcweir 
275*cdf0e10cSrcweir 	rParameterColumns = aNewParamColumns;
276*cdf0e10cSrcweir 	//	m_aCompiler->setParameterColumns(rParameterColumns);
277*cdf0e10cSrcweir }
278*cdf0e10cSrcweir 
279*cdf0e10cSrcweir // -----------------------------------------------------------------------------
280*cdf0e10cSrcweir OOperandAttr* OSQLAnalyzer::createOperandAttr(sal_Int32 _nPos,
281*cdf0e10cSrcweir 											  const Reference< XPropertySet>& _xCol,
282*cdf0e10cSrcweir 											  const Reference< XNameAccess>& /*_xIndexes*/)
283*cdf0e10cSrcweir {
284*cdf0e10cSrcweir 	return new OOperandAttr(static_cast<sal_uInt16>(_nPos),_xCol);
285*cdf0e10cSrcweir }
286*cdf0e10cSrcweir // -----------------------------------------------------------------------------
287*cdf0e10cSrcweir sal_Bool OSQLAnalyzer::hasRestriction() const
288*cdf0e10cSrcweir {
289*cdf0e10cSrcweir 	return m_aCompiler->hasCode();
290*cdf0e10cSrcweir }
291*cdf0e10cSrcweir // -----------------------------------------------------------------------------
292*cdf0e10cSrcweir sal_Bool OSQLAnalyzer::hasFunctions() const
293*cdf0e10cSrcweir {
294*cdf0e10cSrcweir 	if ( m_bSelectionFirstTime )
295*cdf0e10cSrcweir 	{
296*cdf0e10cSrcweir 		m_bSelectionFirstTime = sal_False;
297*cdf0e10cSrcweir 		for ( ::std::vector< TPredicates >::const_iterator aIter = m_aSelectionEvaluations.begin(); aIter != m_aSelectionEvaluations.end() && !m_bHasSelectionCode ;++aIter)
298*cdf0e10cSrcweir 		{
299*cdf0e10cSrcweir 			if ( aIter->first.isValid() )
300*cdf0e10cSrcweir 				m_bHasSelectionCode = aIter->first->hasCode();
301*cdf0e10cSrcweir 		}
302*cdf0e10cSrcweir 	}
303*cdf0e10cSrcweir 	return m_bHasSelectionCode;;
304*cdf0e10cSrcweir }
305*cdf0e10cSrcweir // -----------------------------------------------------------------------------
306*cdf0e10cSrcweir void OSQLAnalyzer::setSelectionEvaluationResult(OValueRefRow& _pRow,const ::std::vector<sal_Int32>& _rColumnMapping)
307*cdf0e10cSrcweir {
308*cdf0e10cSrcweir 	sal_Int32 nPos = 1;
309*cdf0e10cSrcweir 	for ( ::std::vector< TPredicates >::iterator aIter = m_aSelectionEvaluations.begin(); aIter != m_aSelectionEvaluations.end();++aIter,++nPos)
310*cdf0e10cSrcweir 	{
311*cdf0e10cSrcweir 		if ( aIter->second.isValid() )
312*cdf0e10cSrcweir 		{
313*cdf0e10cSrcweir 			// the first column (index 0) is for convenience only. The first real select column is no 1.
314*cdf0e10cSrcweir 			sal_Int32	map = nPos;
315*cdf0e10cSrcweir 			if ( nPos < static_cast< sal_Int32 >( _rColumnMapping.size() ) )
316*cdf0e10cSrcweir 				map = _rColumnMapping[nPos];
317*cdf0e10cSrcweir             if ( map > 0 )
318*cdf0e10cSrcweir 			    aIter->second->startSelection( (_pRow->get())[map] );
319*cdf0e10cSrcweir 		}
320*cdf0e10cSrcweir 	}
321*cdf0e10cSrcweir }
322*cdf0e10cSrcweir // -----------------------------------------------------------------------------
323*cdf0e10cSrcweir void OSQLAnalyzer::dispose()
324*cdf0e10cSrcweir {
325*cdf0e10cSrcweir 	m_aCompiler->dispose();
326*cdf0e10cSrcweir 	for ( ::std::vector< TPredicates >::iterator aIter = m_aSelectionEvaluations.begin(); aIter != m_aSelectionEvaluations.end();++aIter)
327*cdf0e10cSrcweir 	{
328*cdf0e10cSrcweir 		if ( aIter->first.isValid() )
329*cdf0e10cSrcweir 			aIter->first->dispose();
330*cdf0e10cSrcweir 	}
331*cdf0e10cSrcweir }
332*cdf0e10cSrcweir // -----------------------------------------------------------------------------
333*cdf0e10cSrcweir void OSQLAnalyzer::setOrigColumns(const OFileColumns& rCols)
334*cdf0e10cSrcweir {
335*cdf0e10cSrcweir 	m_aCompiler->setOrigColumns(rCols);
336*cdf0e10cSrcweir 	for ( ::std::vector< TPredicates >::iterator aIter = m_aSelectionEvaluations.begin(); aIter != m_aSelectionEvaluations.end();++aIter)
337*cdf0e10cSrcweir 	{
338*cdf0e10cSrcweir 		if ( aIter->first.isValid() )
339*cdf0e10cSrcweir 			aIter->first->setOrigColumns(rCols);
340*cdf0e10cSrcweir 	}
341*cdf0e10cSrcweir }
342*cdf0e10cSrcweir // -----------------------------------------------------------------------------
343