1*caf5cd79SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*caf5cd79SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*caf5cd79SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*caf5cd79SAndrew Rist * distributed with this work for additional information 6*caf5cd79SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*caf5cd79SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*caf5cd79SAndrew Rist * "License"); you may not use this file except in compliance 9*caf5cd79SAndrew Rist * with the License. You may obtain a copy of the License at 10*caf5cd79SAndrew Rist * 11*caf5cd79SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*caf5cd79SAndrew Rist * 13*caf5cd79SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*caf5cd79SAndrew Rist * software distributed under the License is distributed on an 15*caf5cd79SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*caf5cd79SAndrew Rist * KIND, either express or implied. See the License for the 17*caf5cd79SAndrew Rist * specific language governing permissions and limitations 18*caf5cd79SAndrew Rist * under the License. 19*caf5cd79SAndrew Rist * 20*caf5cd79SAndrew Rist *************************************************************/ 21*caf5cd79SAndrew Rist 22*caf5cd79SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef _CONNECTIVITY_FILE_FANALYZER_HXX_ 25cdf0e10cSrcweir #define _CONNECTIVITY_FILE_FANALYZER_HXX_ 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include "file/fcomp.hxx" 28cdf0e10cSrcweir #include "file/filedllapi.hxx" 29cdf0e10cSrcweir 30cdf0e10cSrcweir namespace connectivity 31cdf0e10cSrcweir { 32cdf0e10cSrcweir namespace file 33cdf0e10cSrcweir { 34cdf0e10cSrcweir class OConnection; 35cdf0e10cSrcweir class OOO_DLLPUBLIC_FILE OSQLAnalyzer 36cdf0e10cSrcweir { 37cdf0e10cSrcweir typedef ::std::list<OEvaluateSet*> OEvaluateSetList; 38cdf0e10cSrcweir typedef ::std::pair< ::vos::ORef<OPredicateCompiler>,::vos::ORef<OPredicateInterpreter> > TPredicates; 39cdf0e10cSrcweir 40cdf0e10cSrcweir ::std::vector< TPredicates > m_aSelectionEvaluations; 41cdf0e10cSrcweir ::vos::ORef<OPredicateCompiler> m_aCompiler; 42cdf0e10cSrcweir ::vos::ORef<OPredicateInterpreter> m_aInterpreter; 43cdf0e10cSrcweir OConnection* m_pConnection; 44cdf0e10cSrcweir 45cdf0e10cSrcweir mutable sal_Bool m_bHasSelectionCode; 46cdf0e10cSrcweir mutable sal_Bool m_bSelectionFirstTime; 47cdf0e10cSrcweir 48cdf0e10cSrcweir void bindRow(OCodeList& rCodeList,const OValueRefRow& _pRow,OEvaluateSetList& _rEvaluateSetList); 49cdf0e10cSrcweir 50cdf0e10cSrcweir public: 51cdf0e10cSrcweir OSQLAnalyzer(OConnection* _pConnection); 52cdf0e10cSrcweir virtual ~OSQLAnalyzer(); operator new(size_t nSize)53cdf0e10cSrcweir inline static void * SAL_CALL operator new( size_t nSize ) SAL_THROW( () ) 54cdf0e10cSrcweir { return ::rtl_allocateMemory( nSize ); } operator new(size_t,void * _pHint)55cdf0e10cSrcweir inline static void * SAL_CALL operator new( size_t /*nSize*/,void* _pHint ) SAL_THROW( () ) 56cdf0e10cSrcweir { return _pHint; } operator delete(void * pMem)57cdf0e10cSrcweir inline static void SAL_CALL operator delete( void * pMem ) SAL_THROW( () ) 58cdf0e10cSrcweir { ::rtl_freeMemory( pMem ); } operator delete(void *,void *)59cdf0e10cSrcweir inline static void SAL_CALL operator delete( void * /*pMem*/,void* /*_pHint*/ ) SAL_THROW( () ) 60cdf0e10cSrcweir { } 61cdf0e10cSrcweir getConnection() const62cdf0e10cSrcweir OConnection* getConnection() const { return m_pConnection; } 63cdf0e10cSrcweir void describeParam(::vos::ORef<OSQLColumns> rParameterColumns); // genauere Beschreibung der Parameter 64cdf0e10cSrcweir ::std::vector<sal_Int32>* bindEvaluationRow(OValueRefRow& _pRow); // Anbinden einer Ergebniszeile an die Restrictions 65cdf0e10cSrcweir /** bind the select columns if they contain a function which needs a row value 66cdf0e10cSrcweir @param _pRow the result row 67cdf0e10cSrcweir */ 68cdf0e10cSrcweir void bindSelectRow(const OValueRefRow& _pRow); 69cdf0e10cSrcweir 70cdf0e10cSrcweir /** binds the row to parameter for the restrictions 71cdf0e10cSrcweir @param _pRow the parameter row 72cdf0e10cSrcweir */ 73cdf0e10cSrcweir void bindParameterRow(OValueRefRow& _pRow); 74cdf0e10cSrcweir 75cdf0e10cSrcweir void setIndexes(const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess>& _xIndexes); 76cdf0e10cSrcweir 77cdf0e10cSrcweir void dispose(); 78cdf0e10cSrcweir void start(OSQLParseNode* pSQLParseNode); 79cdf0e10cSrcweir void clean(); 80cdf0e10cSrcweir virtual sal_Bool hasRestriction() const; 81cdf0e10cSrcweir virtual sal_Bool hasFunctions() const; evaluateRestriction()82cdf0e10cSrcweir inline sal_Bool evaluateRestriction() { return m_aInterpreter->start(); } 83cdf0e10cSrcweir void setSelectionEvaluationResult(OValueRefRow& _pRow,const ::std::vector<sal_Int32>& _rColumnMapping); 84cdf0e10cSrcweir void setOrigColumns(const OFileColumns& rCols); 85cdf0e10cSrcweir virtual OOperandAttr* createOperandAttr(sal_Int32 _nPos, 86cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _xCol, 87cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess>& _xIndexes=NULL); 88cdf0e10cSrcweir }; 89cdf0e10cSrcweir } 90cdf0e10cSrcweir } 91cdf0e10cSrcweir #endif // _CONNECTIVITY_FILE_FANALYZER_HXX_ 92cdf0e10cSrcweir 93