LibreOffice Module connectivity (master) 1
EResultSet.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#include <com/sun/star/sdbcx/CompareBookmark.hpp>
21#include <com/sun/star/sdbcx/XDeleteRows.hpp>
22#include <flat/EResultSet.hxx>
23#include <com/sun/star/beans/PropertyAttribute.hpp>
25#include <comphelper/types.hxx>
27
28using namespace ::comphelper;
29
30using namespace connectivity::flat;
31using namespace connectivity::file;
32using namespace ::cppu;
33using namespace com::sun::star::uno;
34using namespace com::sun::star::lang;
35using namespace com::sun::star::beans;
36using namespace com::sun::star::sdbc;
37using namespace com::sun::star::sdbcx;
38
39
40OFlatResultSet::OFlatResultSet( OStatement_Base* pStmt,connectivity::OSQLParseTreeIterator& _aSQLIterator)
41 : file::OResultSet(pStmt,_aSQLIterator)
42 ,m_bBookmarkable(true)
43{
45}
46
47OUString SAL_CALL OFlatResultSet::getImplementationName( )
48{
49 return "com.sun.star.sdbcx.flat.ResultSet";
50}
51
52Sequence< OUString > SAL_CALL OFlatResultSet::getSupportedServiceNames( )
53{
54 return { "com.sun.star.sdbc.ResultSet", "com.sun.star.sdbcx.ResultSet" };
55}
56
57sal_Bool SAL_CALL OFlatResultSet::supportsService( const OUString& _rServiceName )
58{
59 return cppu::supportsService(this, _rServiceName);
60}
61
62Any SAL_CALL OFlatResultSet::queryInterface( const Type & rType )
63{
66 return Any();
67
68 const Any aRet = OResultSet::queryInterface(rType);
69 return aRet.hasValue() ? aRet : OFlatResultSet_BASE::queryInterface(rType);
70}
71
73{
74 Sequence< Type > aTypes = OResultSet::getTypes();
75 std::vector<Type> aOwnTypes;
76 aOwnTypes.reserve(aTypes.getLength());
77 const Type* pBegin = aTypes.getConstArray();
78 const Type* pEnd = pBegin + aTypes.getLength();
79 for(;pBegin != pEnd;++pBegin)
80 {
81 if(!(*pBegin == cppu::UnoType<XDeleteRows>::get()||
84 {
85 aOwnTypes.push_back(*pBegin);
86 }
87 }
88 Sequence< Type > aRet(aOwnTypes.data(), aOwnTypes.size());
89 return ::comphelper::concatSequences(aRet,OFlatResultSet_BASE::getTypes());
90}
91
92
93// XRowLocate
95{
96 ::osl::MutexGuard aGuard( m_aMutex );
97 checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
98
99 return Any((*m_aRow)[0]->getValue().getInt32());
100}
101
102sal_Bool SAL_CALL OFlatResultSet::moveToBookmark( const Any& bookmark )
103{
104 ::osl::MutexGuard aGuard( m_aMutex );
105 checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
106
107
109
111}
112
113sal_Bool SAL_CALL OFlatResultSet::moveRelativeToBookmark( const Any& bookmark, sal_Int32 rows )
114{
115 ::osl::MutexGuard aGuard( m_aMutex );
116 checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
117
119
121
122 return relative(rows);
123}
124
125
126sal_Int32 SAL_CALL OFlatResultSet::compareBookmarks( const Any& lhs, const Any& rhs )
127{
128 return (lhs == rhs) ? CompareBookmark::EQUAL : CompareBookmark::NOT_EQUAL;
129}
130
132{
133 return true;
134}
135
136sal_Int32 SAL_CALL OFlatResultSet::hashBookmark( const Any& bookmark )
137{
138 return comphelper::getINT32(bookmark);
139}
140
141IPropertyArrayHelper* OFlatResultSet::createArrayHelper( ) const
142{
144 describeProperties(aProps);
145 return new ::cppu::OPropertyArrayHelper(aProps);
146}
147
148IPropertyArrayHelper & OFlatResultSet::getInfoHelper()
149{
151}
152
153void SAL_CALL OFlatResultSet::acquire() noexcept
154{
156}
157
158void SAL_CALL OFlatResultSet::release() noexcept
159{
161}
162
163css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL OFlatResultSet::getPropertySetInfo( )
164{
165 return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper());
166}
167
168
169/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
::cppu::IPropertyArrayHelper * getArrayHelper()
void describeProperties(css::uno::Sequence< css::beans::Property > &_rProps) const
void registerProperty(const OUString &_rName, sal_Int32 _nHandle, sal_Int32 _nAttributes, void *_pPointerToMember, const css::uno::Type &_rMemberType)
::dbtools::OPropertyMap & getPropMap()
Definition: TConnection.cxx:68
virtual sal_Bool SAL_CALL relative(sal_Int32 rows) override
Definition: FResultSet.cxx:416
const ORowSetValue & getValue(sal_Int32 columnIndex)
Definition: FResultSet.cxx:189
virtual void SAL_CALL release() noexcept override
virtual void SAL_CALL acquire() noexcept override
bool Move(IResultSetHelper::Movement eCursorPosition, sal_Int32 nOffset, bool bRetrieveData)
Definition: FResultSet.cxx:878
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
Definition: EResultSet.cxx:72
virtual sal_Int32 SAL_CALL hashBookmark(const css::uno::Any &bookmark) override
Definition: EResultSet.cxx:136
virtual css::uno::Any SAL_CALL getBookmark() override
Definition: EResultSet.cxx:94
virtual ::cppu::IPropertyArrayHelper * createArrayHelper() const override
Definition: EResultSet.cxx:141
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
Definition: EResultSet.cxx:163
virtual void SAL_CALL acquire() noexcept override
Definition: EResultSet.cxx:153
virtual ::cppu::IPropertyArrayHelper &SAL_CALL getInfoHelper() override
Definition: EResultSet.cxx:148
virtual void SAL_CALL release() noexcept override
Definition: EResultSet.cxx:158
virtual sal_Bool SAL_CALL moveToBookmark(const css::uno::Any &bookmark) override
Definition: EResultSet.cxx:102
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType) override
Definition: EResultSet.cxx:62
virtual sal_Bool SAL_CALL moveRelativeToBookmark(const css::uno::Any &bookmark, sal_Int32 rows) override
Definition: EResultSet.cxx:113
virtual sal_Int32 SAL_CALL compareBookmarks(const css::uno::Any &first, const css::uno::Any &second) override
Definition: EResultSet.cxx:126
virtual sal_Bool SAL_CALL hasOrderedBookmarks() override
Definition: EResultSet.cxx:131
mutable::osl::Mutex m_aMutex
virtual css::uno::Any SAL_CALL queryInterface(css::uno::Type const &rType) SAL_OVERRIDE
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
sal_Int32 getINT32(const Any &_rAny)
Type
void checkDisposed(bool _bThrow)
Definition: dbtools.cxx:1951
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
#define PROPERTY_ID_ISBOOKMARKABLE
Definition: propertyids.hxx:82
unsigned char sal_Bool
const SvXMLTokenMapEntry aTypes[]