1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
29 #ifndef _CONNECTIVITY_FILE_FANALYZER_HXX_
30 #define _CONNECTIVITY_FILE_FANALYZER_HXX_
32 #include "file/fcomp.hxx"
33 #include "file/filedllapi.hxx"
35 namespace connectivity
40 class OOO_DLLPUBLIC_FILE OSQLAnalyzer
42 typedef ::std::list
<OEvaluateSet
*> OEvaluateSetList
;
43 typedef ::std::pair
< ::rtl::Reference
<OPredicateCompiler
>,::rtl::Reference
<OPredicateInterpreter
> > TPredicates
;
45 ::std::vector
< TPredicates
> m_aSelectionEvaluations
;
46 ::rtl::Reference
<OPredicateCompiler
> m_aCompiler
;
47 ::rtl::Reference
<OPredicateInterpreter
> m_aInterpreter
;
48 OConnection
* m_pConnection
;
50 mutable sal_Bool m_bHasSelectionCode
;
51 mutable sal_Bool m_bSelectionFirstTime
;
53 void bindRow(OCodeList
& rCodeList
,const OValueRefRow
& _pRow
,OEvaluateSetList
& _rEvaluateSetList
);
56 OSQLAnalyzer(OConnection
* _pConnection
);
57 virtual ~OSQLAnalyzer();
58 inline static void * SAL_CALL
operator new( size_t nSize
) SAL_THROW(())
59 { return ::rtl_allocateMemory( nSize
); }
60 inline static void * SAL_CALL
operator new( size_t /*nSize*/,void* _pHint
) SAL_THROW(())
62 inline static void SAL_CALL
operator delete( void * pMem
) SAL_THROW(())
63 { ::rtl_freeMemory( pMem
); }
64 inline static void SAL_CALL
operator delete( void * /*pMem*/,void* /*_pHint*/ ) SAL_THROW(())
67 OConnection
* getConnection() const { return m_pConnection
; }
68 ::std::vector
<sal_Int32
>* bindEvaluationRow(OValueRefRow
& _pRow
); // Bind an evaluation row to the restriction
69 /** bind the select columns if they contain a function which needs a row value
70 @param _pRow the result row
72 void bindSelectRow(const OValueRefRow
& _pRow
);
74 /** binds the row to parameter for the restrictions
75 @param _pRow the parameter row
77 void bindParameterRow(OValueRefRow
& _pRow
);
79 void setIndexes(const ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameAccess
>& _xIndexes
);
82 void start(OSQLParseNode
* pSQLParseNode
);
83 virtual sal_Bool
hasRestriction() const;
84 virtual sal_Bool
hasFunctions() const;
85 inline sal_Bool
evaluateRestriction() { return m_aInterpreter
->start(); }
86 void setSelectionEvaluationResult(OValueRefRow
& _pRow
,const ::std::vector
<sal_Int32
>& _rColumnMapping
);
87 void setOrigColumns(const OFileColumns
& rCols
);
88 virtual OOperandAttr
* createOperandAttr(sal_Int32 _nPos
,
89 const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
>& _xCol
,
90 const ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameAccess
>& _xIndexes
=NULL
);
94 #endif // _CONNECTIVITY_FILE_FANALYZER_HXX_
96 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */