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
10*2e2212a7SAndrew Rist  *
11*2e2212a7SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*2e2212a7SAndrew Rist  *
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.
19*2e2212a7SAndrew Rist  *
20*2e2212a7SAndrew Rist  *************************************************************/
21*2e2212a7SAndrew Rist 
22*2e2212a7SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef DBACCESS_CORE_API_STATICSET_HXX
25cdf0e10cSrcweir #define DBACCESS_CORE_API_STATICSET_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #ifndef DBACCESS_CORE_API_CACHESET_HXX
28cdf0e10cSrcweir #include "CacheSet.hxx"
29cdf0e10cSrcweir #endif
30cdf0e10cSrcweir 
31cdf0e10cSrcweir namespace dbaccess
32cdf0e10cSrcweir {
33cdf0e10cSrcweir 	// is used when nothing is supported by the driver
34cdf0e10cSrcweir 	// we use a snapshot
35cdf0e10cSrcweir 	class OStaticSet : public OCacheSet
36cdf0e10cSrcweir 	{
37cdf0e10cSrcweir 		ORowSetMatrix			m_aSet;
38cdf0e10cSrcweir 		ORowSetMatrix::iterator m_aSetIter;
39cdf0e10cSrcweir 		sal_Bool				m_bEnd;
40cdf0e10cSrcweir 		sal_Bool fetchRow();
41cdf0e10cSrcweir 		void fillAllRows();
42cdf0e10cSrcweir 	public:
OStaticSet(sal_Int32 i_nMaxRows)43cdf0e10cSrcweir         OStaticSet(sal_Int32 i_nMaxRows) : OCacheSet(i_nMaxRows)
44cdf0e10cSrcweir 			, m_aSetIter(m_aSet.end())
45cdf0e10cSrcweir 			, m_bEnd(sal_False)
46cdf0e10cSrcweir 		{
47cdf0e10cSrcweir 			m_aSet.push_back(NULL); // this is the beforefirst record
48cdf0e10cSrcweir 		}
49cdf0e10cSrcweir 
50cdf0e10cSrcweir 		virtual void fillValueRow(ORowSetRow& _rRow,sal_Int32 _nPosition);
51cdf0e10cSrcweir 		// ::com::sun::star::sdbcx::XRowLocate
52cdf0e10cSrcweir 		virtual ::com::sun::star::uno::Any SAL_CALL getBookmark() throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
53cdf0e10cSrcweir 		virtual sal_Bool SAL_CALL moveToBookmark( const ::com::sun::star::uno::Any& bookmark ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
54cdf0e10cSrcweir 		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);
55cdf0e10cSrcweir 		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);
56cdf0e10cSrcweir 		virtual sal_Bool SAL_CALL hasOrderedBookmarks(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
57cdf0e10cSrcweir 		virtual sal_Int32 SAL_CALL hashBookmark( const ::com::sun::star::uno::Any& bookmark ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
58cdf0e10cSrcweir 
59cdf0e10cSrcweir 		// ::com::sun::star::sdbc::XResultSet
60cdf0e10cSrcweir 		virtual sal_Bool SAL_CALL next(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
61cdf0e10cSrcweir 		virtual sal_Bool SAL_CALL isBeforeFirst(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
62cdf0e10cSrcweir 		virtual sal_Bool SAL_CALL isAfterLast(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
63cdf0e10cSrcweir 		virtual sal_Bool SAL_CALL isFirst(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
64cdf0e10cSrcweir 		virtual sal_Bool SAL_CALL isLast(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
65cdf0e10cSrcweir 		virtual void SAL_CALL beforeFirst(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
66cdf0e10cSrcweir 		virtual void SAL_CALL afterLast(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
67cdf0e10cSrcweir 		virtual sal_Bool SAL_CALL first(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
68cdf0e10cSrcweir 		virtual sal_Bool SAL_CALL last(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
69cdf0e10cSrcweir 		virtual sal_Int32 SAL_CALL getRow(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
70cdf0e10cSrcweir 		virtual sal_Bool SAL_CALL absolute( sal_Int32 row ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
71cdf0e10cSrcweir 		virtual sal_Bool SAL_CALL relative( sal_Int32 rows ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
72cdf0e10cSrcweir 		virtual sal_Bool SAL_CALL previous(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
73cdf0e10cSrcweir 		virtual void SAL_CALL refreshRow(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
74cdf0e10cSrcweir 		virtual sal_Bool SAL_CALL rowUpdated(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
75cdf0e10cSrcweir 		virtual sal_Bool SAL_CALL rowInserted(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
76cdf0e10cSrcweir 		virtual sal_Bool SAL_CALL rowDeleted(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
77cdf0e10cSrcweir 		// ::com::sun::star::sdbcx::XDeleteRows
78cdf0e10cSrcweir 		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);
79cdf0e10cSrcweir 		// ::com::sun::star::sdbc::XResultSetUpdate
80cdf0e10cSrcweir 		virtual void SAL_CALL insertRow( const ORowSetRow& _rInsertRow,const connectivity::OSQLTable& _xTable ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
81cdf0e10cSrcweir 		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);
82cdf0e10cSrcweir 		virtual void SAL_CALL deleteRow(const ORowSetRow& _rInsertRow,const connectivity::OSQLTable& _xTable  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
83cdf0e10cSrcweir 		virtual void SAL_CALL cancelRowUpdates(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
84cdf0e10cSrcweir 		virtual void SAL_CALL moveToInsertRow(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
85cdf0e10cSrcweir 		virtual void SAL_CALL moveToCurrentRow(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
86cdf0e10cSrcweir 	};
87cdf0e10cSrcweir }
88cdf0e10cSrcweir #endif //DBACCESS_CORE_API_STATICSET_HXX
89cdf0e10cSrcweir 
90