1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: fanalyzer.hxx,v $
10 * $Revision: 1.13.56.1 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _CONNECTIVITY_FILE_FANALYZER_HXX_
32 #define _CONNECTIVITY_FILE_FANALYZER_HXX_
34 #include "file/fcomp.hxx"
35 #include "file/filedllapi.hxx"
37 namespace connectivity
42 class OOO_DLLPUBLIC_FILE OSQLAnalyzer
44 typedef ::std::list
<OEvaluateSet
*> OEvaluateSetList
;
45 typedef ::std::pair
< ::vos::ORef
<OPredicateCompiler
>,::vos::ORef
<OPredicateInterpreter
> > TPredicates
;
47 ::std::vector
< TPredicates
> m_aSelectionEvaluations
;
48 ::vos::ORef
<OPredicateCompiler
> m_aCompiler
;
49 ::vos::ORef
<OPredicateInterpreter
> m_aInterpreter
;
50 OConnection
* m_pConnection
;
52 mutable sal_Bool m_bHasSelectionCode
;
53 mutable sal_Bool m_bSelectionFirstTime
;
55 void bindRow(OCodeList
& rCodeList
,const OValueRefRow
& _pRow
,OEvaluateSetList
& _rEvaluateSetList
);
58 OSQLAnalyzer(OConnection
* _pConnection
);
59 virtual ~OSQLAnalyzer();
60 inline static void * SAL_CALL
operator new( size_t nSize
) SAL_THROW( () )
61 { return ::rtl_allocateMemory( nSize
); }
62 inline static void * SAL_CALL
operator new( size_t /*nSize*/,void* _pHint
) SAL_THROW( () )
64 inline static void SAL_CALL
operator delete( void * pMem
) SAL_THROW( () )
65 { ::rtl_freeMemory( pMem
); }
66 inline static void SAL_CALL
operator delete( void * /*pMem*/,void* /*_pHint*/ ) SAL_THROW( () )
69 OConnection
* getConnection() const { return m_pConnection
; }
70 void describeParam(::vos::ORef
<OSQLColumns
> rParameterColumns
); // genauere Beschreibung der Parameter
71 ::std::vector
<sal_Int32
>* bindEvaluationRow(OValueRefRow
& _pRow
); // Anbinden einer Ergebniszeile an die Restrictions
72 /** bind the select columns if they contain a function which needs a row value
73 @param _pRow the result row
75 void bindSelectRow(const OValueRefRow
& _pRow
);
77 /** binds the row to parameter for the restrictions
78 @param _pRow the parameter row
80 void bindParameterRow(OValueRefRow
& _pRow
);
82 void setIndexes(const ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameAccess
>& _xIndexes
);
85 void start(OSQLParseNode
* pSQLParseNode
);
87 virtual BOOL
hasRestriction() const;
88 virtual BOOL
hasFunctions() const;
89 inline BOOL
evaluateRestriction() { return m_aInterpreter
->start(); }
90 void setSelectionEvaluationResult(OValueRefRow
& _pRow
,const ::std::vector
<sal_Int32
>& _rColumnMapping
);
91 void setOrigColumns(const OFileColumns
& rCols
);
92 virtual OOperandAttr
* createOperandAttr(sal_Int32 _nPos
,
93 const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
>& _xCol
,
94 const ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameAccess
>& _xIndexes
=NULL
);
98 #endif // _CONNECTIVITY_FILE_FANALYZER_HXX_