nss: upgrade to release 3.73
[LibreOffice.git] / connectivity / source / drivers / mysqlc / mysqlc_statement.hxx
blobc85e054dd7324426f48a75fd59f3bf123e794ed5
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_STATEMENT_HXX
21 #define INCLUDED_MYSQLC_SOURCE_MYSQLC_STATEMENT_HXX
23 #include "mysqlc_connection.hxx"
24 #include "mysqlc_subcomponent.hxx"
26 #include <com/sun/star/lang/XServiceInfo.hpp>
27 #include <com/sun/star/sdbc/SQLWarning.hpp>
28 #include <com/sun/star/sdbc/XBatchExecution.hpp>
29 #include <com/sun/star/sdbc/XCloseable.hpp>
30 #include <com/sun/star/sdbc/XMultipleResults.hpp>
31 #include <com/sun/star/sdbc/XStatement.hpp>
32 #include <com/sun/star/sdbc/XWarningsSupplier.hpp>
33 #include <com/sun/star/util/XCancellable.hpp>
35 #include <cppuhelper/compbase3.hxx>
36 #include <rtl/ref.hxx>
38 namespace connectivity::mysqlc
40 using ::com::sun::star::sdbc::SQLException;
41 using ::com::sun::star::sdbc::SQLWarning;
42 using ::com::sun::star::uno::Any;
43 using ::com::sun::star::uno::RuntimeException;
44 using ::com::sun::star::uno::Type;
46 typedef ::cppu::WeakComponentImplHelper3<css::sdbc::XWarningsSupplier, css::util::XCancellable,
47 css::sdbc::XCloseable>
48 OCommonStatement_IBase;
50 //************ Class: OCommonStatement
51 // is a base class for the normal statement and for the prepared statement
53 class OCommonStatement : public OBase_Mutex,
54 public OCommonStatement_IBase,
55 public ::cppu::OPropertySetHelper,
56 public OPropertyArrayUsageHelper<OCommonStatement>
59 private:
60 SQLWarning m_aLastWarning;
62 protected:
63 rtl::Reference<OConnection> m_xConnection; // The owning Connection object
65 css::uno::Reference<css::sdbc::XResultSet> m_xResultSet;
67 // number of rows affected by an UPDATE, DELETE or INSERT statement.
68 sal_Int32 m_nAffectedRows = 0;
70 protected:
71 void closeResultSet();
73 // OPropertyArrayUsageHelper
74 ::cppu::IPropertyArrayHelper* createArrayHelper() const override;
76 // OPropertySetHelper
77 ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override;
78 sal_Bool SAL_CALL convertFastPropertyValue(Any& rConvertedValue, Any& rOldValue,
79 sal_Int32 nHandle, const Any& rValue) override;
81 void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, const Any& rValue) override;
83 void SAL_CALL getFastPropertyValue(Any& rValue, sal_Int32 nHandle) const override;
84 virtual ~OCommonStatement() override;
86 protected:
87 OCommonStatement(OConnection* _pConnection);
89 public:
90 using OCommonStatement_IBase::rBHelper;
91 using OCommonStatement_IBase::operator css::uno::Reference<css::uno::XInterface>;
93 // OComponentHelper
94 void SAL_CALL disposing() override;
96 // XInterface
97 void SAL_CALL release() throw() override;
98 void SAL_CALL acquire() throw() override;
99 Any SAL_CALL queryInterface(const css::uno::Type& rType) override;
101 //XTypeProvider
102 css::uno::Sequence<css::uno::Type> SAL_CALL getTypes() override;
104 // XPropertySet
105 css::uno::Reference<css::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() override;
107 // XWarningsSupplier
108 Any SAL_CALL getWarnings() override;
110 void SAL_CALL clearWarnings() override;
112 // XCancellable
113 void SAL_CALL cancel() override;
115 // XCloseable
116 void SAL_CALL close() override;
118 // other methods
119 OConnection* getOwnConnection() const { return m_xConnection.get(); }
121 private:
122 using ::cppu::OPropertySetHelper::getFastPropertyValue;
125 typedef ::cppu::ImplHelper3<css::lang::XServiceInfo, css::sdbc::XMultipleResults,
126 css::sdbc::XStatement>
127 OStatement_BASE;
129 class OStatement final : public OCommonStatement, public OStatement_BASE
131 virtual ~OStatement() override = default;
133 bool getResult();
135 public:
136 // A constructor which is required for the return of the objects
137 OStatement(OConnection* _pConnection)
138 : OCommonStatement(_pConnection)
142 virtual OUString SAL_CALL getImplementationName() override;
144 virtual sal_Bool SAL_CALL supportsService(OUString const& ServiceName) override;
146 virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
148 //XInterface
149 Any SAL_CALL queryInterface(const css::uno::Type& rType) override;
150 void SAL_CALL acquire() throw() override;
151 void SAL_CALL release() throw() override;
153 //XTypeProvider
154 css::uno::Sequence<Type> SAL_CALL getTypes() override;
156 // XStatement
157 css::uno::Reference<css::sdbc::XResultSet> SAL_CALL executeQuery(const OUString& sql) override;
158 sal_Int32 SAL_CALL executeUpdate(const OUString& sql) override;
159 sal_Bool SAL_CALL execute(const OUString& sql) override;
160 css::uno::Reference<css::sdbc::XConnection> SAL_CALL getConnection() override;
162 // XMultipleResults
163 css::uno::Reference<css::sdbc::XResultSet> SAL_CALL getResultSet() override;
164 sal_Int32 SAL_CALL getUpdateCount() override;
165 sal_Bool SAL_CALL getMoreResults() override;
167 // XBatchExecution
168 // void SAL_CALL addBatch(const OUString& sql) override;
170 // void SAL_CALL clearBatch() override;
172 // css::uno::Sequence<sal_Int32> SAL_CALL executeBatch() override;
175 #endif // INCLUDED_MYSQLC_SOURCE_MYSQLC_STATEMENT_HXX
177 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */