LibreOffice Module connectivity (master) 1
CResultSet.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>
22#include <com/sun/star/beans/PropertyAttribute.hpp>
24#include <comphelper/types.hxx>
27
28using namespace ::comphelper;
29using namespace connectivity::component;
30using namespace connectivity::file;
31using namespace ::cppu;
32using namespace com::sun::star::uno;
33using namespace com::sun::star::lang;
34using namespace com::sun::star::beans;
35using namespace com::sun::star::sdbc;
36using namespace com::sun::star::sdbcx;
37
38
39OComponentResultSet::OComponentResultSet( OStatement_Base* pStmt,connectivity::OSQLParseTreeIterator& _aSQLIterator)
40 : file::OResultSet(pStmt,_aSQLIterator)
41 ,m_bBookmarkable(true)
42{
44}
45
46OUString SAL_CALL OComponentResultSet::getImplementationName( )
47{
48 return "com.sun.star.sdbcx.component.ResultSet";
49}
50
51Sequence< OUString > SAL_CALL OComponentResultSet::getSupportedServiceNames( )
52{
53 return { "com.sun.star.sdbc.ResultSet", "com.sun.star.sdbcx.ResultSet" };
54}
55
56sal_Bool SAL_CALL OComponentResultSet::supportsService( const OUString& _rServiceName )
57{
58 return cppu::supportsService(this, _rServiceName);
59}
60
62{
63 Any aRet = OResultSet::queryInterface(rType);
64 return aRet.hasValue() ? aRet : OComponentResultSet_BASE::queryInterface(rType);
65}
66
68{
69 return ::comphelper::concatSequences(OResultSet::getTypes(),OComponentResultSet_BASE::getTypes());
70}
71
72
73// XRowLocate
75{
76 ::osl::MutexGuard aGuard( m_aMutex );
77 checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
78
79
80 return Any((*m_aRow)[0]->getValue().getInt32());
81}
82
83sal_Bool SAL_CALL OComponentResultSet::moveToBookmark( const Any& bookmark )
84{
85 ::osl::MutexGuard aGuard( m_aMutex );
86 checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
87
88
90
92}
93
94sal_Bool SAL_CALL OComponentResultSet::moveRelativeToBookmark( const Any& bookmark, sal_Int32 rows )
95{
96 ::osl::MutexGuard aGuard( m_aMutex );
97 checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
98
99
101
103
104 return relative(rows);
105}
106
107
108sal_Int32 SAL_CALL OComponentResultSet::compareBookmarks( const Any& lhs, const Any& rhs )
109{
110 return (lhs == rhs) ? CompareBookmark::EQUAL : CompareBookmark::NOT_EQUAL;
111}
112
114{
115 return true;
116}
117
118sal_Int32 SAL_CALL OComponentResultSet::hashBookmark( const Any& bookmark )
119{
120 ::osl::MutexGuard aGuard( m_aMutex );
121 checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
122
123
124 return comphelper::getINT32(bookmark);
125}
126
127// XDeleteRows
129{
130 ::osl::MutexGuard aGuard( m_aMutex );
131 checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
132
133 ::dbtools::throwFeatureNotImplementedSQLException( "XDeleteRows::deleteRows", *this );
134 return Sequence< sal_Int32 >();
135}
136
138{
139 // Writer or Calc table has no index
140 return false;
141}
142
144{
146}
147
149{
151 describeProperties(aProps);
152 return new ::cppu::OPropertyArrayHelper(aProps);
153}
154
155
156void SAL_CALL OComponentResultSet::acquire() noexcept
157{
159}
160
161void SAL_CALL OComponentResultSet::release() noexcept
162{
164}
165
166css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL OComponentResultSet::getPropertySetInfo( )
167{
168 return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper());
169}
170
171
172/* 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 moveRelativeToBookmark(const css::uno::Any &bookmark, sal_Int32 rows) override
Definition: CResultSet.cxx:94
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType) override
Definition: CResultSet.cxx:61
virtual ::cppu::IPropertyArrayHelper &SAL_CALL getInfoHelper() override
Definition: CResultSet.cxx:143
virtual sal_Bool SAL_CALL hasOrderedBookmarks() override
Definition: CResultSet.cxx:113
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
Definition: CResultSet.cxx:67
virtual sal_Int32 SAL_CALL compareBookmarks(const css::uno::Any &first, const css::uno::Any &second) override
Definition: CResultSet.cxx:108
virtual void SAL_CALL release() noexcept override
Definition: CResultSet.cxx:161
virtual css::uno::Sequence< sal_Int32 > SAL_CALL deleteRows(const css::uno::Sequence< css::uno::Any > &rows) override
Definition: CResultSet.cxx:128
virtual bool fillIndexValues(const css::uno::Reference< css::sdbcx::XColumnsSupplier > &_xIndex) override
Definition: CResultSet.cxx:137
virtual ::cppu::IPropertyArrayHelper * createArrayHelper() const override
Definition: CResultSet.cxx:148
virtual css::uno::Any SAL_CALL getBookmark() override
Definition: CResultSet.cxx:74
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
Definition: CResultSet.cxx:166
virtual sal_Int32 SAL_CALL hashBookmark(const css::uno::Any &bookmark) override
Definition: CResultSet.cxx:118
virtual void SAL_CALL acquire() noexcept override
Definition: CResultSet.cxx:156
virtual sal_Bool SAL_CALL moveToBookmark(const css::uno::Any &bookmark) override
Definition: CResultSet.cxx:83
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
mutable::osl::Mutex m_aMutex
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
virtual css::uno::Any SAL_CALL queryInterface(css::uno::Type const &rType) 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)
void throwFeatureNotImplementedSQLException(const OUString &_rFeatureName, const Reference< XInterface > &_rxContext, const Any &_rNextException)
#define PROPERTY_ID_ISBOOKMARKABLE
Definition: propertyids.hxx:82
unsigned char sal_Bool