12e2212a7SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 32e2212a7SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 42e2212a7SAndrew Rist * or more contributor license agreements. See the NOTICE file 52e2212a7SAndrew Rist * distributed with this work for additional information 62e2212a7SAndrew Rist * regarding copyright ownership. The ASF licenses this file 72e2212a7SAndrew Rist * to you under the Apache License, Version 2.0 (the 82e2212a7SAndrew Rist * "License"); you may not use this file except in compliance 92e2212a7SAndrew Rist * with the License. You may obtain a copy of the License at 102e2212a7SAndrew Rist * 112e2212a7SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 122e2212a7SAndrew Rist * 132e2212a7SAndrew Rist * Unless required by applicable law or agreed to in writing, 142e2212a7SAndrew Rist * software distributed under the License is distributed on an 152e2212a7SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 162e2212a7SAndrew Rist * KIND, either express or implied. See the License for the 172e2212a7SAndrew Rist * specific language governing permissions and limitations 182e2212a7SAndrew Rist * under the License. 192e2212a7SAndrew Rist * 202e2212a7SAndrew Rist *************************************************************/ 212e2212a7SAndrew Rist 222e2212a7SAndrew Rist 23cdf0e10cSrcweir #ifndef DBACCESS_CORE_API_CACHESET_HXX 24cdf0e10cSrcweir #define DBACCESS_CORE_API_CACHESET_HXX 25cdf0e10cSrcweir 26cdf0e10cSrcweir #include <com/sun/star/sdbc/XRow.hpp> 27*b63233d8Sdamjan #include <com/sun/star/sdbc/XRowUpdate.hpp> 28cdf0e10cSrcweir #include <com/sun/star/sdbc/XResultSetMetaData.hpp> 29cdf0e10cSrcweir #include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp> 30cdf0e10cSrcweir #include <com/sun/star/sdbc/XResultSet.hpp> 31cdf0e10cSrcweir #include <com/sun/star/sdbc/XConnection.hpp> 32cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp> 33cdf0e10cSrcweir #include <com/sun/star/sdbcx/XRowLocate.hpp> 34cdf0e10cSrcweir #include <com/sun/star/sdbcx/XDeleteRows.hpp> 35cdf0e10cSrcweir #include <com/sun/star/sdbcx/CompareBookmark.hpp> 36cdf0e10cSrcweir #include "RowSetRow.hxx" 37cdf0e10cSrcweir #include <cppuhelper/implbase1.hxx> 38cdf0e10cSrcweir 39cdf0e10cSrcweir #include <list> 40cdf0e10cSrcweir namespace rtl 41cdf0e10cSrcweir { 42cdf0e10cSrcweir class OUStringBuffer; 43cdf0e10cSrcweir } 44cdf0e10cSrcweir namespace com{ namespace sun { namespace star{namespace sdbc{ class XParameters; } } } } 45cdf0e10cSrcweir 46cdf0e10cSrcweir namespace dbaccess 47cdf0e10cSrcweir { 48cdf0e10cSrcweir class OCacheSet : public ::cppu::WeakImplHelper1< ::com::sun::star::sdbc::XRow> 49cdf0e10cSrcweir { 50cdf0e10cSrcweir protected: 51cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet> m_xDriverSet; 52cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRow> m_xDriverRow; 53cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData> m_xSetMetaData; 54cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> m_xConnection; 55cdf0e10cSrcweir 56cdf0e10cSrcweir ::com::sun::star::uno::Sequence<sal_Bool> m_aNullable; 57cdf0e10cSrcweir ::com::sun::star::uno::Sequence<sal_Bool> m_aSignedFlags; 58cdf0e10cSrcweir ::com::sun::star::uno::Sequence<sal_Int32> m_aColumnTypes; 59cdf0e10cSrcweir ORowSetRow m_aInsertRow; 60cdf0e10cSrcweir ::rtl::OUString m_aComposedTableName; 61cdf0e10cSrcweir sal_Int32 m_nMaxRows; 62cdf0e10cSrcweir sal_Bool m_bInserted; 63cdf0e10cSrcweir sal_Bool m_bUpdated; 64cdf0e10cSrcweir sal_Bool m_bDeleted; 65cdf0e10cSrcweir 66cdf0e10cSrcweir OCacheSet(sal_Int32 i_nMaxRows); 67cdf0e10cSrcweir virtual ~OCacheSet(); 68cdf0e10cSrcweir 69cdf0e10cSrcweir void setParameter(sal_Int32 nPos 70cdf0e10cSrcweir ,const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XParameters >& _xParameter 71cdf0e10cSrcweir ,const connectivity::ORowSetValue& _rValue 72cdf0e10cSrcweir ,sal_Int32 _nType 73cdf0e10cSrcweir ,sal_Int32 _nScale 74cdf0e10cSrcweir ) const; 75cdf0e10cSrcweir void fillParameters( const ORowSetRow& _rRow 76cdf0e10cSrcweir ,const connectivity::OSQLTable& _xTable 77cdf0e10cSrcweir ,::rtl::OUStringBuffer& _sCondition 78cdf0e10cSrcweir ,::rtl::OUStringBuffer& _sParameter 79cdf0e10cSrcweir ,::std::list< sal_Int32>& _rOrgValues); 80cdf0e10cSrcweir void fillTableName(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _xTable) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); 81cdf0e10cSrcweir 82cdf0e10cSrcweir ::rtl::OUString getIdentifierQuoteString() const; 83cdf0e10cSrcweir public: 84cdf0e10cSrcweir 85cdf0e10cSrcweir // late constructor 86cdf0e10cSrcweir virtual void construct(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet>& _xDriverSet,const ::rtl::OUString& i_sRowSetFilter); 87cdf0e10cSrcweir virtual void fillValueRow(ORowSetRow& _rRow,sal_Int32 _nPosition); 88cdf0e10cSrcweir 89cdf0e10cSrcweir // ::com::sun::star::sdbc::XRow 90cdf0e10cSrcweir virtual sal_Bool SAL_CALL wasNull( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); 91cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getString( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); 92cdf0e10cSrcweir virtual sal_Bool SAL_CALL getBoolean( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); 93cdf0e10cSrcweir virtual sal_Int8 SAL_CALL getByte( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); 94cdf0e10cSrcweir virtual sal_Int16 SAL_CALL getShort( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); 95cdf0e10cSrcweir virtual sal_Int32 SAL_CALL getInt( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); 96cdf0e10cSrcweir virtual sal_Int64 SAL_CALL getLong( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); 97cdf0e10cSrcweir virtual float SAL_CALL getFloat( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); 98cdf0e10cSrcweir virtual double SAL_CALL getDouble( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); 99cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getBytes( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); 100cdf0e10cSrcweir virtual ::com::sun::star::util::Date SAL_CALL getDate( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); 101cdf0e10cSrcweir virtual ::com::sun::star::util::Time SAL_CALL getTime( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); 102cdf0e10cSrcweir virtual ::com::sun::star::util::DateTime SAL_CALL getTimestamp( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); 103cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getBinaryStream( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); 104cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getCharacterStream( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); 105cdf0e10cSrcweir virtual ::com::sun::star::uno::Any SAL_CALL getObject( sal_Int32 columnIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& typeMap ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); 106cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRef > SAL_CALL getRef( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); 107cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XBlob > SAL_CALL getBlob( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); 108cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XClob > SAL_CALL getClob( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); 109cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XArray > SAL_CALL getArray( sal_Int32 columnIndex ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); 110cdf0e10cSrcweir // ::com::sun::star::sdbc::XResultSet 111cdf0e10cSrcweir virtual sal_Bool SAL_CALL next( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); 112cdf0e10cSrcweir virtual sal_Bool SAL_CALL isBeforeFirst( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); 113cdf0e10cSrcweir virtual sal_Bool SAL_CALL isAfterLast( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); 114cdf0e10cSrcweir virtual sal_Bool SAL_CALL isFirst( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); 115cdf0e10cSrcweir virtual sal_Bool SAL_CALL isLast( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); 116cdf0e10cSrcweir virtual void SAL_CALL beforeFirst( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); 117cdf0e10cSrcweir virtual void SAL_CALL afterLast( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); 118cdf0e10cSrcweir virtual sal_Bool SAL_CALL first( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); 119cdf0e10cSrcweir virtual sal_Bool SAL_CALL last( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); 120cdf0e10cSrcweir virtual sal_Int32 SAL_CALL getRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); 121cdf0e10cSrcweir virtual sal_Bool SAL_CALL absolute( sal_Int32 row ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); 122cdf0e10cSrcweir virtual sal_Bool SAL_CALL relative( sal_Int32 rows ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); 123cdf0e10cSrcweir virtual sal_Bool SAL_CALL previous( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); 124cdf0e10cSrcweir virtual void SAL_CALL refreshRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); 125cdf0e10cSrcweir virtual sal_Bool SAL_CALL rowUpdated( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); 126cdf0e10cSrcweir virtual sal_Bool SAL_CALL rowInserted( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); 127cdf0e10cSrcweir virtual sal_Bool SAL_CALL rowDeleted( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); 128cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getStatement( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); 129cdf0e10cSrcweir // ::com::sun::star::sdbcx::XRowLocate 130cdf0e10cSrcweir virtual ::com::sun::star::uno::Any SAL_CALL getBookmark() throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) = 0; 131cdf0e10cSrcweir virtual sal_Bool SAL_CALL moveToBookmark( const ::com::sun::star::uno::Any& bookmark ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) = 0; 132cdf0e10cSrcweir virtual sal_Bool SAL_CALL moveRelativeToBookmark( const ::com::sun::star::uno::Any& bookmark, sal_Int32 rows ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) = 0; 133cdf0e10cSrcweir virtual sal_Int32 SAL_CALL compareBookmarks( const ::com::sun::star::uno::Any& first, const ::com::sun::star::uno::Any& second ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) = 0; 134cdf0e10cSrcweir virtual sal_Bool SAL_CALL hasOrderedBookmarks( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) = 0; 135cdf0e10cSrcweir virtual sal_Int32 SAL_CALL hashBookmark( const ::com::sun::star::uno::Any& bookmark ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) = 0; 136cdf0e10cSrcweir // ::com::sun::star::sdbcx::XDeleteRows 137cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL deleteRows( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& rows,const connectivity::OSQLTable& _xTable ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) = 0; 138cdf0e10cSrcweir // ::com::sun::star::sdbc::XResultSetUpdate 139cdf0e10cSrcweir virtual void SAL_CALL insertRow( const ORowSetRow& _rInsertRow,const connectivity::OSQLTable& _xTable ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); 140cdf0e10cSrcweir virtual void SAL_CALL updateRow( const ORowSetRow& _rInsertRow,const ORowSetRow& _rOrginalRow,const connectivity::OSQLTable& _xTable ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) = 0; 141cdf0e10cSrcweir virtual void SAL_CALL deleteRow( const ORowSetRow& _rDeleteRow,const connectivity::OSQLTable& _xTable ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) = 0; 142cdf0e10cSrcweir virtual void SAL_CALL cancelRowUpdates( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) = 0; 143cdf0e10cSrcweir virtual void SAL_CALL moveToInsertRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) = 0; 144cdf0e10cSrcweir virtual void SAL_CALL moveToCurrentRow( ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) = 0; 145cdf0e10cSrcweir 146cdf0e10cSrcweir virtual bool isResultSetChanged() const; 147cdf0e10cSrcweir virtual void reset(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet>& _xDriverSet); 148cdf0e10cSrcweir virtual void mergeColumnValues(sal_Int32 i_nColumnIndex,ORowSetValueVector::Vector& io_aInsertRow,ORowSetValueVector::Vector& io_aRow,::std::vector<sal_Int32>& o_aChangedColumns); 149cdf0e10cSrcweir virtual bool columnValuesUpdated(ORowSetValueVector::Vector& o_aCachedRow,const ORowSetValueVector::Vector& i_aRow); 150cdf0e10cSrcweir virtual bool updateColumnValues(const ORowSetValueVector::Vector& io_aCachedRow,ORowSetValueVector::Vector& io_aRow,const ::std::vector<sal_Int32>& i_aChangedColumns); 151cdf0e10cSrcweir virtual void fillMissingValues(ORowSetValueVector::Vector& io_aRow) const; 152cdf0e10cSrcweir virtual sal_Bool previous_checked( sal_Bool i_bFetchRow ); 153cdf0e10cSrcweir virtual sal_Bool absolute_checked( sal_Int32 row,sal_Bool i_bFetchRow ); 154cdf0e10cSrcweir virtual sal_Bool last_checked( sal_Bool i_bFetchRow); 155cdf0e10cSrcweir }; 156cdf0e10cSrcweir } 157cdf0e10cSrcweir #endif //DBACCESS_CORE_API_CACHESET_HXX 158cdf0e10cSrcweir 159