bump product version to 6.3.0.0.beta1
[LibreOffice.git] / connectivity / source / drivers / mysqlc / mysqlc_preparedstatement.hxx
blob1df2c704a38dc2af5ffc5b5542f8d764c2e4939a
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_MYSQLC_SOURCE_MYSQLC_PREPAREDSTATEMENT_HXX
21 #define INCLUDED_MYSQLC_SOURCE_MYSQLC_PREPAREDSTATEMENT_HXX
22 #include "mysqlc_statement.hxx"
23 #include "mysqlc_resultset.hxx"
25 #include <com/sun/star/sdbc/XPreparedStatement.hpp>
26 #include <com/sun/star/sdbc/XParameters.hpp>
27 #include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp>
28 #include <com/sun/star/sdbc/XPreparedBatchExecution.hpp>
29 #include <com/sun/star/io/XInputStream.hpp>
31 namespace connectivity
33 namespace mysqlc
35 using ::com::sun::star::sdbc::SQLException;
36 using ::com::sun::star::sdbc::XResultSetMetaData;
37 using ::com::sun::star::uno::Any;
38 using ::com::sun::star::uno::Reference;
39 using ::com::sun::star::uno::RuntimeException;
40 using ::com::sun::star::uno::Type;
42 struct BindMetaData
44 char is_null = 0;
45 unsigned long length = 0;
46 char error = 0;
49 typedef ::cppu::ImplHelper5<css::sdbc::XPreparedStatement, css::sdbc::XParameters,
50 css::sdbc::XPreparedBatchExecution,
51 css::sdbc::XResultSetMetaDataSupplier, css::lang::XServiceInfo>
52 OPreparedStatement_BASE;
54 class OPreparedStatement final : public OCommonStatement, public OPreparedStatement_BASE
56 unsigned int m_paramCount = 0; // number of placeholders
57 Reference<XResultSetMetaData> m_xMetaData;
58 MYSQL_STMT* m_pStmt;
59 std::vector<MYSQL_BIND> m_binds;
60 std::vector<BindMetaData> m_bindMetas;
62 void checkParameterIndex(sal_Int32 parameter);
64 void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, const Any& rValue) override;
65 virtual ~OPreparedStatement() override;
67 public:
68 virtual OUString SAL_CALL getImplementationName() override;
70 virtual sal_Bool SAL_CALL supportsService(OUString const& ServiceName) override;
72 virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
74 OPreparedStatement(OConnection* _pConnection, MYSQL_STMT* pStmt);
76 //XInterface
77 Any SAL_CALL queryInterface(const Type& rType) override;
78 void SAL_CALL acquire() throw() override;
79 void SAL_CALL release() throw() override;
81 //XTypeProvider
82 css::uno::Sequence<Type> SAL_CALL getTypes() override;
84 // XPreparedStatement
85 Reference<css::sdbc::XResultSet> SAL_CALL executeQuery() override;
86 sal_Int32 SAL_CALL executeUpdate() override;
87 sal_Bool SAL_CALL execute() override;
88 Reference<css::sdbc::XConnection> SAL_CALL getConnection() override;
90 // XStatement
91 using OCommonStatement::execute;
92 using OCommonStatement::executeQuery;
93 using OCommonStatement::executeUpdate;
95 // XParameters
96 void SAL_CALL setNull(sal_Int32 parameter, sal_Int32 sqlType) override;
98 void SAL_CALL setObjectNull(sal_Int32 parameter, sal_Int32 sqlType,
99 const OUString& typeName) override;
101 void SAL_CALL setBoolean(sal_Int32 parameter, sal_Bool x) override;
103 void SAL_CALL setByte(sal_Int32 parameter, sal_Int8 x) override;
105 void SAL_CALL setShort(sal_Int32 parameter, sal_Int16 x) override;
107 void SAL_CALL setInt(sal_Int32 parameter, sal_Int32 x) override;
109 void SAL_CALL setLong(sal_Int32 parameter, sal_Int64 x) override;
111 void SAL_CALL setFloat(sal_Int32 parameter, float x) override;
113 void SAL_CALL setDouble(sal_Int32 parameter, double x) override;
115 void SAL_CALL setString(sal_Int32 parameter, const OUString& x) override;
117 void SAL_CALL setBytes(sal_Int32 parameter, const css::uno::Sequence<sal_Int8>& x) override;
119 void SAL_CALL setDate(sal_Int32 parameter, const css::util::Date& x) override;
121 void SAL_CALL setTime(sal_Int32 parameter, const css::util::Time& x) override;
122 void SAL_CALL setTimestamp(sal_Int32 parameter, const css::util::DateTime& x) override;
124 void SAL_CALL setBinaryStream(sal_Int32 parameter, const Reference<css::io::XInputStream>& x,
125 sal_Int32 length) override;
127 void SAL_CALL setCharacterStream(sal_Int32 parameter, const Reference<css::io::XInputStream>& x,
128 sal_Int32 length) override;
130 void SAL_CALL setObject(sal_Int32 parameter, const Any& x) override;
132 void SAL_CALL setObjectWithInfo(sal_Int32 parameter, const Any& x, sal_Int32 targetSqlType,
133 sal_Int32 scale) override;
135 void SAL_CALL setRef(sal_Int32 parameter, const Reference<css::sdbc::XRef>& x) override;
137 void SAL_CALL setBlob(sal_Int32 parameter, const Reference<css::sdbc::XBlob>& x) override;
139 void SAL_CALL setClob(sal_Int32 parameter, const Reference<css::sdbc::XClob>& x) override;
141 void SAL_CALL setArray(sal_Int32 parameter, const Reference<css::sdbc::XArray>& x) override;
143 void SAL_CALL clearParameters() override;
145 // XPreparedBatchExecution
146 void SAL_CALL addBatch() override;
147 void SAL_CALL clearBatch() override;
148 css::uno::Sequence<sal_Int32> SAL_CALL executeBatch() override;
150 // XCloseable
151 void SAL_CALL close() override;
153 // XResultSetMetaDataSupplier
154 Reference<css::sdbc::XResultSetMetaData> SAL_CALL getMetaData() override;
156 } /* mysqlc */
157 } /* connectivity */
158 #endif // INCLUDED_MYSQLC_SOURCE_MYSQLC_PREPAREDSTATEMENT_HXX
160 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */