build fix
[LibreOffice.git] / connectivity / source / drivers / firebird / PreparedStatement.hxx
blob21f1d3b3183aa32b67f89443db06580eafb66d20
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_PREPAREDSTATEMENT_HXX
21 #define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_FIREBIRD_PREPAREDSTATEMENT_HXX
23 #include "Statement.hxx"
25 #include <cppuhelper/implbase5.hxx>
27 #include <com/sun/star/sdbc/XPreparedStatement.hpp>
28 #include <com/sun/star/sdbc/XParameters.hpp>
29 #include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp>
30 #include <com/sun/star/sdbc/XPreparedBatchExecution.hpp>
31 #include <com/sun/star/io/XInputStream.hpp>
33 #include <ibase.h>
35 namespace connectivity
37 namespace firebird
40 class OBoundParam;
41 typedef ::cppu::ImplHelper5< css::sdbc::XPreparedStatement,
42 css::sdbc::XParameters,
43 css::sdbc::XPreparedBatchExecution,
44 css::sdbc::XResultSetMetaDataSupplier,
45 css::lang::XServiceInfo> OPreparedStatement_Base;
47 class OPreparedStatement : public OStatementCommonBase,
48 public OPreparedStatement_Base
50 protected:
51 ::rtl::OUString m_sSqlStatement;
52 css::uno::Reference< css::sdbc::XResultSetMetaData > m_xMetaData;
54 XSQLDA* m_pOutSqlda;
55 XSQLDA* m_pInSqlda;
56 void checkParameterIndex(sal_Int32 nParameterIndex)
57 throw(css::sdbc::SQLException,
58 css::uno::RuntimeException);
60 /**
61 * Set a numeric value in the input SQLDA. If the destination
62 * parameter is not of nType then an Exception will be thrown.
64 template <typename T> void setValue(sal_Int32 nIndex, T& nValue, ISC_SHORT nType)
65 throw(css::sdbc::SQLException,
66 css::uno::RuntimeException);
67 void setParameterNull(sal_Int32 nParameterIndex, bool bSetNull = true);
69 void ensurePrepared()
70 throw(css::sdbc::SQLException,
71 css::uno::RuntimeException);
72 /**
73 * Assumes that all necessary mutexes have been taken.
75 void openBlobForWriting(isc_blob_handle& rBlobHandle, ISC_QUAD& rBlobId);
76 /**
77 * Assumes that all necessary mutexes have been taken.
79 void closeBlobAfterWriting(isc_blob_handle& rBlobHandle);
81 protected:
82 virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,
83 const css::uno::Any& rValue)
84 throw (css::uno::Exception, std::exception) override;
85 virtual ~OPreparedStatement() override;
86 public:
87 DECLARE_SERVICE_INFO();
88 // a constructor, which is required for returning objects:
89 OPreparedStatement( Connection* _pConnection,
90 const ::rtl::OUString& sql);
92 //XInterface
93 virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) throw(css::uno::RuntimeException, std::exception) override;
94 virtual void SAL_CALL acquire() throw() override;
95 virtual void SAL_CALL release() throw() override;
96 //XTypeProvider
97 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) throw(css::uno::RuntimeException, std::exception) override;
99 // XPreparedStatement
100 virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL
101 executeQuery()
102 throw(css::sdbc::SQLException,
103 css::uno::RuntimeException, std::exception) override;
104 virtual sal_Int32 SAL_CALL
105 executeUpdate()
106 throw(css::sdbc::SQLException,
107 css::uno::RuntimeException, std::exception) override;
108 virtual sal_Bool SAL_CALL
109 execute()
110 throw(css::sdbc::SQLException,
111 css::uno::RuntimeException, std::exception) override;
112 virtual css::uno::Reference< css::sdbc::XConnection > SAL_CALL
113 getConnection()
114 throw(css::sdbc::SQLException,
115 css::uno::RuntimeException, std::exception) override;
117 // XParameters
118 virtual void SAL_CALL setNull(sal_Int32 nIndex, sal_Int32 nValue)
119 throw(css::sdbc::SQLException,
120 css::uno::RuntimeException, std::exception) override;
121 virtual void SAL_CALL setObjectNull(sal_Int32 parameterIndex, sal_Int32 sqlType, const ::rtl::OUString& typeName ) throw(css::sdbc::SQLException, css::uno::RuntimeException, std::exception) override;
122 virtual void SAL_CALL setBoolean( sal_Int32 nIndex, sal_Bool nValue)
123 throw(css::sdbc::SQLException,
124 css::uno::RuntimeException, std::exception) override;
125 virtual void SAL_CALL setByte(sal_Int32 nIndex, sal_Int8 nValue)
126 throw(css::sdbc::SQLException,
127 css::uno::RuntimeException, std::exception) override;
128 virtual void SAL_CALL setShort(sal_Int32 nIndex, sal_Int16 nValue)
129 throw(css::sdbc::SQLException,
130 css::uno::RuntimeException, std::exception) override;
131 virtual void SAL_CALL setInt(sal_Int32 nIndex, sal_Int32 nValue)
132 throw(css::sdbc::SQLException,
133 css::uno::RuntimeException, std::exception) override;
134 virtual void SAL_CALL setLong(sal_Int32 nIndex, sal_Int64 nValue)
135 throw(css::sdbc::SQLException,
136 css::uno::RuntimeException, std::exception) override;
137 virtual void SAL_CALL setFloat( sal_Int32 parameterIndex, float x ) throw(css::sdbc::SQLException, css::uno::RuntimeException, std::exception) override;
138 virtual void SAL_CALL setDouble( sal_Int32 parameterIndex, double x ) throw(css::sdbc::SQLException, css::uno::RuntimeException, std::exception) override;
139 virtual void SAL_CALL setString( sal_Int32 parameterIndex, const ::rtl::OUString& x ) throw(css::sdbc::SQLException, css::uno::RuntimeException, std::exception) override;
140 virtual void SAL_CALL setBytes( sal_Int32 parameterIndex, const css::uno::Sequence< sal_Int8 >& x ) throw(css::sdbc::SQLException, css::uno::RuntimeException, std::exception) override;
141 virtual void SAL_CALL setDate( sal_Int32 parameterIndex, const css::util::Date& x ) throw(css::sdbc::SQLException, css::uno::RuntimeException, std::exception) override;
142 virtual void SAL_CALL setTime( sal_Int32 parameterIndex, const css::util::Time& x ) throw(css::sdbc::SQLException, css::uno::RuntimeException, std::exception) override;
143 virtual void SAL_CALL setTimestamp( sal_Int32 parameterIndex, const css::util::DateTime& x ) throw(css::sdbc::SQLException, css::uno::RuntimeException, std::exception) override;
144 virtual void SAL_CALL setBinaryStream( sal_Int32 parameterIndex, const css::uno::Reference< css::io::XInputStream >& x, sal_Int32 length ) throw(css::sdbc::SQLException, css::uno::RuntimeException, std::exception) override;
145 virtual void SAL_CALL setCharacterStream( sal_Int32 parameterIndex, const css::uno::Reference< css::io::XInputStream >& x, sal_Int32 length ) throw(css::sdbc::SQLException, css::uno::RuntimeException, std::exception) override;
146 virtual void SAL_CALL setObject( sal_Int32 parameterIndex, const css::uno::Any& x ) throw(css::sdbc::SQLException, css::uno::RuntimeException, std::exception) override;
147 virtual void SAL_CALL setObjectWithInfo( sal_Int32 parameterIndex, const css::uno::Any& x, sal_Int32 targetSqlType, sal_Int32 scale ) throw(css::sdbc::SQLException, css::uno::RuntimeException, std::exception) override;
148 virtual void SAL_CALL setRef( sal_Int32 parameterIndex, const css::uno::Reference< css::sdbc::XRef >& x ) throw(css::sdbc::SQLException, css::uno::RuntimeException, std::exception) override;
149 virtual void SAL_CALL setBlob( sal_Int32 parameterIndex, const css::uno::Reference< css::sdbc::XBlob >& x ) throw(css::sdbc::SQLException, css::uno::RuntimeException, std::exception) override;
150 virtual void SAL_CALL setClob( sal_Int32 parameterIndex, const css::uno::Reference< css::sdbc::XClob >& x ) throw(css::sdbc::SQLException, css::uno::RuntimeException, std::exception) override;
151 virtual void SAL_CALL setArray( sal_Int32 parameterIndex, const css::uno::Reference< css::sdbc::XArray >& x ) throw(css::sdbc::SQLException, css::uno::RuntimeException, std::exception) override;
152 virtual void SAL_CALL clearParameters( ) throw(css::sdbc::SQLException, css::uno::RuntimeException, std::exception) override;
154 // XPreparedBatchExecution -- UNSUPPORTED by firebird
155 virtual void SAL_CALL
156 addBatch()
157 throw(css::sdbc::SQLException,
158 css::uno::RuntimeException, std::exception) override;
159 virtual void SAL_CALL
160 clearBatch()
161 throw(css::sdbc::SQLException,
162 css::uno::RuntimeException, std::exception) override;
163 virtual css::uno::Sequence< sal_Int32 > SAL_CALL
164 executeBatch()
165 throw(css::sdbc::SQLException,
166 css::uno::RuntimeException, std::exception) override;
168 // XCloseable
169 virtual void SAL_CALL close()
170 throw(css::sdbc::SQLException,
171 css::uno::RuntimeException, std::exception) override;
172 // OComponentHelper
173 virtual void SAL_CALL disposing() override;
175 // XResultSetMetaDataSupplier
176 virtual css::uno::Reference< css::sdbc::XResultSetMetaData > SAL_CALL getMetaData( ) throw(css::sdbc::SQLException, css::uno::RuntimeException, std::exception) override;
181 #endif // INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_FIREBIRD_PREPAREDSTATEMENT_HXX
183 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */