LibreOffice Module dbaccess (master) 1
CacheSet.hxx
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#pragma once
20
21#include <com/sun/star/sdbc/XRow.hpp>
22#include <com/sun/star/sdbc/XResultSetMetaData.hpp>
23#include <com/sun/star/sdbc/XResultSet.hpp>
24#include <com/sun/star/sdbc/XConnection.hpp>
25#include <com/sun/star/beans/XPropertySet.hpp>
26#include "RowSetRow.hxx"
28
29#include <vector>
30
31namespace com::sun::star::sdbc{ class XParameters; }
32
33namespace dbaccess
34{
35 class OCacheSet : public ::cppu::WeakImplHelper< css::sdbc::XRow>
36 {
37 protected:
38 css::uno::Reference< css::sdbc::XResultSet> m_xDriverSet;
39 css::uno::Reference< css::sdbc::XRow> m_xDriverRow;
40 css::uno::Reference< css::sdbc::XResultSetMetaData> m_xSetMetaData;
41 css::uno::Reference< css::sdbc::XConnection> m_xConnection;
42
43 std::vector<bool> m_aNullable;
44 std::vector<bool> m_aSignedFlags;
45 std::vector<sal_Int32> m_aColumnTypes;
47 sal_Int32 m_nMaxRows;
52
53 explicit OCacheSet(sal_Int32 i_nMaxRows);
54 virtual ~OCacheSet() override;
55
56 static void setParameter(sal_Int32 nPos
57 ,const css::uno::Reference< css::sdbc::XParameters >& _xParameter
58 ,const connectivity::ORowSetValue& _rValue
59 ,sal_Int32 _nType
60 ,sal_Int32 _nScale
61 );
62 void fillParameters( const ORowSetRow& _rRow
63 ,const connectivity::OSQLTable& _xTable
64 ,OUStringBuffer& _sCondition
65 ,OUStringBuffer& _sParameter
66 ,std::vector< sal_Int32>& _rOrgValues);
69 void fillTableName(const css::uno::Reference< css::beans::XPropertySet>& _xTable);
70
71 OUString getIdentifierQuoteString() const;
72 public:
73
74 // late constructor
75 virtual void construct(const css::uno::Reference< css::sdbc::XResultSet>& _xDriverSet,const OUString& i_sRowSetFilter);
76 virtual void fillValueRow(ORowSetRow& _rRow,sal_Int32 _nPosition);
77
78 // css::sdbc::XRow
79 virtual sal_Bool SAL_CALL wasNull( ) override;
80 virtual OUString SAL_CALL getString( sal_Int32 columnIndex ) override;
81 virtual sal_Bool SAL_CALL getBoolean( sal_Int32 columnIndex ) override;
82 virtual sal_Int8 SAL_CALL getByte( sal_Int32 columnIndex ) override;
83 virtual sal_Int16 SAL_CALL getShort( sal_Int32 columnIndex ) override;
84 virtual sal_Int32 SAL_CALL getInt( sal_Int32 columnIndex ) override;
85 virtual sal_Int64 SAL_CALL getLong( sal_Int32 columnIndex ) override;
86 virtual float SAL_CALL getFloat( sal_Int32 columnIndex ) override;
87 virtual double SAL_CALL getDouble( sal_Int32 columnIndex ) override;
88 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getBytes( sal_Int32 columnIndex ) override;
89 virtual css::util::Date SAL_CALL getDate( sal_Int32 columnIndex ) override;
90 virtual css::util::Time SAL_CALL getTime( sal_Int32 columnIndex ) override;
91 virtual css::util::DateTime SAL_CALL getTimestamp( sal_Int32 columnIndex ) override;
92 virtual css::uno::Reference< css::io::XInputStream > SAL_CALL getBinaryStream( sal_Int32 columnIndex ) override;
93 virtual css::uno::Reference< css::io::XInputStream > SAL_CALL getCharacterStream( sal_Int32 columnIndex ) override;
94 virtual css::uno::Any SAL_CALL getObject( sal_Int32 columnIndex, const css::uno::Reference< css::container::XNameAccess >& typeMap ) override;
95 virtual css::uno::Reference< css::sdbc::XRef > SAL_CALL getRef( sal_Int32 columnIndex ) override;
96 virtual css::uno::Reference< css::sdbc::XBlob > SAL_CALL getBlob( sal_Int32 columnIndex ) override;
97 virtual css::uno::Reference< css::sdbc::XClob > SAL_CALL getClob( sal_Int32 columnIndex ) override;
98 virtual css::uno::Reference< css::sdbc::XArray > SAL_CALL getArray( sal_Int32 columnIndex ) override;
99 // css::sdbc::XResultSet
102 virtual bool next();
105 virtual void beforeFirst( );
108 virtual void afterLast( );
111 virtual bool first();
114 virtual bool last();
117 virtual sal_Int32 getRow( );
120 virtual bool absolute( sal_Int32 row );
123 virtual bool previous( );
126 virtual void refreshRow( );
129 virtual bool rowUpdated( );
132 virtual bool rowInserted( );
135 virtual bool rowDeleted( );
136 // css::sdbcx::XRowLocate
139 virtual css::uno::Any getBookmark() = 0;
142 virtual bool moveToBookmark( const css::uno::Any& bookmark ) = 0;
145 virtual sal_Int32 compareBookmarks( const css::uno::Any& first, const css::uno::Any& second ) = 0;
148 virtual bool hasOrderedBookmarks( ) = 0;
151 virtual sal_Int32 hashBookmark( const css::uno::Any& bookmark ) = 0;
152 // css::sdbc::XResultSetUpdate
155 virtual void insertRow( const ORowSetRow& _rInsertRow,const connectivity::OSQLTable& _xTable );
158 virtual void updateRow( const ORowSetRow& _rInsertRow,const ORowSetRow& _rOriginalRow,const connectivity::OSQLTable& _xTable );
161 virtual void deleteRow( const ORowSetRow& _rDeleteRow,const connectivity::OSQLTable& _xTable ) = 0;
162
163 virtual bool isResultSetChanged() const;
164 virtual void reset(const css::uno::Reference< css::sdbc::XResultSet>& _xDriverSet) = 0;
165 virtual void mergeColumnValues(sal_Int32 i_nColumnIndex,ORowSetValueVector::Vector& io_aInsertRow,ORowSetValueVector::Vector& io_aRow,std::vector<sal_Int32>& o_aChangedColumns);
166 virtual bool columnValuesUpdated(ORowSetValueVector::Vector& o_aCachedRow,const ORowSetValueVector::Vector& i_aRow);
167 virtual bool updateColumnValues(const ORowSetValueVector::Vector& io_aCachedRow,ORowSetValueVector::Vector& io_aRow,const std::vector<sal_Int32>& i_aChangedColumns);
168 virtual void fillMissingValues(ORowSetValueVector::Vector& io_aRow) const;
169 };
170}
171
172/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::vector< VectorVal > Vector
std::vector< bool > m_aNullable
Definition: CacheSet.hxx:43
virtual sal_Bool SAL_CALL getBoolean(sal_Int32 columnIndex) override
Definition: CacheSet.cxx:398
virtual css::uno::Any getBookmark()=0
virtual css::util::DateTime SAL_CALL getTimestamp(sal_Int32 columnIndex) override
Definition: CacheSet.cxx:448
virtual css::uno::Reference< css::sdbc::XBlob > SAL_CALL getBlob(sal_Int32 columnIndex) override
Definition: CacheSet.cxx:473
virtual sal_Int8 SAL_CALL getByte(sal_Int32 columnIndex) override
Definition: CacheSet.cxx:403
virtual bool first()
Definition: CacheSet.cxx:507
virtual bool moveToBookmark(const css::uno::Any &bookmark)=0
virtual bool hasOrderedBookmarks()=0
virtual bool next()
Definition: CacheSet.cxx:489
css::uno::Reference< css::sdbc::XResultSetMetaData > m_xSetMetaData
Definition: CacheSet.hxx:40
css::uno::Reference< css::sdbc::XResultSet > m_xDriverSet
Definition: CacheSet.hxx:38
sal_Int32 m_nMaxRows
Definition: CacheSet.hxx:47
virtual bool updateColumnValues(const ORowSetValueVector::Vector &io_aCachedRow, ORowSetValueVector::Vector &io_aRow, const std::vector< sal_Int32 > &i_aChangedColumns)
Definition: CacheSet.cxx:571
virtual void mergeColumnValues(sal_Int32 i_nColumnIndex, ORowSetValueVector::Vector &io_aInsertRow, ORowSetValueVector::Vector &io_aRow, std::vector< sal_Int32 > &o_aChangedColumns)
Definition: CacheSet.cxx:561
OUString m_aComposedTableName
Definition: CacheSet.hxx:46
css::uno::Reference< css::sdbc::XConnection > m_xConnection
Definition: CacheSet.hxx:41
virtual OUString SAL_CALL getString(sal_Int32 columnIndex) override
Definition: CacheSet.cxx:393
virtual sal_Int64 SAL_CALL getLong(sal_Int32 columnIndex) override
Definition: CacheSet.cxx:418
virtual css::uno::Reference< css::sdbc::XRef > SAL_CALL getRef(sal_Int32 columnIndex) override
Definition: CacheSet.cxx:468
virtual void afterLast()
Definition: CacheSet.cxx:501
virtual bool rowInserted()
Definition: CacheSet.cxx:546
virtual void fillValueRow(ORowSetRow &_rRow, sal_Int32 _nPosition)
Definition: CacheSet.cxx:371
std::vector< bool > m_aSignedFlags
Definition: CacheSet.hxx:44
virtual void insertRow(const ORowSetRow &_rInsertRow, const connectivity::OSQLTable &_xTable)
Definition: CacheSet.cxx:148
virtual css::uno::Reference< css::io::XInputStream > SAL_CALL getCharacterStream(sal_Int32 columnIndex) override
Definition: CacheSet.cxx:458
virtual void beforeFirst()
Definition: CacheSet.cxx:495
OUString m_sRowSetFilter
Definition: CacheSet.hxx:51
virtual sal_Int32 SAL_CALL getInt(sal_Int32 columnIndex) override
Definition: CacheSet.cxx:413
virtual void reset(const css::uno::Reference< css::sdbc::XResultSet > &_xDriverSet)=0
virtual sal_Int32 hashBookmark(const css::uno::Any &bookmark)=0
virtual css::uno::Any SAL_CALL getObject(sal_Int32 columnIndex, const css::uno::Reference< css::container::XNameAccess > &typeMap) override
Definition: CacheSet.cxx:463
css::uno::Reference< css::sdbc::XRow > m_xDriverRow
Definition: CacheSet.hxx:39
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getBytes(sal_Int32 columnIndex) override
Definition: CacheSet.cxx:433
virtual css::util::Date SAL_CALL getDate(sal_Int32 columnIndex) override
Definition: CacheSet.cxx:438
void fillParameters(const ORowSetRow &_rRow, const connectivity::OSQLTable &_xTable, OUStringBuffer &_sCondition, OUStringBuffer &_sParameter, std::vector< sal_Int32 > &_rOrgValues)
Definition: CacheSet.cxx:190
virtual bool rowDeleted()
Definition: CacheSet.cxx:551
std::vector< sal_Int32 > m_aColumnTypes
Definition: CacheSet.hxx:45
virtual void refreshRow()
Definition: CacheSet.cxx:536
OCacheSet(sal_Int32 i_nMaxRows)
Definition: CacheSet.cxx:56
virtual bool columnValuesUpdated(ORowSetValueVector::Vector &o_aCachedRow, const ORowSetValueVector::Vector &i_aRow)
Definition: CacheSet.cxx:566
virtual void fillMissingValues(ORowSetValueVector::Vector &io_aRow) const
Definition: CacheSet.cxx:576
virtual css::uno::Reference< css::io::XInputStream > SAL_CALL getBinaryStream(sal_Int32 columnIndex) override
Definition: CacheSet.cxx:453
virtual float SAL_CALL getFloat(sal_Int32 columnIndex) override
Definition: CacheSet.cxx:423
virtual sal_Int32 getRow()
Definition: CacheSet.cxx:519
virtual sal_Int32 compareBookmarks(const css::uno::Any &first, const css::uno::Any &second)=0
virtual void deleteRow(const ORowSetRow &_rDeleteRow, const connectivity::OSQLTable &_xTable)=0
Definition: CacheSet.cxx:313
virtual bool rowUpdated()
Definition: CacheSet.cxx:541
virtual sal_Int16 SAL_CALL getShort(sal_Int32 columnIndex) override
Definition: CacheSet.cxx:408
virtual double SAL_CALL getDouble(sal_Int32 columnIndex) override
Definition: CacheSet.cxx:428
virtual bool last()
Definition: CacheSet.cxx:513
virtual css::uno::Reference< css::sdbc::XClob > SAL_CALL getClob(sal_Int32 columnIndex) override
Definition: CacheSet.cxx:478
static void setParameter(sal_Int32 nPos, const css::uno::Reference< css::sdbc::XParameters > &_xParameter, const connectivity::ORowSetValue &_rValue, sal_Int32 _nType, sal_Int32 _nScale)
Definition: CacheSet.cxx:361
virtual sal_Bool SAL_CALL wasNull() override
Definition: CacheSet.cxx:388
virtual bool absolute(sal_Int32 row)
Definition: CacheSet.cxx:524
virtual void construct(const css::uno::Reference< css::sdbc::XResultSet > &_xDriverSet, const OUString &i_sRowSetFilter)
Definition: CacheSet.cxx:74
virtual css::util::Time SAL_CALL getTime(sal_Int32 columnIndex) override
Definition: CacheSet.cxx:443
virtual void updateRow(const ORowSetRow &_rInsertRow, const ORowSetRow &_rOriginalRow, const connectivity::OSQLTable &_xTable)
Definition: CacheSet.cxx:269
OUString getIdentifierQuoteString() const
Definition: CacheSet.cxx:65
virtual bool isResultSetChanged() const
Definition: CacheSet.cxx:556
virtual bool previous()
Definition: CacheSet.cxx:530
virtual ~OCacheSet() override
Definition: CacheSet.cxx:113
virtual css::uno::Reference< css::sdbc::XArray > SAL_CALL getArray(sal_Int32 columnIndex) override
Definition: CacheSet.cxx:483
void fillTableName(const css::uno::Reference< css::beans::XPropertySet > &_xTable)
Definition: CacheSet.cxx:133
css::uno::Reference< css::sdbcx::XColumnsSupplier > OSQLTable
unsigned char sal_Bool
signed char sal_Int8