bump product version to 7.2.5.1
[LibreOffice.git] / connectivity / source / drivers / macab / MacabStatement.hxx
blob6b0c53c234adfeb9de84e1d291513d6c68b1e3fa
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 #pragma once
22 #include "MacabConnection.hxx"
23 #include "MacabHeader.hxx"
24 #include <connectivity/sqliterator.hxx>
25 #include <connectivity/sqlparse.hxx>
26 #include <com/sun/star/sdbc/XStatement.hpp>
27 #include <com/sun/star/util/XCancellable.hpp>
28 #include <cppuhelper/compbase.hxx>
29 #include <cppuhelper/implbase.hxx>
30 #include <cppuhelper/basemutex.hxx>
31 #include <comphelper/proparrhlp.hxx>
33 namespace connectivity::macab
35 typedef ::cppu::WeakComponentImplHelper< css::sdbc::XStatement,
36 css::sdbc::XWarningsSupplier,
37 css::util::XCancellable,
38 css::sdbc::XCloseable> MacabCommonStatement_BASE;
41 // Class MacabCommonStatement
42 // is a base class for the normal statement and for the prepared statement
44 class MacabCommonStatement : public cppu::BaseMutex,
45 public MacabCommonStatement_BASE,
46 public ::cppu::OPropertySetHelper,
47 public comphelper::OPropertyArrayUsageHelper<MacabCommonStatement>
50 css::sdbc::SQLWarning m_aLastWarning;
52 protected:
53 connectivity::OSQLParser m_aParser;
54 connectivity::OSQLParseTreeIterator m_aSQLIterator;
55 connectivity::OSQLParseNode* m_pParseTree;
56 MacabConnection* m_pConnection; // The owning Connection object
57 MacabHeader* m_pHeader; // The header of the address book on which to run queries (provided by m_pConnection)
58 css::uno::WeakReference< css::sdbc::XResultSet> m_xResultSet; // The last ResultSet created
61 protected:
62 /// @throws css::sdbc::SQLException
63 class MacabCondition *analyseWhereClause(
64 const OSQLParseNode *pParseNode) const;
65 /// @throws css::sdbc::SQLException
66 class MacabOrder *analyseOrderByClause(
67 const OSQLParseNode *pParseNode) const;
68 OUString getTableName( ) const;
69 /// @throws css::sdbc::SQLException
70 void setMacabFields(class MacabResultSet *pResult) const;
71 /// @throws css::sdbc::SQLException
72 void selectRecords(MacabResultSet *pResult) const;
73 /// @throws css::sdbc::SQLException
74 void sortRecords(MacabResultSet *pResult) const;
76 // OPropertyArrayUsageHelper
77 virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const override;
79 // OPropertySetHelper
80 virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override;
81 virtual sal_Bool SAL_CALL convertFastPropertyValue(
82 css::uno::Any & rConvertedValue,
83 css::uno::Any & rOldValue,
84 sal_Int32 nHandle,
85 const css::uno::Any& rValue) override;
86 virtual void SAL_CALL setFastPropertyValue_NoBroadcast(
87 sal_Int32 nHandle,
88 const css::uno::Any& rValue) override;
89 virtual void SAL_CALL getFastPropertyValue(
90 css::uno::Any& rValue,
91 sal_Int32 nHandle) const override;
93 /// @throws css::sdbc::SQLException
94 virtual void resetParameters() const;
95 /// @throws css::sdbc::SQLException
96 virtual void getNextParameter(OUString &rParameter) const;
97 virtual ~MacabCommonStatement() override;
99 public:
100 using MacabCommonStatement_BASE::rBHelper;
102 explicit MacabCommonStatement(MacabConnection *_pConnection);
103 using MacabCommonStatement_BASE::operator css::uno::Reference< css::uno::XInterface >;
105 // OComponentHelper
106 using MacabCommonStatement_BASE::disposing;
108 // XInterface
109 virtual void SAL_CALL release() noexcept override;
110 virtual void SAL_CALL acquire() noexcept override;
111 virtual css::uno::Any SAL_CALL queryInterface(
112 const css::uno::Type & rType
113 ) override;
115 // XTypeProvider
116 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes(
117 ) override;
119 // XPropertySet
120 virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo(
121 ) override;
123 // XStatement
124 virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL executeQuery(
125 const OUString& sql ) override;
126 virtual sal_Int32 SAL_CALL executeUpdate(
127 const OUString& sql ) override;
128 virtual sal_Bool SAL_CALL execute(
129 const OUString& sql ) override;
130 virtual css::uno::Reference< css::sdbc::XConnection > SAL_CALL getConnection(
131 ) override;
133 // XWarningsSupplier
134 virtual css::uno::Any SAL_CALL getWarnings(
135 ) override;
136 virtual void SAL_CALL clearWarnings(
137 ) override;
139 // XCancellable
140 virtual void SAL_CALL cancel(
141 ) override;
143 // XCloseable
144 virtual void SAL_CALL close(
145 ) override;
147 // other methods
148 MacabConnection* getOwnConnection() const { return m_pConnection; }
152 // Class MacabStatement
154 typedef ::cppu::ImplInheritanceHelper<
155 MacabCommonStatement, css::lang::XServiceInfo > MacabStatement_BASE;
157 class MacabStatement : public MacabStatement_BASE
159 protected:
160 virtual ~MacabStatement() override { }
162 public:
163 explicit MacabStatement(MacabConnection* _pConnection);
164 DECLARE_SERVICE_INFO();
168 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */