1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
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"
27 #include <cppuhelper/implbase.hxx>
31 namespace com::sun::star::sdbc
{ class XParameters
; }
35 class OCacheSet
: public ::cppu::WeakImplHelper
< css::sdbc::XRow
>
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
;
43 std::vector
<bool> m_aNullable
;
44 std::vector
<bool> m_aSignedFlags
;
45 std::vector
<sal_Int32
> m_aColumnTypes
;
46 OUString m_aComposedTableName
;
51 OUString m_sRowSetFilter
;
53 explicit OCacheSet(sal_Int32 i_nMaxRows
);
54 virtual ~OCacheSet() override
;
56 static void setParameter(sal_Int32 nPos
57 ,const css::uno::Reference
< css::sdbc::XParameters
>& _xParameter
58 ,const connectivity::ORowSetValue
& _rValue
62 void fillParameters( const ORowSetRow
& _rRow
63 ,const connectivity::OSQLTable
& _xTable
64 ,OUStringBuffer
& _sCondition
65 ,OUStringBuffer
& _sParameter
66 ,std::vector
< sal_Int32
>& _rOrgValues
);
67 /// @throws css::sdbc::SQLException
68 /// @throws css::uno::RuntimeException
69 void fillTableName(const css::uno::Reference
< css::beans::XPropertySet
>& _xTable
);
71 OUString
getIdentifierQuoteString() const;
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
);
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
100 /// @throws css::sdbc::SQLException
101 /// @throws css::uno::RuntimeException
103 /// @throws css::sdbc::SQLException
104 /// @throws css::uno::RuntimeException
105 virtual void beforeFirst( );
106 /// @throws css::sdbc::SQLException
107 /// @throws css::uno::RuntimeException
108 virtual void afterLast( );
109 /// @throws css::sdbc::SQLException
110 /// @throws css::uno::RuntimeException
111 virtual bool first();
112 /// @throws css::sdbc::SQLException
113 /// @throws css::uno::RuntimeException
115 /// @throws css::sdbc::SQLException
116 /// @throws css::uno::RuntimeException
117 virtual sal_Int32
getRow( );
118 /// @throws css::sdbc::SQLException
119 /// @throws css::uno::RuntimeException
120 virtual bool absolute( sal_Int32 row
);
121 /// @throws css::sdbc::SQLException
122 /// @throws css::uno::RuntimeException
123 virtual bool previous( );
124 /// @throws css::sdbc::SQLException
125 /// @throws css::uno::RuntimeException
126 virtual void refreshRow( );
127 /// @throws css::sdbc::SQLException
128 /// @throws css::uno::RuntimeException
129 virtual bool rowUpdated( );
130 /// @throws css::sdbc::SQLException
131 /// @throws css::uno::RuntimeException
132 virtual bool rowInserted( );
133 /// @throws css::sdbc::SQLException
134 /// @throws css::uno::RuntimeException
135 virtual bool rowDeleted( );
136 // css::sdbcx::XRowLocate
137 /// @throws css::sdbc::SQLException
138 /// @throws css::uno::RuntimeException
139 virtual css::uno::Any
getBookmark() = 0;
140 /// @throws css::sdbc::SQLException
141 /// @throws css::uno::RuntimeException
142 virtual bool moveToBookmark( const css::uno::Any
& bookmark
) = 0;
143 /// @throws css::sdbc::SQLException
144 /// @throws css::uno::RuntimeException
145 virtual sal_Int32
compareBookmarks( const css::uno::Any
& first
, const css::uno::Any
& second
) = 0;
146 /// @throws css::sdbc::SQLException
147 /// @throws css::uno::RuntimeException
148 virtual bool hasOrderedBookmarks( ) = 0;
149 /// @throws css::sdbc::SQLException
150 /// @throws css::uno::RuntimeException
151 virtual sal_Int32
hashBookmark( const css::uno::Any
& bookmark
) = 0;
152 // css::sdbc::XResultSetUpdate
153 /// @throws css::sdbc::SQLException
154 /// @throws css::uno::RuntimeException
155 virtual void insertRow( const ORowSetRow
& _rInsertRow
,const connectivity::OSQLTable
& _xTable
);
156 /// @throws css::sdbc::SQLException
157 /// @throws css::uno::RuntimeException
158 virtual void updateRow( const ORowSetRow
& _rInsertRow
,const ORowSetRow
& _rOriginalRow
,const connectivity::OSQLTable
& _xTable
);
159 /// @throws css::sdbc::SQLException
160 /// @throws css::uno::RuntimeException
161 virtual void deleteRow( const ORowSetRow
& _rDeleteRow
,const connectivity::OSQLTable
& _xTable
) = 0;
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;
172 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */