bump product version to 7.2.5.1
[LibreOffice.git] / connectivity / source / drivers / component / CResultSet.cxx
blob55d19f8b2ed8c05739d7f94c0604de9e76d110fc
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 #include <com/sun/star/sdbcx/CompareBookmark.hpp>
21 #include <component/CResultSet.hxx>
22 #include <com/sun/star/beans/PropertyAttribute.hpp>
23 #include <comphelper/sequence.hxx>
24 #include <comphelper/types.hxx>
25 #include <cppuhelper/supportsservice.hxx>
26 #include <connectivity/dbexception.hxx>
28 using namespace ::comphelper;
29 using namespace connectivity::component;
30 using namespace connectivity::file;
31 using namespace ::cppu;
32 using namespace com::sun::star::uno;
33 using namespace com::sun::star::lang;
34 using namespace com::sun::star::beans;
35 using namespace com::sun::star::sdbc;
36 using namespace com::sun::star::sdbcx;
39 OComponentResultSet::OComponentResultSet( OStatement_Base* pStmt,connectivity::OSQLParseTreeIterator& _aSQLIterator)
40 : file::OResultSet(pStmt,_aSQLIterator)
41 ,m_bBookmarkable(true)
43 registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISBOOKMARKABLE), PROPERTY_ID_ISBOOKMARKABLE, PropertyAttribute::READONLY,&m_bBookmarkable, cppu::UnoType<bool>::get());
46 OUString SAL_CALL OComponentResultSet::getImplementationName( )
48 return "com.sun.star.sdbcx.component.ResultSet";
51 Sequence< OUString > SAL_CALL OComponentResultSet::getSupportedServiceNames( )
53 return { "com.sun.star.sdbc.ResultSet", "com.sun.star.sdbcx.ResultSet" };
56 sal_Bool SAL_CALL OComponentResultSet::supportsService( const OUString& _rServiceName )
58 return cppu::supportsService(this, _rServiceName);
61 Any SAL_CALL OComponentResultSet::queryInterface( const Type & rType )
63 Any aRet = OResultSet::queryInterface(rType);
64 return aRet.hasValue() ? aRet : OComponentResultSet_BASE::queryInterface(rType);
67 Sequence< Type > SAL_CALL OComponentResultSet::getTypes( )
69 return ::comphelper::concatSequences(OResultSet::getTypes(),OComponentResultSet_BASE::getTypes());
73 // XRowLocate
74 Any SAL_CALL OComponentResultSet::getBookmark( )
76 ::osl::MutexGuard aGuard( m_aMutex );
77 checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
80 return makeAny(static_cast<sal_Int32>((*m_aRow)[0]->getValue()));
83 sal_Bool SAL_CALL OComponentResultSet::moveToBookmark( const Any& bookmark )
85 ::osl::MutexGuard aGuard( m_aMutex );
86 checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
89 m_bRowDeleted = m_bRowInserted = m_bRowUpdated = false;
91 return Move(IResultSetHelper::BOOKMARK,comphelper::getINT32(bookmark),true);
94 sal_Bool SAL_CALL OComponentResultSet::moveRelativeToBookmark( const Any& bookmark, sal_Int32 rows )
96 ::osl::MutexGuard aGuard( m_aMutex );
97 checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
100 m_bRowDeleted = m_bRowInserted = m_bRowUpdated = false;
102 Move(IResultSetHelper::BOOKMARK,comphelper::getINT32(bookmark),false);
104 return relative(rows);
108 sal_Int32 SAL_CALL OComponentResultSet::compareBookmarks( const Any& lhs, const Any& rhs )
110 return (lhs == rhs) ? CompareBookmark::EQUAL : CompareBookmark::NOT_EQUAL;
113 sal_Bool SAL_CALL OComponentResultSet::hasOrderedBookmarks( )
115 return true;
118 sal_Int32 SAL_CALL OComponentResultSet::hashBookmark( const Any& bookmark )
120 ::osl::MutexGuard aGuard( m_aMutex );
121 checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
124 return comphelper::getINT32(bookmark);
127 // XDeleteRows
128 Sequence< sal_Int32 > SAL_CALL OComponentResultSet::deleteRows( const Sequence< Any >& /*rows*/ )
130 ::osl::MutexGuard aGuard( m_aMutex );
131 checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
133 ::dbtools::throwFeatureNotImplementedSQLException( "XDeleteRows::deleteRows", *this );
134 return Sequence< sal_Int32 >();
137 bool OComponentResultSet::fillIndexValues(const Reference< XColumnsSupplier> &/*_xIndex*/)
139 // Writer or Calc table has no index
140 return false;
143 ::cppu::IPropertyArrayHelper & OComponentResultSet::getInfoHelper()
145 return *OComponentResultSet_BASE3::getArrayHelper();
148 ::cppu::IPropertyArrayHelper* OComponentResultSet::createArrayHelper() const
150 Sequence< Property > aProps;
151 describeProperties(aProps);
152 return new ::cppu::OPropertyArrayHelper(aProps);
156 void SAL_CALL OComponentResultSet::acquire() noexcept
158 OComponentResultSet_BASE2::acquire();
161 void SAL_CALL OComponentResultSet::release() noexcept
163 OComponentResultSet_BASE2::release();
166 css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL OComponentResultSet::getPropertySetInfo( )
168 return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper());
172 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */