Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_FILE_FANALYZER_HXX
21 : #define INCLUDED_CONNECTIVITY_SOURCE_INC_FILE_FANALYZER_HXX
22 :
23 : #include "file/fcomp.hxx"
24 : #include "file/filedllapi.hxx"
25 :
26 : namespace connectivity
27 : {
28 : namespace file
29 : {
30 : class OConnection;
31 : class OOO_DLLPUBLIC_FILE OSQLAnalyzer
32 : {
33 : typedef ::std::list<OEvaluateSet*> OEvaluateSetList;
34 : typedef ::std::pair< ::rtl::Reference<OPredicateCompiler>,::rtl::Reference<OPredicateInterpreter> > TPredicates;
35 :
36 : ::std::vector< TPredicates > m_aSelectionEvaluations;
37 : ::rtl::Reference<OPredicateCompiler> m_aCompiler;
38 : ::rtl::Reference<OPredicateInterpreter> m_aInterpreter;
39 : OConnection* m_pConnection;
40 :
41 : mutable bool m_bHasSelectionCode;
42 : mutable bool m_bSelectionFirstTime;
43 :
44 : static void bindRow(OCodeList& rCodeList,const OValueRefRow& _pRow,OEvaluateSetList& _rEvaluateSetList);
45 :
46 : public:
47 : OSQLAnalyzer(OConnection* _pConnection);
48 : virtual ~OSQLAnalyzer();
49 58 : inline static void * SAL_CALL operator new( size_t nSize )
50 58 : { return ::rtl_allocateMemory( nSize ); }
51 : inline static void * SAL_CALL operator new( size_t /*nSize*/,void* _pHint )
52 : { return _pHint; }
53 58 : inline static void SAL_CALL operator delete( void * pMem )
54 58 : { ::rtl_freeMemory( pMem ); }
55 : inline static void SAL_CALL operator delete( void * /*pMem*/,void* /*_pHint*/ )
56 : { }
57 :
58 0 : 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
62 : */
63 : void bindSelectRow(const OValueRefRow& _pRow);
64 :
65 : /** binds the row to parameter for the restrictions
66 : @param _pRow the parameter row
67 : */
68 : void bindParameterRow(OValueRefRow& _pRow);
69 :
70 : void setIndexes(const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess>& _xIndexes);
71 :
72 : void dispose();
73 : void start(OSQLParseNode* pSQLParseNode);
74 : bool hasRestriction() const;
75 : bool hasFunctions() const;
76 18 : 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 : static 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);
82 : };
83 : }
84 : }
85 : #endif // INCLUDED_CONNECTIVITY_SOURCE_INC_FILE_FANALYZER_HXX
86 :
87 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|