LCOV - code coverage report
Current view: top level - connectivity/source/drivers/mork - MStatement.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 2 0.0 %
Date: 2014-04-14 Functions: 0 3 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             : #ifndef CONNECTIVITY_SSTATEMENT_HXX
      20             : #define CONNECTIVITY_SSTATEMENT_HXX
      21             : 
      22             : #include <com/sun/star/sdbc/XStatement.hpp>
      23             : #include <com/sun/star/sdbc/XWarningsSupplier.hpp>
      24             : #include <com/sun/star/sdbc/XBatchExecution.hpp>
      25             : #include <com/sun/star/sdbc/XCloseable.hpp>
      26             : #include <com/sun/star/sdbc/SQLWarning.hpp>
      27             : #include <comphelper/proparrhlp.hxx>
      28             : #include <cppuhelper/compbase3.hxx>
      29             : #include <comphelper/uno3.hxx>
      30             : #include "connectivity/CommonTools.hxx"
      31             : #include <list>
      32             : #include <com/sun/star/lang/XServiceInfo.hpp>
      33             : #include <comphelper/broadcasthelper.hxx>
      34             : #include "connectivity/sqliterator.hxx"
      35             : #include "connectivity/sqlparse.hxx"
      36             : #include <connectivity/FValue.hxx>
      37             : #include "TSortIndex.hxx"
      38             : #include "MConnection.hxx"
      39             : #include "MTable.hxx"
      40             : 
      41             : #include <boost/shared_ptr.hpp>
      42             : 
      43             : namespace connectivity
      44             : {
      45             :     namespace mork
      46             :     {
      47             :         class OResultSet;
      48             : 
      49             :         typedef ::cppu::WeakComponentImplHelper3<   ::com::sun::star::sdbc::XStatement,
      50             :                                                     ::com::sun::star::sdbc::XWarningsSupplier,
      51             :                                                     ::com::sun::star::sdbc::XCloseable> OCommonStatement_IBASE;
      52             : 
      53             : 
      54             :         //************ Class: OCommonStatement
      55             :         // is a base class for the normal statement and for the prepared statement
      56             : 
      57             :         class OCommonStatement;
      58             :         typedef ::connectivity::OSubComponent< OCommonStatement, OCommonStatement_IBASE >  OCommonStatement_SBASE;
      59             : 
      60             :         class OCommonStatement  :public comphelper::OBaseMutex
      61             :                                 ,public OCommonStatement_IBASE
      62             :                                 ,public ::cppu::OPropertySetHelper
      63             :                                 ,public ::comphelper::OPropertyArrayUsageHelper< OCommonStatement >
      64             :                                 ,public OCommonStatement_SBASE
      65             :         {
      66             :             friend class ::connectivity::OSubComponent< OCommonStatement, OCommonStatement_IBASE >;
      67             : 
      68             :         private:
      69             :             ::com::sun::star::sdbc::SQLWarning                            m_aLastWarning;
      70             : 
      71             :         protected:
      72             :             ::com::sun::star::uno::WeakReference< ::com::sun::star::sdbc::XResultSet >   m_xResultSet;
      73             :             ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData> m_xDBMetaData;
      74             :             ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess>  m_xColNames; // table columns
      75             : 
      76             :             //  for this Statement
      77             : 
      78             :             ::std::list< OUString>               m_aBatchList;
      79             : 
      80             :             OTable*                                     m_pTable;
      81             :             OConnection*                                m_pConnection;  // The owning Connection object
      82             : 
      83             :             OValueRow                                   m_aRow;
      84             : 
      85             :             connectivity::OSQLParser                    m_aParser;
      86             :             ::boost::shared_ptr< ::connectivity::OSQLParseTreeIterator >
      87             :                                                         m_pSQLIterator;
      88             : 
      89             :             connectivity::OSQLParseNode*                m_pParseTree;
      90             : 
      91             :             ::std::vector<sal_Int32>                    m_aColMapping;
      92             :             ::std::vector<sal_Int32>                    m_aOrderbyColumnNumber;
      93             :             ::std::vector<TAscendingOrder>              m_aOrderbyAscending;
      94             : 
      95             :             ::cppu::OBroadcastHelper&                   rBHelper;
      96             : 
      97             :         protected:
      98             : 
      99             :             // OPropertyArrayUsageHelper
     100             :             virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const SAL_OVERRIDE;
     101             :             // OPropertySetHelper
     102             :             virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() SAL_OVERRIDE;
     103             :             virtual sal_Bool SAL_CALL convertFastPropertyValue(
     104             :                                                                 ::com::sun::star::uno::Any & rConvertedValue,
     105             :                                                                 ::com::sun::star::uno::Any & rOldValue,
     106             :                                                                 sal_Int32 nHandle,
     107             :                                                                 const ::com::sun::star::uno::Any& rValue )
     108             :                                                             throw (::com::sun::star::lang::IllegalArgumentException) SAL_OVERRIDE;
     109             :             virtual void SAL_CALL setFastPropertyValue_NoBroadcast(
     110             :                                                                 sal_Int32 nHandle,
     111             :                                                                 const ::com::sun::star::uno::Any& rValue)   throw (::com::sun::star::uno::Exception, std::exception) SAL_OVERRIDE;
     112             :             virtual void SAL_CALL getFastPropertyValue(
     113             :                                                                 ::com::sun::star::uno::Any& rValue,
     114             :                                                                 sal_Int32 nHandle) const SAL_OVERRIDE;
     115             :             virtual ~OCommonStatement();
     116             : 
     117             :         protected:
     118             : 
     119             :             // Driver Internal Methods
     120             : 
     121             :             enum StatementType { eSelect, eCreateTable };
     122             :             /** called to do the parsing of a to-be-executed SQL statement, and set all members as needed
     123             :             */
     124             :             virtual StatementType
     125             :                             parseSql( const OUString& sql , sal_Bool bAdjusted = sal_False) throw ( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
     126             :             /** called to initialize a result set, according to a previously parsed SQL statement
     127             :             */
     128             :             virtual void    initializeResultSet( OResultSet* _pResult );
     129             :             /** called when a possible cached instance of our last result set should be cleared
     130             :             */
     131             :             virtual void    clearCachedResultSet();
     132             :             /** caches a result set which has just been created by an execution of an SQL statement
     133             :             */
     134             :             virtual void    cacheResultSet( const ::rtl::Reference< OResultSet >& _pResult );
     135             : 
     136             : 
     137             :             /** executes the current query (the one which has been passed to the last parseSql call)
     138             :             */
     139             :             ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet >
     140             :                             impl_executeCurrentQuery();
     141             : 
     142             :             void         createColumnMapping();
     143             :             void         analyseSQL();
     144             :             void         setOrderbyColumn( connectivity::OSQLParseNode* pColumnRef,
     145             :                                            connectivity::OSQLParseNode* pAscendingDescending);
     146             :             virtual void createTable(  ) throw (
     147             :                         ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
     148             : 
     149             :         public:
     150             :             // other methods
     151           0 :             OConnection* getOwnConnection() const { return m_pConnection;}
     152             : 
     153             :             OCommonStatement(OConnection* _pConnection );
     154             :             using OCommonStatement_IBASE::operator ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >;
     155             : 
     156             :             // OComponentHelper
     157             :             virtual void SAL_CALL disposing(void) SAL_OVERRIDE;
     158             : 
     159             :             // XInterface
     160             :             virtual void SAL_CALL release() throw() SAL_OVERRIDE;
     161             :             virtual void SAL_CALL acquire() throw() SAL_OVERRIDE;
     162             :             // XInterface
     163             :             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;
     164             :             //XTypeProvider
     165             :             virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes(  ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     166             : 
     167             :             // XPropertySet
     168             :             virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo(  ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     169             :             // XStatement
     170             :             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 ;
     171             :             virtual sal_Int32 SAL_CALL executeUpdate( const OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE ;
     172             :             virtual sal_Bool SAL_CALL execute( const OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE ;
     173             :             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 ;
     174             :             // XWarningsSupplier
     175             :             virtual ::com::sun::star::uno::Any SAL_CALL getWarnings(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     176             :             virtual void SAL_CALL clearWarnings(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     177             :             // XCloseable
     178             :             virtual void SAL_CALL close(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     179             : 
     180             :         protected:
     181             :             using OPropertySetHelper::getFastPropertyValue;
     182             :         };
     183             : 
     184             :         class OStatement :  public OCommonStatement,
     185             :                             public ::com::sun::star::lang::XServiceInfo
     186             :         {
     187             :         protected:
     188           0 :             virtual ~OStatement(){}
     189             :         public:
     190             :             // a constructor, for when the object needs to be returned:
     191             :             OStatement( OConnection* _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             :     }
     199             : }
     200             : #endif // CONNECTIVITY_SSTATEMENT_HXX
     201             : 
     202             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10