1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
24 #include <com/sun/star/sdbc/XResultSet.hpp>
25 #include <com/sun/star/sdbc/XRow.hpp>
26 #include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp>
27 #include <com/sun/star/sdbc/XCloseable.hpp>
28 #include <com/sun/star/sdbc/XColumnLocate.hpp>
29 #include <com/sun/star/util/XCancellable.hpp>
30 #include <com/sun/star/sdbc/XWarningsSupplier.hpp>
31 #include <com/sun/star/sdbc/XResultSetUpdate.hpp>
32 #include <com/sun/star/sdbc/XRowUpdate.hpp>
33 #include <com/sun/star/sdbcx/XRowLocate.hpp>
34 #include <com/sun/star/sdbcx/XDeleteRows.hpp>
35 #include <cppuhelper/compbase.hxx>
36 #include <comphelper/proparrhlp.hxx>
37 #include <comphelper/propertycontainer.hxx>
38 #include <connectivity/CommonTools.hxx>
39 #include <connectivity/FValue.hxx>
40 #include <connectivity/warningscontainer.hxx>
41 #include "NStatement.hxx"
42 #include "NResultSetMetaData.hxx"
44 namespace connectivity::evoab
46 struct ComparisonData
;
48 class OEvoabVersionHelper
51 virtual EBook
* openBook(const char *abname
) = 0;
52 virtual void executeQuery (EBook
* pBook
, EBookQuery
* pQuery
) = 0;
53 virtual void freeContacts() = 0;
54 virtual bool isLDAP( EBook
*pBook
) = 0;
55 virtual bool isLocal( EBook
*pBook
) = 0;
56 virtual EContact
*getContact(sal_Int32 nIndex
) = 0;
57 virtual sal_Int32
getNumContacts() = 0;
58 virtual bool hasContacts() = 0;
59 virtual void sortContacts( const ComparisonData
& _rCompData
) = 0;
60 OString
getUserName( EBook
*pBook
);
61 virtual ~OEvoabVersionHelper() {}
64 typedef ::cppu::WeakComponentImplHelper
< css::sdbc::XResultSet
66 , css::sdbc::XResultSetMetaDataSupplier
67 , css::util::XCancellable
68 , css::sdbc::XWarningsSupplier
69 , css::sdbc::XCloseable
70 , css::sdbc::XColumnLocate
71 , css::lang::XServiceInfo
75 class OEvoabResultSet final
: public cppu::BaseMutex
76 ,public OResultSet_BASE
77 ,public ::comphelper::OPropertyContainer
78 ,public ::comphelper::OPropertyArrayUsageHelper
<OEvoabResultSet
>
81 std::unique_ptr
<OEvoabVersionHelper
> m_pVersionHelper
;
83 OCommonStatement
* m_pStatement
;
84 OEvoabConnection
* m_pConnection
;
85 rtl::Reference
<OEvoabResultSetMetaData
> m_xMetaData
;
86 ::dbtools::WarningsContainer m_aWarnings
;
90 sal_Int32 m_nFetchSize
;
91 sal_Int32 m_nResultSetType
;
92 sal_Int32 m_nFetchDirection
;
93 sal_Int32 m_nResultSetConcurrency
;
101 return m_pVersionHelper
->getContact(m_nIndex
);
104 // OPropertyArrayUsageHelper
105 virtual ::cppu::IPropertyArrayHelper
* createArrayHelper( ) const override
;
106 // OPropertySetHelper
107 virtual ::cppu::IPropertyArrayHelper
& SAL_CALL
getInfoHelper() override
;
109 // you can't delete objects of this type
110 virtual ~OEvoabResultSet() override
;
112 DECLARE_SERVICE_INFO();
114 OEvoabResultSet( OCommonStatement
*pStmt
, OEvoabConnection
*pConnection
);
115 void construct( const QueryData
& _rData
);
117 // ::cppu::OComponentHelper
118 virtual void SAL_CALL
disposing() override
;
120 virtual css::uno::Any SAL_CALL
queryInterface( const css::uno::Type
& rType
) override
;
121 virtual void SAL_CALL
acquire() noexcept override
;
122 virtual void SAL_CALL
release() noexcept override
;
124 virtual css::uno::Sequence
< css::uno::Type
> SAL_CALL
getTypes( ) override
;
126 virtual css::uno::Reference
< css::beans::XPropertySetInfo
> SAL_CALL
getPropertySetInfo( ) override
;
128 virtual sal_Bool SAL_CALL
next( ) override
;
129 virtual sal_Bool SAL_CALL
isBeforeFirst( ) override
;
130 virtual sal_Bool SAL_CALL
isAfterLast( ) override
;
131 virtual sal_Bool SAL_CALL
isFirst( ) override
;
132 virtual sal_Bool SAL_CALL
isLast( ) override
;
133 virtual void SAL_CALL
beforeFirst( ) override
;
134 virtual void SAL_CALL
afterLast( ) override
;
135 virtual sal_Bool SAL_CALL
first( ) override
;
136 virtual sal_Bool SAL_CALL
last( ) override
;
137 virtual sal_Int32 SAL_CALL
getRow( ) override
;
138 virtual sal_Bool SAL_CALL
absolute( sal_Int32 row
) override
;
139 virtual sal_Bool SAL_CALL
relative( sal_Int32 rows
) override
;
140 virtual sal_Bool SAL_CALL
previous( ) override
;
141 virtual void SAL_CALL
refreshRow( ) override
;
142 virtual sal_Bool SAL_CALL
rowUpdated( ) override
;
143 virtual sal_Bool SAL_CALL
rowInserted( ) override
;
144 virtual sal_Bool SAL_CALL
rowDeleted( ) override
;
145 virtual css::uno::Reference
< css::uno::XInterface
> SAL_CALL
getStatement( ) override
;
147 virtual sal_Bool SAL_CALL
wasNull( ) override
;
148 virtual OUString SAL_CALL
getString( sal_Int32 columnIndex
) override
;
149 virtual sal_Bool SAL_CALL
getBoolean( sal_Int32 columnIndex
) override
;
150 virtual sal_Int8 SAL_CALL
getByte( sal_Int32 columnIndex
) override
;
151 virtual sal_Int16 SAL_CALL
getShort( sal_Int32 columnIndex
) override
;
152 virtual sal_Int32 SAL_CALL
getInt( sal_Int32 columnIndex
) override
;
153 virtual sal_Int64 SAL_CALL
getLong( sal_Int32 columnIndex
) override
;
154 virtual float SAL_CALL
getFloat( sal_Int32 columnIndex
) override
;
155 virtual double SAL_CALL
getDouble( sal_Int32 columnIndex
) override
;
156 virtual css::uno::Sequence
< sal_Int8
> SAL_CALL
getBytes( sal_Int32 columnIndex
) override
;
157 virtual css::util::Date SAL_CALL
getDate( sal_Int32 columnIndex
) override
;
158 virtual css::util::Time SAL_CALL
getTime( sal_Int32 columnIndex
) override
;
159 virtual css::util::DateTime SAL_CALL
getTimestamp( sal_Int32 columnIndex
) override
;
160 virtual css::uno::Reference
< css::io::XInputStream
> SAL_CALL
getBinaryStream( sal_Int32 columnIndex
) override
;
161 virtual css::uno::Reference
< css::io::XInputStream
> SAL_CALL
getCharacterStream( sal_Int32 columnIndex
) override
;
162 virtual css::uno::Any SAL_CALL
getObject( sal_Int32 columnIndex
, const css::uno::Reference
< css::container::XNameAccess
>& typeMap
) override
;
163 virtual css::uno::Reference
< css::sdbc::XRef
> SAL_CALL
getRef( sal_Int32 columnIndex
) override
;
164 virtual css::uno::Reference
< css::sdbc::XBlob
> SAL_CALL
getBlob( sal_Int32 columnIndex
) override
;
165 virtual css::uno::Reference
< css::sdbc::XClob
> SAL_CALL
getClob( sal_Int32 columnIndex
) override
;
166 virtual css::uno::Reference
< css::sdbc::XArray
> SAL_CALL
getArray( sal_Int32 columnIndex
) override
;
168 virtual void SAL_CALL
cancel( ) override
;
170 virtual void SAL_CALL
close( ) override
;
171 // XResultSetMetaDataSupplier
172 virtual css::uno::Reference
< css::sdbc::XResultSetMetaData
> SAL_CALL
getMetaData( ) override
;
174 virtual css::uno::Any SAL_CALL
getWarnings( ) override
;
175 virtual void SAL_CALL
clearWarnings( ) override
;
177 virtual sal_Int32 SAL_CALL
findColumn( const OUString
& columnName
) override
;
182 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */