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