Version 4.3.0.0.beta1, tag libreoffice-4.3.0.0.beta1
[LibreOffice.git] / connectivity / source / drivers / macab / MacabStatement.hxx
blob2ee61251b72d72124680b1d4c151564db64f07bd
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_MACAB_MACABSTATEMENT_HXX
21 #define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_MACAB_MACABSTATEMENT_HXX
23 #include "MacabConnection.hxx"
24 #include "MacabHeader.hxx"
25 #include <list>
26 #include "connectivity/sqliterator.hxx"
27 #include "connectivity/sqlparse.hxx"
28 #include <com/sun/star/sdbc/XStatement.hpp>
29 #include <com/sun/star/util/XCancellable.hpp>
30 #include <cppuhelper/compbase4.hxx>
31 #include <cppuhelper/implbase1.hxx>
32 #include <comphelper/proparrhlp.hxx>
34 namespace connectivity
36 namespace macab
38 typedef ::cppu::WeakComponentImplHelper4< ::com::sun::star::sdbc::XStatement,
39 ::com::sun::star::sdbc::XWarningsSupplier,
40 ::com::sun::star::util::XCancellable,
41 ::com::sun::star::sdbc::XCloseable> MacabCommonStatement_BASE;
44 // Class MacabCommonStatement
45 // is a base class for the normal statement and for the prepared statement
47 class MacabCommonStatement : public comphelper::OBaseMutex,
48 public MacabCommonStatement_BASE,
49 public ::cppu::OPropertySetHelper,
50 public comphelper::OPropertyArrayUsageHelper<MacabCommonStatement>
53 ::com::sun::star::sdbc::SQLWarning m_aLastWarning;
55 protected:
56 ::std::list< OUString> m_aBatchList;
57 connectivity::OSQLParser m_aParser;
58 connectivity::OSQLParseTreeIterator m_aSQLIterator;
59 connectivity::OSQLParseNode* m_pParseTree;
60 MacabConnection* m_pConnection; // The owning Connection object
61 MacabHeader* m_pHeader; // The header of the address book on which to run queries (provided by m_pConnection)
62 ::com::sun::star::uno::WeakReference< ::com::sun::star::sdbc::XResultSet> m_xResultSet; // The last ResultSet created
65 protected:
66 class MacabCondition *analyseWhereClause(
67 const OSQLParseNode *pParseNode) const throw(::com::sun::star::sdbc::SQLException);
68 class MacabOrder *analyseOrderByClause(
69 const OSQLParseNode *pParseNode) const throw(::com::sun::star::sdbc::SQLException);
70 OUString getTableName( ) const;
71 void setMacabFields(class MacabResultSet *pResult) const throw(::com::sun::star::sdbc::SQLException);
72 void selectRecords(MacabResultSet *pResult) const throw(::com::sun::star::sdbc::SQLException);
73 void sortRecords(MacabResultSet *pResult) const throw(::com::sun::star::sdbc::SQLException);
75 // OPropertyArrayUsageHelper
76 virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const SAL_OVERRIDE;
78 // OPropertySetHelper
79 virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() SAL_OVERRIDE;
80 virtual sal_Bool SAL_CALL convertFastPropertyValue(
81 ::com::sun::star::uno::Any & rConvertedValue,
82 ::com::sun::star::uno::Any & rOldValue,
83 sal_Int32 nHandle,
84 const ::com::sun::star::uno::Any& rValue) throw (::com::sun::star::lang::IllegalArgumentException) SAL_OVERRIDE;
85 virtual void SAL_CALL setFastPropertyValue_NoBroadcast(
86 sal_Int32 nHandle,
87 const ::com::sun::star::uno::Any& rValue) throw (::com::sun::star::uno::Exception) SAL_OVERRIDE;
88 virtual void SAL_CALL getFastPropertyValue(
89 ::com::sun::star::uno::Any& rValue,
90 sal_Int32 nHandle) const SAL_OVERRIDE;
92 virtual void resetParameters() const throw(::com::sun::star::sdbc::SQLException);
93 virtual void getNextParameter(OUString &rParameter) const throw(::com::sun::star::sdbc::SQLException);
94 virtual ~MacabCommonStatement();
96 public:
97 ::cppu::OBroadcastHelper& rBHelper;
99 MacabCommonStatement(MacabConnection *_pConnection);
100 using MacabCommonStatement_BASE::operator ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >;
102 // OComponentHelper
103 virtual void SAL_CALL disposing() SAL_OVERRIDE;
105 // XInterface
106 virtual void SAL_CALL release() throw() SAL_OVERRIDE;
107 virtual void SAL_CALL acquire() throw() SAL_OVERRIDE;
108 virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(
109 const ::com::sun::star::uno::Type & rType
110 ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
112 // XTypeProvider
113 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes(
114 ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
116 // XPropertySet
117 virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo(
118 ) throw(::com::sun::star::uno::RuntimeException) SAL_OVERRIDE;
120 // XStatement
121 virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > SAL_CALL executeQuery(
122 const OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) SAL_OVERRIDE;
123 virtual sal_Int32 SAL_CALL executeUpdate(
124 const OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) SAL_OVERRIDE;
125 virtual sal_Bool SAL_CALL execute(
126 const OUString& sql ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) SAL_OVERRIDE;
127 virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL getConnection(
128 ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) SAL_OVERRIDE;
130 // XWarningsSupplier
131 virtual ::com::sun::star::uno::Any SAL_CALL getWarnings(
132 ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) SAL_OVERRIDE;
133 virtual void SAL_CALL clearWarnings(
134 ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) SAL_OVERRIDE;
136 // XCancellable
137 virtual void SAL_CALL cancel(
138 ) throw(::com::sun::star::uno::RuntimeException) SAL_OVERRIDE;
140 // XCloseable
141 virtual void SAL_CALL close(
142 ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) SAL_OVERRIDE;
144 // other methods
145 inline MacabConnection* getOwnConnection() const { return m_pConnection; }
149 // Class MacabStatement
151 typedef ::cppu::ImplInheritanceHelper1<
152 MacabCommonStatement, ::com::sun::star::lang::XServiceInfo > MacabStatement_BASE;
154 class MacabStatement : public MacabStatement_BASE
156 protected:
157 virtual ~MacabStatement() { }
159 public:
160 MacabStatement(MacabConnection* _pConnection);
161 DECLARE_SERVICE_INFO();
166 #endif // INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_MACAB_MACABSTATEMENT_HXX
168 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */