1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_FILE_FANALYZER_HXX
21 #define INCLUDED_CONNECTIVITY_SOURCE_INC_FILE_FANALYZER_HXX
23 #include "file/fcomp.hxx"
24 #include "file/filedllapi.hxx"
26 namespace connectivity
31 class OOO_DLLPUBLIC_FILE OSQLAnalyzer
33 typedef ::std::list
<OEvaluateSet
*> OEvaluateSetList
;
34 typedef ::std::pair
< ::rtl::Reference
<OPredicateCompiler
>,::rtl::Reference
<OPredicateInterpreter
> > TPredicates
;
36 ::std::vector
< TPredicates
> m_aSelectionEvaluations
;
37 ::rtl::Reference
<OPredicateCompiler
> m_aCompiler
;
38 ::rtl::Reference
<OPredicateInterpreter
> m_aInterpreter
;
39 OConnection
* m_pConnection
;
41 mutable bool m_bHasSelectionCode
;
42 mutable bool m_bSelectionFirstTime
;
44 void bindRow(OCodeList
& rCodeList
,const OValueRefRow
& _pRow
,OEvaluateSetList
& _rEvaluateSetList
);
47 OSQLAnalyzer(OConnection
* _pConnection
);
48 virtual ~OSQLAnalyzer();
49 inline static void * SAL_CALL
operator new( size_t nSize
)
50 { return ::rtl_allocateMemory( nSize
); }
51 inline static void * SAL_CALL
operator new( size_t /*nSize*/,void* _pHint
)
53 inline static void SAL_CALL
operator delete( void * pMem
)
54 { ::rtl_freeMemory( pMem
); }
55 inline static void SAL_CALL
operator delete( void * /*pMem*/,void* /*_pHint*/ )
58 OConnection
* getConnection() const { return m_pConnection
; }
59 ::std::vector
<sal_Int32
>* bindEvaluationRow(OValueRefRow
& _pRow
); // Bind an evaluation row to the restriction
60 /** bind the select columns if they contain a function which needs a row value
61 @param _pRow the result row
63 void bindSelectRow(const OValueRefRow
& _pRow
);
65 /** binds the row to parameter for the restrictions
66 @param _pRow the parameter row
68 void bindParameterRow(OValueRefRow
& _pRow
);
70 void setIndexes(const ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameAccess
>& _xIndexes
);
73 void start(OSQLParseNode
* pSQLParseNode
);
74 bool hasRestriction() const;
75 bool hasFunctions() const;
76 inline bool evaluateRestriction() { return m_aInterpreter
->start(); }
77 void setSelectionEvaluationResult(OValueRefRow
& _pRow
,const ::std::vector
<sal_Int32
>& _rColumnMapping
);
78 void setOrigColumns(const OFileColumns
& rCols
);
79 virtual OOperandAttr
* createOperandAttr(sal_Int32 _nPos
,
80 const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
>& _xCol
,
81 const ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameAccess
>& _xIndexes
=NULL
);
85 #endif // INCLUDED_CONNECTIVITY_SOURCE_INC_FILE_FANALYZER_HXX
87 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */