LibreOffice Module dbaccess (master) 1
OptimisticSet.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
20#pragma once
21
22#include "KeySet.hxx"
23
26
27#include <com/sun/star/sdb/XSingleSelectQueryAnalyzer.hpp>
28
29namespace dbaccess
30{
31 // is used when the source supports keys
32 class OptimisticSet : public OKeySet
33 {
36
37 std::map<sal_Int32,sal_Int32> m_aJoinedColumns;
38 std::map<sal_Int32,sal_Int32> m_aJoinedKeyColumns;
39
40 mutable bool m_bResultSetChanged;
41
42 void executeDelete(const ORowSetRow& _rDeleteRow,const OUString& i_sSQL,std::u16string_view i_sTableName);
43 void fillJoinedColumns_throw(const std::vector< ::connectivity::TNodePair>& i_aJoinColumns);
44 void fillJoinedColumns_throw(const OUString& i_sLeftColumn,const OUString& i_sRightColumn);
45 protected:
46 virtual void makeNewStatement( ) override;
47 virtual ~OptimisticSet() override;
48 public:
49 OptimisticSet(const css::uno::Reference< css::uno::XComponentContext>& _rContext,
50 const css::uno::Reference< css::sdbc::XConnection>& i_xConnection,
51 const css::uno::Reference< css::sdb::XSingleSelectQueryAnalyzer >& _xComposer,
52 const ORowSetValueVector& _aParameterValueForCache,
53 sal_Int32 i_nMaxRows,
54 sal_Int32& o_nRowCount);
55
56 // late ctor which can throw exceptions
57 virtual void construct(const css::uno::Reference< css::sdbc::XResultSet>& _xDriverSet,const OUString& i_sRowSetFilter) override;
58
59 // css::sdbc::XResultSetUpdate
60 virtual void updateRow(const ORowSetRow& _rInsertRow,const ORowSetRow& _rOriginalRow,const connectivity::OSQLTable& _xTable ) override;
61 virtual void deleteRow(const ORowSetRow& _rInsertRow,const connectivity::OSQLTable& _xTable ) override;
62 virtual void insertRow( const ORowSetRow& _rInsertRow,const connectivity::OSQLTable& _xTable ) override;
63
64 // CacheSet
65 virtual bool isResultSetChanged() const override;
66 virtual void mergeColumnValues(sal_Int32 i_nColumnIndex,ORowSetValueVector::Vector& io_aInsertRow,ORowSetValueVector::Vector& io_aRow,std::vector<sal_Int32>& o_aChangedColumns) override;
67 virtual bool columnValuesUpdated(ORowSetValueVector::Vector& o_aCachedRow,const ORowSetValueVector::Vector& i_aRow) override;
68 virtual bool updateColumnValues(const ORowSetValueVector::Vector& io_aCachedRow,ORowSetValueVector::Vector& io_aRow,const std::vector<sal_Int32>& i_aChangedColumns) override;
69 virtual void fillMissingValues(ORowSetValueVector::Vector& io_aRow) const override;
70
71 bool isReadOnly() const { return m_aJoinedKeyColumns.empty(); }
72 const std::map<sal_Int32,sal_Int32>& getJoinedKeyColumns() const { return m_aJoinedKeyColumns; }
73 };
74}
75
76/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::vector< VectorVal > Vector
virtual void deleteRow(const ORowSetRow &_rInsertRow, const connectivity::OSQLTable &_xTable) override
OptimisticSet(const css::uno::Reference< css::uno::XComponentContext > &_rContext, const css::uno::Reference< css::sdbc::XConnection > &i_xConnection, const css::uno::Reference< css::sdb::XSingleSelectQueryAnalyzer > &_xComposer, const ORowSetValueVector &_aParameterValueForCache, sal_Int32 i_nMaxRows, sal_Int32 &o_nRowCount)
const std::map< sal_Int32, sal_Int32 > & getJoinedKeyColumns() const
virtual void updateRow(const ORowSetRow &_rInsertRow, const ORowSetRow &_rOriginalRow, const connectivity::OSQLTable &_xTable) override
virtual void construct(const css::uno::Reference< css::sdbc::XResultSet > &_xDriverSet, const OUString &i_sRowSetFilter) override
virtual void makeNewStatement() override
virtual ~OptimisticSet() override
void fillJoinedColumns_throw(const std::vector< ::connectivity::TNodePair > &i_aJoinColumns)
void executeDelete(const ORowSetRow &_rDeleteRow, const OUString &i_sSQL, std::u16string_view i_sTableName)
virtual bool updateColumnValues(const ORowSetValueVector::Vector &io_aCachedRow, ORowSetValueVector::Vector &io_aRow, const std::vector< sal_Int32 > &i_aChangedColumns) override
::connectivity::OSQLParser m_aSqlParser
virtual void fillMissingValues(ORowSetValueVector::Vector &io_aRow) const override
virtual bool isResultSetChanged() const override
std::map< sal_Int32, sal_Int32 > m_aJoinedKeyColumns
virtual void mergeColumnValues(sal_Int32 i_nColumnIndex, ORowSetValueVector::Vector &io_aInsertRow, ORowSetValueVector::Vector &io_aRow, std::vector< sal_Int32 > &o_aChangedColumns) override
virtual bool columnValuesUpdated(ORowSetValueVector::Vector &o_aCachedRow, const ORowSetValueVector::Vector &i_aRow) override
virtual void insertRow(const ORowSetRow &_rInsertRow, const connectivity::OSQLTable &_xTable) override
std::map< sal_Int32, sal_Int32 > m_aJoinedColumns
::connectivity::OSQLParseTreeIterator m_aSqlIterator
css::uno::Reference< css::sdbcx::XColumnsSupplier > OSQLTable