LCOV - code coverage report
Current view: top level - connectivity/source/inc/file - fcomp.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 10 14 71.4 %
Date: 2015-06-13 12:38:46 Functions: 7 9 77.8 %
Legend: Lines: hit not hit

          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             : #ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_FILE_FCOMP_HXX
      20             : #define INCLUDED_CONNECTIVITY_SOURCE_INC_FILE_FCOMP_HXX
      21             : 
      22             : #include "file/fcode.hxx"
      23             : #include "file/filedllapi.hxx"
      24             : #include <list>
      25             : 
      26             : namespace connectivity
      27             : {
      28             :     class OSQLParseNode;
      29             :     namespace file
      30             :     {
      31             :         class OCode;
      32             :         class OOperand;
      33             :         class OSQLAnalyzer;
      34             :         typedef::std::vector<OCode*> OCodeList;
      35             : 
      36             :         class OPredicateCompiler : public ::salhelper::SimpleReferenceObject
      37             :         {
      38             :             friend class OPredicateInterpreter;
      39             :             friend class OSQLAnalyzer;
      40             : 
      41             :             OCodeList                               m_aCodeList;
      42             :             OFileColumns                            m_orgColumns; // in filecurs this are the filecolumns
      43             :             OSQLAnalyzer*                           m_pAnalyzer;
      44             :             ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess> m_xIndexes;
      45             :             sal_Int32                               m_nParamCounter;
      46             :             bool                                m_bORCondition;
      47             :         public:
      48             :             OPredicateCompiler(OSQLAnalyzer* pAnalyzer);
      49             : 
      50             :             virtual ~OPredicateCompiler();
      51             : 
      52          58 :             inline static void * SAL_CALL operator new( size_t nSize )
      53          58 :                 { return ::rtl_allocateMemory( nSize ); }
      54             :             inline static void * SAL_CALL operator new( size_t /*nSize*/,void* _pHint )
      55             :                 { return _pHint; }
      56          58 :             inline static void SAL_CALL operator delete( void * pMem )
      57          58 :                 { ::rtl_freeMemory( pMem ); }
      58             :             inline static void SAL_CALL operator delete( void * /*pMem*/,void* /*_pHint*/ )
      59             :                 {  }
      60             :             void dispose();
      61             : 
      62             :             void start(connectivity::OSQLParseNode* pSQLParseNode);
      63             :             OOperand* execute(connectivity::OSQLParseNode* pPredicateNode);
      64             : 
      65             :             void Clean();
      66        2378 :             bool isClean() const {return m_aCodeList.empty();}
      67        2378 :             bool hasCode() const {return !isClean();}
      68             :             bool hasORCondition() const {return m_bORCondition;}
      69          58 :             void     setOrigColumns(const OFileColumns& rCols) { m_orgColumns = rCols; }
      70           0 :             const OFileColumns getOrigColumns() const { return m_orgColumns; }
      71             :         protected:
      72             :             OOperand* execute_COMPARE(connectivity::OSQLParseNode* pPredicateNode) throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
      73             :             OOperand* execute_LIKE(connectivity::OSQLParseNode* pPredicateNode) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
      74             :             OOperand* execute_BETWEEN(connectivity::OSQLParseNode* pPredicateNode) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
      75             :             OOperand* execute_ISNULL(connectivity::OSQLParseNode* pPredicateNode) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
      76             :             OOperand* execute_Operand(connectivity::OSQLParseNode* pPredicateNode) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
      77             :             OOperand* execute_Fold(OSQLParseNode* pPredicateNode) throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
      78             :             OOperand* executeFunction(OSQLParseNode* pPredicateNode) throw( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
      79             :         };
      80             : 
      81             : 
      82             :         class OPredicateInterpreter :
      83             :             public ::salhelper::SimpleReferenceObject
      84             :         {
      85             :             OCodeStack          m_aStack;
      86             :             ::rtl::Reference<OPredicateCompiler> m_rCompiler;
      87             : 
      88             :         public:
      89          58 :             OPredicateInterpreter(const ::rtl::Reference<OPredicateCompiler>& rComp) : m_rCompiler(rComp){}
      90             :             virtual ~OPredicateInterpreter();
      91             : 
      92             :             bool        evaluate(OCodeList& rCodeList);
      93             :             void        evaluateSelection(OCodeList& rCodeList,ORowSetValueDecoratorRef& _rVal);
      94             : 
      95          18 :             inline bool start()
      96             :             {
      97          18 :                 return evaluate(m_rCompiler->m_aCodeList);
      98             :             }
      99             : 
     100           0 :             inline void startSelection(ORowSetValueDecoratorRef& _rVal)
     101             :             {
     102           0 :                 evaluateSelection(m_rCompiler->m_aCodeList,_rVal);
     103           0 :             }
     104             : 
     105             : 
     106             :         };
     107             :     }
     108             : }
     109             : #endif // INCLUDED_CONNECTIVITY_SOURCE_INC_FILE_FCOMP_HXX
     110             : 
     111             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11