LCOV - code coverage report
Current view: top level - connectivity/source/inc/file - FStatement.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 7 0.0 %
Date: 2014-04-14 Functions: 0 8 0.0 %
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             : 
      20             : #ifndef _CONNECTIVITY_FILE_OSTATEMENT_HXX_
      21             : #define _CONNECTIVITY_FILE_OSTATEMENT_HXX_
      22             : 
      23             : #include <com/sun/star/sdbc/XStatement.hpp>
      24             : #include <com/sun/star/sdbc/XWarningsSupplier.hpp>
      25             : #include <com/sun/star/sdbc/XMultipleResults.hpp>
      26             : #include <com/sun/star/sdbc/XBatchExecution.hpp>
      27             : #include <com/sun/star/sdbc/XCloseable.hpp>
      28             : #include <com/sun/star/sdbc/SQLWarning.hpp>
      29             : #include <com/sun/star/util/XCancellable.hpp>
      30             : #include <comphelper/proparrhlp.hxx>
      31             : #include <cppuhelper/compbase3.hxx>
      32             : #include <cppuhelper/implbase2.hxx>
      33             : #include <comphelper/uno3.hxx>
      34             : #include "connectivity/CommonTools.hxx"
      35             : #include "file/FConnection.hxx"
      36             : #include "file/filedllapi.hxx"
      37             : #include <list>
      38             : #include <com/sun/star/lang/XServiceInfo.hpp>
      39             : #include <comphelper/propertycontainer.hxx>
      40             : #include "file/fanalyzer.hxx"
      41             : #include <comphelper/broadcasthelper.hxx>
      42             : #include "TSortIndex.hxx"
      43             : 
      44             : namespace connectivity
      45             : {
      46             :     namespace file
      47             :     {
      48             :         class OResultSet;
      49             :         class OFileTable;
      50             :         typedef ::cppu::WeakComponentImplHelper3<   ::com::sun::star::sdbc::XWarningsSupplier,
      51             :                                                     ::com::sun::star::util::XCancellable,
      52             :                                                     ::com::sun::star::sdbc::XCloseable> OStatement_BASE;
      53             : 
      54             : 
      55             :         //************ Class: java.sql.Statement
      56             : 
      57             :         class OOO_DLLPUBLIC_FILE OStatement_Base :
      58             :                                         public  comphelper::OBaseMutex,
      59             :                                         public  OStatement_BASE,
      60             :                                         public  ::comphelper::OPropertyContainer,
      61             :                                         public  ::comphelper::OPropertyArrayUsageHelper<OStatement_Base>
      62             : 
      63             :         {
      64             :         protected:
      65             :             ::std::vector<sal_Int32>                    m_aColMapping; // pos 0 is unused so we don't have to decrement 1 everytime
      66             :             ::std::vector<sal_Int32>                    m_aParameterIndexes; // maps the parameter index to column index
      67             :             ::std::vector<sal_Int32>                    m_aOrderbyColumnNumber;
      68             :             ::std::vector<TAscendingOrder>              m_aOrderbyAscending;
      69             : 
      70             :             ::com::sun::star::sdbc::SQLWarning                                           m_aLastWarning;
      71             :             ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData> m_xDBMetaData;
      72             :             ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess>  m_xColNames; // table columns                                                          //  for this Statement
      73             : 
      74             : 
      75             :             connectivity::OSQLParser                    m_aParser;
      76             :             connectivity::OSQLParseTreeIterator         m_aSQLIterator;
      77             : 
      78             :             OConnection*                                m_pConnection;// The owning Connection object
      79             :             connectivity::OSQLParseNode*                m_pParseTree;
      80             :             OSQLAnalyzer*                               m_pSQLAnalyzer; //the sql analyzer used by the resultset
      81             : 
      82             :             ::std::vector<sal_Int32>*                   m_pEvaluationKeySet;
      83             : 
      84             :             OFileTable*                                 m_pTable;       // the current table
      85             :             OValueRefRow                                m_aSelectRow;
      86             :             OValueRefRow                                m_aRow;
      87             :             OValueRefRow                                m_aEvaluateRow; // contains all values of a row
      88             :             ORefAssignValues                            m_aAssignValues; // needed for insert,update and parameters
      89             :                                                                     // to compare with the restrictions
      90             : 
      91             :             OUString                             m_aCursorName;
      92             :             sal_Int32                                   m_nMaxFieldSize;
      93             :             sal_Int32                                   m_nMaxRows;
      94             :             sal_Int32                                   m_nQueryTimeOut;
      95             :             sal_Int32                                   m_nFetchSize;
      96             :             sal_Int32                                   m_nResultSetType;
      97             :             sal_Int32                                   m_nFetchDirection;
      98             :             sal_Int32                                   m_nResultSetConcurrency;
      99             :             sal_Bool                                    m_bEscapeProcessing;
     100             : 
     101             :             ::cppu::OBroadcastHelper&                   rBHelper;
     102             : 
     103             :         protected:
     104             :             // initialize the column index map (mapping select columns to table columns)
     105             :             void createColumnMapping();
     106             :             // searches the statement for sort criteria
     107             :             void anylizeSQL();
     108             :             void setOrderbyColumn( connectivity::OSQLParseNode* pColumnRef,
     109             :                                      connectivity::OSQLParseNode* pAscendingDescending);
     110             : 
     111             :             virtual void initializeResultSet(OResultSet* _pResult);
     112             :             // create the analyzer
     113             :             virtual OSQLAnalyzer* createAnalyzer();
     114             : 
     115             :             void reset () throw( ::com::sun::star::sdbc::SQLException);
     116             :             sal_Int32 getPrecision ( sal_Int32 sqlType);
     117             : 
     118             :             void GetAssignValues();
     119             :             void SetAssignValue(const OUString& aColumnName,
     120             :                                    const OUString& aValue,
     121             :                                    sal_Bool bSetNull = sal_False,
     122             :                                    sal_uInt32 nParameter=SQL_NO_PARAMETER);
     123             :             void ParseAssignValues( const ::std::vector< OUString>& aColumnNameList,
     124             :                                     connectivity::OSQLParseNode* pRow_Value_Constructor_Elem, sal_Int32 nIndex);
     125             : 
     126             :             virtual void parseParamterElem(const OUString& _sColumnName,OSQLParseNode* pRow_Value_Constructor_Elem);
     127             :             // factory method for resultset's
     128             :             virtual OResultSet* createResultSet() = 0;
     129             :             // OPropertyArrayUsageHelper
     130             :             virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const SAL_OVERRIDE;
     131             :             // OPropertySetHelper
     132             :             virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() SAL_OVERRIDE;
     133             :             virtual ~OStatement_Base();
     134             :         public:
     135           0 :             connectivity::OSQLParseNode* getParseTree() const { return m_pParseTree;}
     136             : 
     137             :             OStatement_Base(OConnection* _pConnection );
     138             : 
     139           0 :             OConnection* getOwnConnection() const { return m_pConnection;}
     140             : 
     141             :             using OStatement_BASE::operator ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >;
     142             : 
     143             :             virtual void construct(const OUString& sql)  throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
     144             : 
     145             :             // OComponentHelper
     146             :             virtual void SAL_CALL disposing(void) SAL_OVERRIDE;
     147             :             // XInterface
     148             :             //      virtual void SAL_CALL release() throw(::com::sun::star::uno::RuntimeException) = 0;
     149             :             virtual void SAL_CALL acquire() throw() SAL_OVERRIDE;
     150             :             // XInterface
     151             :             virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     152             :             //XTypeProvider
     153             :             virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes(  ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     154             : 
     155             :             // XPropertySet
     156             :             virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo(  ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     157             :             // XWarningsSupplier
     158             :             virtual ::com::sun::star::uno::Any SAL_CALL getWarnings(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     159             :             virtual void SAL_CALL clearWarnings(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     160             :             // XCancellable
     161             :             virtual void SAL_CALL cancel(  ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     162             :             // XCloseable
     163             :             virtual void SAL_CALL close(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     164             :         };
     165             : 
     166           0 :         class OOO_DLLPUBLIC_FILE OStatement_BASE2 :
     167             :                                     public OStatement_Base,
     168             :                                     public connectivity::OSubComponent<OStatement_BASE2, OStatement_BASE>
     169             : 
     170             :         {
     171             :             friend class connectivity::OSubComponent<OStatement_BASE2, OStatement_BASE>;
     172             :         public:
     173           0 :             OStatement_BASE2(OConnection* _pConnection ) :  OStatement_Base(_pConnection ),
     174           0 :                                     connectivity::OSubComponent<OStatement_BASE2, OStatement_BASE>((::cppu::OWeakObject*)_pConnection, this){}
     175             :             // OComponentHelper
     176             :             virtual void SAL_CALL disposing(void) SAL_OVERRIDE;
     177             :             // XInterface
     178             :             virtual void SAL_CALL release() throw() SAL_OVERRIDE;
     179             :         };
     180             : 
     181             :         typedef ::cppu::ImplHelper2< ::com::sun::star::sdbc::XStatement,::com::sun::star::lang::XServiceInfo > OStatement_XStatement;
     182           0 :         class OOO_DLLPUBLIC_FILE OStatement :
     183             :                             public OStatement_BASE2,
     184             :                             public OStatement_XStatement
     185             :         {
     186             :         protected:
     187             :             // factory method for resultset's
     188             :             virtual OResultSet* createResultSet() SAL_OVERRIDE;
     189             :         public:
     190             :             // a Constructor, that is needed for when Returning the Object is needed:
     191           0 :             OStatement( OConnection* _pConnection) : OStatement_BASE2( _pConnection){}
     192             :             DECLARE_SERVICE_INFO();
     193             : 
     194             :             virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     195             :             virtual void SAL_CALL acquire() throw() SAL_OVERRIDE;
     196             :             virtual void SAL_CALL release() throw() SAL_OVERRIDE;
     197             : 
     198             :             // XStatement
     199             :             virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL executeQuery( const OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE ;
     200             :             virtual sal_Int32 SAL_CALL executeUpdate( const OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE ;
     201             :             virtual sal_Bool SAL_CALL execute( const OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE ;
     202             :             virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL getConnection(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE ;
     203             :         };
     204             :     }
     205             : }
     206             : #endif // _CONNECTIVITY_FILE_OSTATEMENT_HXX_
     207             : 
     208             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10