Version 4.3.0.0.beta1, tag libreoffice-4.3.0.0.beta1
[LibreOffice.git] / connectivity / source / drivers / firebird / StatementCommonBase.hxx
blob3591d22307f56d717d0dd7728537ca789999ec28
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_FIREBIRD_STATEMENTCOMMONBASE_HXX
21 #define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_FIREBIRD_STATEMENTCOMMONBASE_HXX
23 #include "Connection.hxx"
25 #include <ibase.h>
27 #include <connectivity/OSubComponent.hxx>
28 #include <cppuhelper/compbase4.hxx>
29 #include <list>
31 #include <com/sun/star/lang/XServiceInfo.hpp>
32 #include <com/sun/star/sdbc/SQLWarning.hpp>
33 #include <com/sun/star/sdbc/XBatchExecution.hpp>
34 #include <com/sun/star/sdbc/XCloseable.hpp>
35 #include <com/sun/star/sdbc/XMultipleResults.hpp>
36 #include <com/sun/star/sdbc/XStatement.hpp>
37 #include <com/sun/star/sdbc/XWarningsSupplier.hpp>
38 #include <com/sun/star/util/XCancellable.hpp>
40 namespace connectivity
42 namespace firebird
45 typedef ::cppu::WeakComponentImplHelper4< ::com::sun::star::sdbc::XWarningsSupplier,
46 ::com::sun::star::util::XCancellable,
47 ::com::sun::star::sdbc::XCloseable,
48 ::com::sun::star::sdbc::XMultipleResults> OStatementCommonBase_Base;
50 class OStatementCommonBase : public OStatementCommonBase_Base,
51 public ::cppu::OPropertySetHelper,
52 public OPropertyArrayUsageHelper<OStatementCommonBase>
55 protected:
56 ::osl::Mutex m_aMutex;
58 ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet> m_xResultSet; // The last ResultSet created
59 // for this Statement
61 ::std::list< ::rtl::OUString> m_aBatchList;
63 Connection* m_pConnection;
65 ISC_STATUS_ARRAY m_statusVector;
66 isc_stmt_handle m_aStatementHandle;
68 protected:
69 virtual void disposeResultSet();
70 void freeStatementHandle()
71 throw (::com::sun::star::sdbc::SQLException);
73 // OPropertyArrayUsageHelper
74 virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const SAL_OVERRIDE;
75 // OPropertySetHelper
76 using OPropertySetHelper::getFastPropertyValue;
77 virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() SAL_OVERRIDE;
78 virtual sal_Bool SAL_CALL convertFastPropertyValue(
79 ::com::sun::star::uno::Any & rConvertedValue,
80 ::com::sun::star::uno::Any & rOldValue,
81 sal_Int32 nHandle,
82 const ::com::sun::star::uno::Any& rValue )
83 throw (::com::sun::star::lang::IllegalArgumentException) SAL_OVERRIDE;
84 virtual void SAL_CALL setFastPropertyValue_NoBroadcast(
85 sal_Int32 nHandle,
86 const ::com::sun::star::uno::Any& rValue) throw (::com::sun::star::uno::Exception, std::exception) SAL_OVERRIDE;
87 virtual void SAL_CALL getFastPropertyValue(
88 ::com::sun::star::uno::Any& rValue,
89 sal_Int32 nHandle) const SAL_OVERRIDE;
90 virtual ~OStatementCommonBase();
92 void prepareAndDescribeStatement(const OUString& sqlIn,
93 XSQLDA*& pOutSqlda,
94 XSQLDA* pInSqlda=0)
95 throw (::com::sun::star::sdbc::SQLException);
97 short getSqlInfoItem(char aInfoItem)
98 throw (::com::sun::star::sdbc::SQLException);
99 bool isDDLStatement()
100 throw (::com::sun::star::sdbc::SQLException);
101 sal_Int32 getStatementChangeCount()
102 throw (::com::sun::star::sdbc::SQLException);
104 public:
106 ::cppu::OBroadcastHelper& rBHelper;
107 OStatementCommonBase(Connection* _pConnection);
108 using OStatementCommonBase_Base::operator ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >;
110 // OComponentHelper
111 virtual void SAL_CALL disposing(void) SAL_OVERRIDE {
112 disposeResultSet();
113 OStatementCommonBase_Base::disposing();
115 // XInterface
116 virtual void SAL_CALL release() throw() SAL_OVERRIDE;
117 virtual void SAL_CALL acquire() throw() SAL_OVERRIDE;
118 // XInterface
119 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;
120 //XTypeProvider
121 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
123 // XPropertySet
124 virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
126 // XWarningsSupplier - UNSUPPORTED
127 virtual ::com::sun::star::uno::Any SAL_CALL getWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
128 virtual void SAL_CALL clearWarnings( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
129 // XMultipleResults - UNSUPPORTED
130 virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL getResultSet( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
131 virtual sal_Int32 SAL_CALL getUpdateCount( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
132 virtual sal_Bool SAL_CALL getMoreResults( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
134 // XCancellable
135 virtual void SAL_CALL cancel( ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
136 // XCloseable
137 virtual void SAL_CALL close( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
139 // other methods
140 Connection* getOwnConnection() const { return m_pConnection;}
146 #endif // INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_FIREBIRD_STATEMENTCOMMONBASE_HXX
148 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */