1*96de5490SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*96de5490SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*96de5490SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*96de5490SAndrew Rist  * distributed with this work for additional information
6*96de5490SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*96de5490SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*96de5490SAndrew Rist  * "License"); you may not use this file except in compliance
9*96de5490SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*96de5490SAndrew Rist  *
11*96de5490SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*96de5490SAndrew Rist  *
13*96de5490SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*96de5490SAndrew Rist  * software distributed under the License is distributed on an
15*96de5490SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*96de5490SAndrew Rist  * KIND, either express or implied.  See the License for the
17*96de5490SAndrew Rist  * specific language governing permissions and limitations
18*96de5490SAndrew Rist  * under the License.
19*96de5490SAndrew Rist  *
20*96de5490SAndrew Rist  *************************************************************/
21*96de5490SAndrew Rist 
22*96de5490SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_dbaccess.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #ifndef DBACCESS_CORE_API_STATICSET_HXX
28cdf0e10cSrcweir #include "StaticSet.hxx"
29cdf0e10cSrcweir #endif
30cdf0e10cSrcweir #ifndef _COM_SUN_STAR_SDBCX_COMPAREBOOKMARK_HPP_
31cdf0e10cSrcweir #include <com/sun/star/sdbcx/CompareBookmark.hpp>
32cdf0e10cSrcweir #endif
33cdf0e10cSrcweir #ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
34cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp>
35cdf0e10cSrcweir #endif
36cdf0e10cSrcweir #ifndef _COM_SUN_STAR_SDBC_XDATABASEMETADATA_HPP_
37cdf0e10cSrcweir #include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
38cdf0e10cSrcweir #endif
39cdf0e10cSrcweir #ifndef _COM_SUN_STAR_SDBC_XPREPAREDSTATEMENT_HPP_
40cdf0e10cSrcweir #include <com/sun/star/sdbc/XPreparedStatement.hpp>
41cdf0e10cSrcweir #endif
42cdf0e10cSrcweir #ifndef DBACCESS_SHARED_DBASTRINGS_HRC
43cdf0e10cSrcweir #include "dbastrings.hrc"
44cdf0e10cSrcweir #endif
45cdf0e10cSrcweir #ifndef _DBASHARED_APITOOLS_HXX_
46cdf0e10cSrcweir #include "apitools.hxx"
47cdf0e10cSrcweir #endif
48cdf0e10cSrcweir #ifndef _CONNECTIVITY_COMMONTOOLS_HXX_
49cdf0e10cSrcweir #include <connectivity/CommonTools.hxx>
50cdf0e10cSrcweir #endif
51cdf0e10cSrcweir #ifndef _COMPHELPER_TYPES_HXX_
52cdf0e10cSrcweir #include <comphelper/types.hxx>
53cdf0e10cSrcweir #endif
54cdf0e10cSrcweir #include <rtl/logfile.hxx>
55cdf0e10cSrcweir 
56cdf0e10cSrcweir using namespace dbaccess;
57cdf0e10cSrcweir using namespace connectivity;
58cdf0e10cSrcweir using namespace ::com::sun::star::uno;
59cdf0e10cSrcweir using namespace ::com::sun::star::beans;
60cdf0e10cSrcweir using namespace ::com::sun::star::sdbc;
61cdf0e10cSrcweir //	using namespace ::com::sun::star::sdb;
62cdf0e10cSrcweir using namespace ::com::sun::star::sdbcx;
63cdf0e10cSrcweir using namespace ::com::sun::star::container;
64cdf0e10cSrcweir using namespace ::com::sun::star::lang;
65cdf0e10cSrcweir //	using namespace ::cppu;
66cdf0e10cSrcweir using namespace ::osl;
67cdf0e10cSrcweir 
68cdf0e10cSrcweir // -------------------------------------------------------------------------
fillValueRow(ORowSetRow & _rRow,sal_Int32)69cdf0e10cSrcweir void OStaticSet::fillValueRow(ORowSetRow& _rRow,sal_Int32 /*_nPosition*/)
70cdf0e10cSrcweir {
71cdf0e10cSrcweir     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStaticSet::fillValueRow" );
72cdf0e10cSrcweir 	_rRow = *m_aSetIter;
73cdf0e10cSrcweir }
74cdf0e10cSrcweir // -------------------------------------------------------------------------
75cdf0e10cSrcweir // ::com::sun::star::sdbcx::XRowLocate
getBookmark()76cdf0e10cSrcweir Any SAL_CALL OStaticSet::getBookmark() throw(SQLException, RuntimeException)
77cdf0e10cSrcweir {
78cdf0e10cSrcweir     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStaticSet::getBookmark" );
79cdf0e10cSrcweir 	return makeAny(getRow());
80cdf0e10cSrcweir }
81cdf0e10cSrcweir // -------------------------------------------------------------------------
moveToBookmark(const Any & bookmark)82cdf0e10cSrcweir sal_Bool SAL_CALL OStaticSet::moveToBookmark( const Any& bookmark ) throw(SQLException, RuntimeException)
83cdf0e10cSrcweir {
84cdf0e10cSrcweir     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStaticSet::moveToBookmark" );
85cdf0e10cSrcweir 	m_bInserted = m_bUpdated = m_bDeleted = sal_False;
86cdf0e10cSrcweir 	return absolute(::comphelper::getINT32(bookmark));
87cdf0e10cSrcweir }
88cdf0e10cSrcweir // -------------------------------------------------------------------------
moveRelativeToBookmark(const Any & bookmark,sal_Int32 rows)89cdf0e10cSrcweir sal_Bool SAL_CALL OStaticSet::moveRelativeToBookmark( const Any& bookmark, sal_Int32 rows ) throw(SQLException, RuntimeException)
90cdf0e10cSrcweir {
91cdf0e10cSrcweir     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStaticSet::moveRelativeToBookmark" );
92cdf0e10cSrcweir 	m_bInserted = m_bUpdated = m_bDeleted = sal_False;
93cdf0e10cSrcweir 	return absolute(::comphelper::getINT32(bookmark)+rows);
94cdf0e10cSrcweir }
95cdf0e10cSrcweir // -------------------------------------------------------------------------
compareBookmarks(const Any & _first,const Any & _second)96cdf0e10cSrcweir sal_Int32 SAL_CALL OStaticSet::compareBookmarks( const Any& _first, const Any& _second ) throw(SQLException, RuntimeException)
97cdf0e10cSrcweir {
98cdf0e10cSrcweir     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStaticSet::compareBookmarks" );
99cdf0e10cSrcweir 	sal_Int32 nFirst = 0, nSecond = 0;
100cdf0e10cSrcweir 	_first >>= nFirst;
101cdf0e10cSrcweir 	_second >>= nSecond;
102cdf0e10cSrcweir 	return (nFirst < nSecond) ? CompareBookmark::LESS : ((nFirst > nSecond) ? CompareBookmark::GREATER : CompareBookmark::EQUAL);
103cdf0e10cSrcweir }
104cdf0e10cSrcweir // -------------------------------------------------------------------------
hasOrderedBookmarks()105cdf0e10cSrcweir sal_Bool SAL_CALL OStaticSet::hasOrderedBookmarks(  ) throw(SQLException, RuntimeException)
106cdf0e10cSrcweir {
107cdf0e10cSrcweir     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStaticSet::hasOrderedBookmarks" );
108cdf0e10cSrcweir 	return sal_True;
109cdf0e10cSrcweir }
110cdf0e10cSrcweir // -------------------------------------------------------------------------
hashBookmark(const Any & bookmark)111cdf0e10cSrcweir sal_Int32 SAL_CALL OStaticSet::hashBookmark( const Any& bookmark ) throw(SQLException, RuntimeException)
112cdf0e10cSrcweir {
113cdf0e10cSrcweir     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStaticSet::hashBookmark" );
114cdf0e10cSrcweir 	return ::comphelper::getINT32(bookmark);
115cdf0e10cSrcweir }
116cdf0e10cSrcweir // -------------------------------------------------------------------------
fetchRow()117cdf0e10cSrcweir sal_Bool OStaticSet::fetchRow()
118cdf0e10cSrcweir {
119cdf0e10cSrcweir     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStaticSet::fetchRow" );
120cdf0e10cSrcweir 	sal_Bool bRet = sal_False;
121cdf0e10cSrcweir 	if ( !m_bEnd && (!m_nMaxRows || sal_Int32(m_aSet.size()) < m_nMaxRows) )
122cdf0e10cSrcweir         bRet = m_xDriverSet->next();
123cdf0e10cSrcweir     if ( bRet )
124cdf0e10cSrcweir 	{
125cdf0e10cSrcweir 		m_aSet.push_back(new connectivity::ORowVector< connectivity::ORowSetValue >(m_xSetMetaData->getColumnCount()));
126cdf0e10cSrcweir 		m_aSetIter = m_aSet.end() - 1;
127cdf0e10cSrcweir 		((*m_aSetIter)->get())[0] = getRow();
128cdf0e10cSrcweir 		OCacheSet::fillValueRow(*m_aSetIter,((*m_aSetIter)->get())[0]);
129cdf0e10cSrcweir 	}
130cdf0e10cSrcweir 	else
131cdf0e10cSrcweir 		m_bEnd = sal_True;
132cdf0e10cSrcweir 	return bRet;
133cdf0e10cSrcweir }
134cdf0e10cSrcweir // -------------------------------------------------------------------------
fillAllRows()135cdf0e10cSrcweir void OStaticSet::fillAllRows()
136cdf0e10cSrcweir {
137cdf0e10cSrcweir     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStaticSet::fillAllRows" );
138cdf0e10cSrcweir 	if(!m_bEnd)
139cdf0e10cSrcweir 	{
140cdf0e10cSrcweir         sal_Int32 nColumnCount = m_xSetMetaData->getColumnCount();
141cdf0e10cSrcweir 		while(m_xDriverSet->next())
142cdf0e10cSrcweir 		{
143cdf0e10cSrcweir 			ORowSetRow pRow = new connectivity::ORowVector< connectivity::ORowSetValue >(nColumnCount);
144cdf0e10cSrcweir 			m_aSet.push_back(pRow);
145cdf0e10cSrcweir 			m_aSetIter = m_aSet.end() - 1;
146cdf0e10cSrcweir 			(pRow->get())[0] = getRow();
147cdf0e10cSrcweir 			OCacheSet::fillValueRow(pRow,(pRow->get())[0]);
148cdf0e10cSrcweir 		}
149cdf0e10cSrcweir 		m_bEnd = sal_True;
150cdf0e10cSrcweir 	}
151cdf0e10cSrcweir }
152cdf0e10cSrcweir // -------------------------------------------------------------------------
153cdf0e10cSrcweir // XResultSet
next()154cdf0e10cSrcweir sal_Bool SAL_CALL OStaticSet::next(  ) throw(SQLException, RuntimeException)
155cdf0e10cSrcweir {
156cdf0e10cSrcweir     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStaticSet::next" );
157cdf0e10cSrcweir 	m_bInserted = m_bUpdated = m_bDeleted = sal_False;
158cdf0e10cSrcweir 
159cdf0e10cSrcweir 	if(isAfterLast())
160cdf0e10cSrcweir 		return sal_False;
161cdf0e10cSrcweir 	if(!m_bEnd) // not yet all records fetched
162cdf0e10cSrcweir 	{
163cdf0e10cSrcweir 		++m_aSetIter;
164cdf0e10cSrcweir 		if(m_aSetIter == m_aSet.end() && !fetchRow())
165cdf0e10cSrcweir 			m_aSetIter = m_aSet.end();
166cdf0e10cSrcweir 	}
167cdf0e10cSrcweir 	else if(!isAfterLast())
168cdf0e10cSrcweir 		++m_aSetIter;
169cdf0e10cSrcweir 	return !isAfterLast();
170cdf0e10cSrcweir }
171cdf0e10cSrcweir // -------------------------------------------------------------------------
isBeforeFirst()172cdf0e10cSrcweir sal_Bool SAL_CALL OStaticSet::isBeforeFirst(  ) throw(SQLException, RuntimeException)
173cdf0e10cSrcweir {
174cdf0e10cSrcweir     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStaticSet::isBeforeFirst" );
175cdf0e10cSrcweir 	return m_aSetIter == m_aSet.begin();
176cdf0e10cSrcweir }
177cdf0e10cSrcweir // -------------------------------------------------------------------------
isAfterLast()178cdf0e10cSrcweir sal_Bool SAL_CALL OStaticSet::isAfterLast(  ) throw(SQLException, RuntimeException)
179cdf0e10cSrcweir {
180cdf0e10cSrcweir     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStaticSet::isAfterLast" );
181cdf0e10cSrcweir 	return m_aSetIter == m_aSet.end() && m_bEnd;
182cdf0e10cSrcweir }
183cdf0e10cSrcweir // -------------------------------------------------------------------------
isFirst()184cdf0e10cSrcweir sal_Bool SAL_CALL OStaticSet::isFirst(  ) throw(SQLException, RuntimeException)
185cdf0e10cSrcweir {
186cdf0e10cSrcweir     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStaticSet::isFirst" );
187cdf0e10cSrcweir 	return m_aSetIter == m_aSet.begin()+1;
188cdf0e10cSrcweir }
189cdf0e10cSrcweir // -------------------------------------------------------------------------
isLast()190cdf0e10cSrcweir sal_Bool SAL_CALL OStaticSet::isLast(  ) throw(SQLException, RuntimeException)
191cdf0e10cSrcweir {
192cdf0e10cSrcweir     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStaticSet::isLast" );
193cdf0e10cSrcweir 	return m_aSetIter == m_aSet.end()-1 && m_bEnd;
194cdf0e10cSrcweir }
195cdf0e10cSrcweir // -------------------------------------------------------------------------
beforeFirst()196cdf0e10cSrcweir void SAL_CALL OStaticSet::beforeFirst(  ) throw(SQLException, RuntimeException)
197cdf0e10cSrcweir {
198cdf0e10cSrcweir     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStaticSet::beforeFirst" );
199cdf0e10cSrcweir 	m_bInserted = m_bUpdated = m_bDeleted = sal_False;
200cdf0e10cSrcweir 	m_aSetIter = m_aSet.begin();
201cdf0e10cSrcweir }
202cdf0e10cSrcweir // -------------------------------------------------------------------------
afterLast()203cdf0e10cSrcweir void SAL_CALL OStaticSet::afterLast(  ) throw(SQLException, RuntimeException)
204cdf0e10cSrcweir {
205cdf0e10cSrcweir     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStaticSet::afterLast" );
206cdf0e10cSrcweir 	m_bInserted = m_bUpdated = m_bDeleted = sal_False;
207cdf0e10cSrcweir 	fillAllRows();
208cdf0e10cSrcweir 	m_aSetIter = m_aSet.end();
209cdf0e10cSrcweir }
210cdf0e10cSrcweir // -------------------------------------------------------------------------
first()211cdf0e10cSrcweir sal_Bool SAL_CALL OStaticSet::first(  ) throw(SQLException, RuntimeException)
212cdf0e10cSrcweir {
213cdf0e10cSrcweir     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStaticSet::first" );
214cdf0e10cSrcweir 	m_bInserted = m_bUpdated = m_bDeleted = sal_False;
215cdf0e10cSrcweir 	m_aSetIter = m_aSet.begin()+1;
216cdf0e10cSrcweir 	if(m_aSetIter == m_aSet.end() && !fetchRow())
217cdf0e10cSrcweir 		m_aSetIter = m_aSet.end();
218cdf0e10cSrcweir 
219cdf0e10cSrcweir 	return m_aSetIter != m_aSet.end();
220cdf0e10cSrcweir }
221cdf0e10cSrcweir // -------------------------------------------------------------------------
last()222cdf0e10cSrcweir sal_Bool SAL_CALL OStaticSet::last(  ) throw(SQLException, RuntimeException)
223cdf0e10cSrcweir {
224cdf0e10cSrcweir     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStaticSet::last" );
225cdf0e10cSrcweir 	m_bInserted = m_bUpdated = m_bDeleted = sal_False;
226cdf0e10cSrcweir 	fillAllRows();
227cdf0e10cSrcweir 	m_aSetIter = m_aSet.end()-1;
228cdf0e10cSrcweir 
229cdf0e10cSrcweir 	return !isBeforeFirst() && !isAfterLast();
230cdf0e10cSrcweir }
231cdf0e10cSrcweir // -------------------------------------------------------------------------
getRow()232cdf0e10cSrcweir sal_Int32 SAL_CALL OStaticSet::getRow(  ) throw(SQLException, RuntimeException)
233cdf0e10cSrcweir {
234cdf0e10cSrcweir     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStaticSet::getRow" );
235cdf0e10cSrcweir 	OSL_ENSURE(!isAfterLast(),"getRow is not allowed when afterlast record!");
236cdf0e10cSrcweir 	OSL_ENSURE(!isBeforeFirst(),"getRow is not allowed when beforefirst record!");
237cdf0e10cSrcweir 
238cdf0e10cSrcweir 	sal_Int32 nPos = m_aSet.size() - (m_aSet.end() - m_aSetIter);
239cdf0e10cSrcweir 	OSL_ENSURE(nPos > 0,"RowPos is < 0");
240cdf0e10cSrcweir 	return nPos;
241cdf0e10cSrcweir }
242cdf0e10cSrcweir // -------------------------------------------------------------------------
absolute(sal_Int32 row)243cdf0e10cSrcweir sal_Bool SAL_CALL OStaticSet::absolute( sal_Int32 row ) throw(SQLException, RuntimeException)
244cdf0e10cSrcweir {
245cdf0e10cSrcweir     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStaticSet::absolute" );
246cdf0e10cSrcweir 	m_bInserted = m_bUpdated = m_bDeleted = sal_False;
247cdf0e10cSrcweir 	OSL_ENSURE(row,"OStaticSet::absolute: INVALID row number!");
248cdf0e10cSrcweir 	// if row greater 0 than count from end - row means last
249cdf0e10cSrcweir 	if(row < 0)
250cdf0e10cSrcweir 	{
251cdf0e10cSrcweir 		if(!m_bEnd)
252cdf0e10cSrcweir 			fillAllRows();
253cdf0e10cSrcweir 
254cdf0e10cSrcweir 		sal_Int32 nRow = getRow();
255cdf0e10cSrcweir 		nRow += row;
256cdf0e10cSrcweir 		if(nRow <= (sal_Int32)m_aSet.size())
257cdf0e10cSrcweir 			m_aSetIter = m_aSet.begin() + nRow;
258cdf0e10cSrcweir 		else
259cdf0e10cSrcweir 			m_aSetIter = m_aSet.begin();
260cdf0e10cSrcweir 	}
261cdf0e10cSrcweir 	else if(row > 0)
262cdf0e10cSrcweir 	{
263cdf0e10cSrcweir 		if(row >= (sal_Int32)m_aSet.size())
264cdf0e10cSrcweir 		{
265cdf0e10cSrcweir 			if(!m_bEnd)
266cdf0e10cSrcweir 			{
267cdf0e10cSrcweir 				sal_Bool bNext = sal_True;
268cdf0e10cSrcweir 				for(sal_Int32 i=m_aSet.size()-1;i < row && bNext;++i)
269cdf0e10cSrcweir 					bNext = fetchRow();
270cdf0e10cSrcweir 			}
271cdf0e10cSrcweir 
272cdf0e10cSrcweir 			if(row > (sal_Int32)m_aSet.size())
273cdf0e10cSrcweir 				m_aSetIter = m_aSet.end();	// check again
274cdf0e10cSrcweir 			else
275cdf0e10cSrcweir 				m_aSetIter = m_aSet.begin() + row;
276cdf0e10cSrcweir 		}
277cdf0e10cSrcweir 		else
278cdf0e10cSrcweir 			m_aSetIter = m_aSet.begin() + row;
279cdf0e10cSrcweir 	}
280cdf0e10cSrcweir 
281cdf0e10cSrcweir 	return m_aSetIter != m_aSet.end() && m_aSetIter != m_aSet.begin();
282cdf0e10cSrcweir }
283cdf0e10cSrcweir // -------------------------------------------------------------------------
relative(sal_Int32 rows)284cdf0e10cSrcweir sal_Bool SAL_CALL OStaticSet::relative( sal_Int32 rows ) throw(SQLException, RuntimeException)
285cdf0e10cSrcweir {
286cdf0e10cSrcweir     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStaticSet::relative" );
287cdf0e10cSrcweir 	if(!rows)
288cdf0e10cSrcweir 		return sal_True;
289cdf0e10cSrcweir 
290cdf0e10cSrcweir 	sal_Int32 nCurPos = getRow();
291cdf0e10cSrcweir 	return absolute(nCurPos+rows);
292cdf0e10cSrcweir }
293cdf0e10cSrcweir // -------------------------------------------------------------------------
previous()294cdf0e10cSrcweir sal_Bool SAL_CALL OStaticSet::previous(  ) throw(SQLException, RuntimeException)
295cdf0e10cSrcweir {
296cdf0e10cSrcweir     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStaticSet::previous" );
297cdf0e10cSrcweir 	m_bInserted = m_bUpdated = m_bDeleted = sal_False;
298cdf0e10cSrcweir 
299cdf0e10cSrcweir 	if(m_aSetIter != m_aSet.begin())
300cdf0e10cSrcweir 		--m_aSetIter;
301cdf0e10cSrcweir 
302cdf0e10cSrcweir 	return m_aSetIter != m_aSet.begin();
303cdf0e10cSrcweir }
304cdf0e10cSrcweir // -------------------------------------------------------------------------
refreshRow()305cdf0e10cSrcweir void SAL_CALL OStaticSet::refreshRow(  ) throw(SQLException, RuntimeException)
306cdf0e10cSrcweir {
307cdf0e10cSrcweir     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStaticSet::refreshRow" );
308cdf0e10cSrcweir }
309cdf0e10cSrcweir // -------------------------------------------------------------------------
rowUpdated()310cdf0e10cSrcweir sal_Bool SAL_CALL OStaticSet::rowUpdated(  ) throw(SQLException, RuntimeException)
311cdf0e10cSrcweir {
312cdf0e10cSrcweir     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStaticSet::rowUpdated" );
313cdf0e10cSrcweir 	return m_bUpdated;
314cdf0e10cSrcweir }
315cdf0e10cSrcweir // -------------------------------------------------------------------------
rowInserted()316cdf0e10cSrcweir sal_Bool SAL_CALL OStaticSet::rowInserted(  ) throw(SQLException, RuntimeException)
317cdf0e10cSrcweir {
318cdf0e10cSrcweir     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStaticSet::rowInserted" );
319cdf0e10cSrcweir 	return m_bInserted;
320cdf0e10cSrcweir }
321cdf0e10cSrcweir // -------------------------------------------------------------------------
rowDeleted()322cdf0e10cSrcweir sal_Bool SAL_CALL OStaticSet::rowDeleted(  ) throw(SQLException, RuntimeException)
323cdf0e10cSrcweir {
324cdf0e10cSrcweir     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStaticSet::rowDeleted" );
325cdf0e10cSrcweir 	return m_bDeleted;
326cdf0e10cSrcweir }
327cdf0e10cSrcweir // -------------------------------------------------------------------------
deleteRows(const Sequence<Any> & rows,const connectivity::OSQLTable & _xTable)328cdf0e10cSrcweir Sequence< sal_Int32 > SAL_CALL OStaticSet::deleteRows( const Sequence< Any >& rows,const connectivity::OSQLTable& _xTable ) throw(SQLException, RuntimeException)
329cdf0e10cSrcweir {
330cdf0e10cSrcweir     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStaticSet::deleteRows" );
331cdf0e10cSrcweir 	Sequence< sal_Int32 > aRet(rows.getLength());
332cdf0e10cSrcweir 	const Any* pBegin	= rows.getConstArray();
333cdf0e10cSrcweir 	const Any* pEnd		= pBegin + rows.getLength();
334cdf0e10cSrcweir 	for(sal_Int32 i=0;pBegin != pEnd; ++pBegin,++i)
335cdf0e10cSrcweir 	{
336cdf0e10cSrcweir 		deleteRow(*(m_aSet.begin() + comphelper::getINT32(*pBegin)),_xTable);
337cdf0e10cSrcweir 		aRet.getArray()[i] = m_bDeleted;
338cdf0e10cSrcweir 	}
339cdf0e10cSrcweir 	return aRet;
340cdf0e10cSrcweir }
341cdf0e10cSrcweir // -------------------------------------------------------------------------
insertRow(const ORowSetRow & _rInsertRow,const connectivity::OSQLTable & _xTable)342cdf0e10cSrcweir void SAL_CALL OStaticSet::insertRow( const ORowSetRow& _rInsertRow,const connectivity::OSQLTable& _xTable ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
343cdf0e10cSrcweir {
344cdf0e10cSrcweir     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStaticSet::insertRow" );
345cdf0e10cSrcweir 	OCacheSet::insertRow( _rInsertRow,_xTable);
346cdf0e10cSrcweir 	if(m_bInserted)
347cdf0e10cSrcweir 	{
348cdf0e10cSrcweir 		m_aSet.push_back(new ORowVector< ORowSetValue >(*_rInsertRow)); // we don't know where the new row is so we append it to the current rows
349cdf0e10cSrcweir 		m_aSetIter = m_aSet.end() - 1;
350cdf0e10cSrcweir 		((*m_aSetIter)->get())[0] = (_rInsertRow->get())[0] = getBookmark();
351cdf0e10cSrcweir 		m_bEnd = sal_False;
352cdf0e10cSrcweir 	}
353cdf0e10cSrcweir }
354cdf0e10cSrcweir // -------------------------------------------------------------------------
updateRow(const ORowSetRow & _rInsertRow,const ORowSetRow & _rOrginalRow,const connectivity::OSQLTable & _xTable)355cdf0e10cSrcweir void SAL_CALL OStaticSet::updateRow(const ORowSetRow& _rInsertRow ,const ORowSetRow& _rOrginalRow,const connectivity::OSQLTable& _xTable  ) throw(SQLException, RuntimeException)
356cdf0e10cSrcweir {
357cdf0e10cSrcweir     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStaticSet::updateRow" );
358cdf0e10cSrcweir 	OCacheSet::updateRow( _rInsertRow,_rOrginalRow,_xTable);
359cdf0e10cSrcweir }
360cdf0e10cSrcweir // -------------------------------------------------------------------------
deleteRow(const ORowSetRow & _rDeleteRow,const connectivity::OSQLTable & _xTable)361cdf0e10cSrcweir void SAL_CALL OStaticSet::deleteRow(const ORowSetRow& _rDeleteRow ,const connectivity::OSQLTable& _xTable  ) throw(SQLException, RuntimeException)
362cdf0e10cSrcweir {
363cdf0e10cSrcweir     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStaticSet::deleteRow" );
364cdf0e10cSrcweir 	OCacheSet::deleteRow(_rDeleteRow,_xTable);
365cdf0e10cSrcweir 	if(m_bDeleted)
366cdf0e10cSrcweir 	{
367cdf0e10cSrcweir 		ORowSetMatrix::iterator aPos = m_aSet.begin()+(_rDeleteRow->get())[0].getInt32();
368cdf0e10cSrcweir 		if(aPos == (m_aSet.end()-1))
369cdf0e10cSrcweir 			m_aSetIter = m_aSet.end();
370cdf0e10cSrcweir 		m_aSet.erase(aPos);
371cdf0e10cSrcweir 	}
372cdf0e10cSrcweir }
373cdf0e10cSrcweir // -------------------------------------------------------------------------
cancelRowUpdates()374cdf0e10cSrcweir void SAL_CALL OStaticSet::cancelRowUpdates(  ) throw(SQLException, RuntimeException)
375cdf0e10cSrcweir {
376cdf0e10cSrcweir     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStaticSet::cancelRowUpdates" );
377cdf0e10cSrcweir }
378cdf0e10cSrcweir // -------------------------------------------------------------------------
moveToInsertRow()379cdf0e10cSrcweir void SAL_CALL OStaticSet::moveToInsertRow(  ) throw(SQLException, RuntimeException)
380cdf0e10cSrcweir {
381cdf0e10cSrcweir     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStaticSet::moveToInsertRow" );
382cdf0e10cSrcweir }
383cdf0e10cSrcweir // -------------------------------------------------------------------------
moveToCurrentRow()384cdf0e10cSrcweir void SAL_CALL OStaticSet::moveToCurrentRow(  ) throw(SQLException, RuntimeException)
385cdf0e10cSrcweir {
386cdf0e10cSrcweir     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "OStaticSet::moveToCurrentRow" );
387cdf0e10cSrcweir }
388cdf0e10cSrcweir // -------------------------------------------------------------------------
389cdf0e10cSrcweir 
390