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 INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_FIREBIRD_STATEMENTCOMMONBASE_HXX
21 : #define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_FIREBIRD_STATEMENTCOMMONBASE_HXX
22 :
23 : #include "Connection.hxx"
24 :
25 : #include <ibase.h>
26 :
27 : #include <connectivity/OSubComponent.hxx>
28 : #include <cppuhelper/compbase4.hxx>
29 : #include <list>
30 :
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>
39 :
40 : namespace connectivity
41 : {
42 : namespace firebird
43 : {
44 :
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;
49 :
50 : class OStatementCommonBase : public OStatementCommonBase_Base,
51 : public ::cppu::OPropertySetHelper,
52 : public OPropertyArrayUsageHelper<OStatementCommonBase>
53 :
54 : {
55 : protected:
56 : ::osl::Mutex m_aMutex;
57 :
58 : ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet> m_xResultSet; // The last ResultSet created
59 : // for this Statement
60 :
61 : ::std::list< ::rtl::OUString> m_aBatchList;
62 :
63 : ::rtl::Reference<Connection> m_pConnection;
64 :
65 : ISC_STATUS_ARRAY m_statusVector;
66 : isc_stmt_handle m_aStatementHandle;
67 :
68 : protected:
69 : virtual void disposeResultSet();
70 : void freeStatementHandle()
71 : throw (::com::sun::star::sdbc::SQLException);
72 :
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();
91 :
92 : void prepareAndDescribeStatement(const OUString& sqlIn,
93 : XSQLDA*& pOutSqlda,
94 : XSQLDA* pInSqlda=0)
95 : throw (::com::sun::star::sdbc::SQLException);
96 :
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);
103 :
104 : public:
105 :
106 : ::cppu::OBroadcastHelper& rBHelper;
107 : OStatementCommonBase(Connection* _pConnection);
108 : using OStatementCommonBase_Base::operator ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >;
109 :
110 : // OComponentHelper
111 0 : virtual void SAL_CALL disposing(void) SAL_OVERRIDE {
112 0 : disposeResultSet();
113 0 : OStatementCommonBase_Base::disposing();
114 0 : }
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;
122 :
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;
125 :
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;
133 :
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;
138 :
139 : };
140 : }
141 : }
142 :
143 : #endif // INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_FIREBIRD_STATEMENTCOMMONBASE_HXX
144 :
145 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|