1*9b5730f6SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*9b5730f6SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*9b5730f6SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*9b5730f6SAndrew Rist  * distributed with this work for additional information
6*9b5730f6SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*9b5730f6SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*9b5730f6SAndrew Rist  * "License"); you may not use this file except in compliance
9*9b5730f6SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*9b5730f6SAndrew Rist  *
11*9b5730f6SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*9b5730f6SAndrew Rist  *
13*9b5730f6SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*9b5730f6SAndrew Rist  * software distributed under the License is distributed on an
15*9b5730f6SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*9b5730f6SAndrew Rist  * KIND, either express or implied.  See the License for the
17*9b5730f6SAndrew Rist  * specific language governing permissions and limitations
18*9b5730f6SAndrew Rist  * under the License.
19*9b5730f6SAndrew Rist  *
20*9b5730f6SAndrew Rist  *************************************************************/
21*9b5730f6SAndrew Rist 
22*9b5730f6SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_connectivity.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include "KResultSet.hxx"
28cdf0e10cSrcweir #include "KResultSetMetaData.hxx"
29cdf0e10cSrcweir #include "KConnection.hxx"
30cdf0e10cSrcweir #include "kcondition.hxx"
31cdf0e10cSrcweir #include "korder.hxx"
32cdf0e10cSrcweir #include "kfields.hxx"
33cdf0e10cSrcweir #include <com/sun/star/beans/PropertyAttribute.hpp>
34cdf0e10cSrcweir #include <com/sun/star/sdbcx/CompareBookmark.hpp>
35cdf0e10cSrcweir #include "TConnection.hxx"
36cdf0e10cSrcweir #include <connectivity/dbexception.hxx>
37cdf0e10cSrcweir #include "resource/kab_res.hrc"
38cdf0e10cSrcweir #include "resource/sharedresources.hxx"
39cdf0e10cSrcweir 
40cdf0e10cSrcweir using namespace connectivity::kab;
41cdf0e10cSrcweir using namespace cppu;
42cdf0e10cSrcweir using namespace com::sun::star::uno;
43cdf0e10cSrcweir using namespace com::sun::star::lang;
44cdf0e10cSrcweir using namespace com::sun::star::beans;
45cdf0e10cSrcweir using namespace com::sun::star::sdbc;
46cdf0e10cSrcweir using namespace com::sun::star::sdbcx;
47cdf0e10cSrcweir using namespace com::sun::star::io;
48cdf0e10cSrcweir using namespace com::sun::star::util;
49cdf0e10cSrcweir 
50cdf0e10cSrcweir IMPLEMENT_SERVICE_INFO(KabResultSet, "com.sun.star.sdbc.drivers.KabResultSet", "com.sun.star.sdbc.ResultSet");
51cdf0e10cSrcweir // -------------------------------------------------------------------------
KabResultSet(KabCommonStatement * pStmt)52cdf0e10cSrcweir KabResultSet::KabResultSet(KabCommonStatement* pStmt)
53cdf0e10cSrcweir 	: KabResultSet_BASE(m_aMutex),
54cdf0e10cSrcweir 	  OPropertySetHelper(KabResultSet_BASE::rBHelper),
55cdf0e10cSrcweir 	  m_xStatement(pStmt),
56cdf0e10cSrcweir 	  m_xMetaData(NULL),
57cdf0e10cSrcweir 	  m_aKabAddressees(),
58cdf0e10cSrcweir 	  m_nRowPos(-1),
59cdf0e10cSrcweir 	  m_bWasNull(sal_True)
60cdf0e10cSrcweir {
61cdf0e10cSrcweir }
62cdf0e10cSrcweir // -------------------------------------------------------------------------
~KabResultSet()63cdf0e10cSrcweir KabResultSet::~KabResultSet()
64cdf0e10cSrcweir {
65cdf0e10cSrcweir }
66cdf0e10cSrcweir // -------------------------------------------------------------------------
allKabAddressees()67cdf0e10cSrcweir void KabResultSet::allKabAddressees()
68cdf0e10cSrcweir {
69cdf0e10cSrcweir 	KabConnection* pConnection = static_cast< KabConnection *>(m_xStatement->getConnection().get());
70cdf0e10cSrcweir 	KABC::AddressBook* pAddressBook = pConnection->getAddressBook();
71cdf0e10cSrcweir 
72cdf0e10cSrcweir 	m_aKabAddressees = pAddressBook->allAddressees();
73cdf0e10cSrcweir }
74cdf0e10cSrcweir // -------------------------------------------------------------------------
someKabAddressees(const KabCondition * pCondition)75cdf0e10cSrcweir void KabResultSet::someKabAddressees(const KabCondition *pCondition)
76cdf0e10cSrcweir {
77cdf0e10cSrcweir 	KabConnection* pConnection = static_cast< KabConnection *>(m_xStatement->getConnection().get());
78cdf0e10cSrcweir 	KABC::AddressBook* pAddressBook = pConnection->getAddressBook();
79cdf0e10cSrcweir 
80cdf0e10cSrcweir 	KABC::AddressBook::Iterator iterator;
81cdf0e10cSrcweir 
82cdf0e10cSrcweir 	for (iterator = pAddressBook->begin();
83cdf0e10cSrcweir 	     iterator != pAddressBook->end();
84cdf0e10cSrcweir 	     ++iterator)
85cdf0e10cSrcweir 	{
86cdf0e10cSrcweir 		if (pCondition->eval(*iterator))
87cdf0e10cSrcweir 			m_aKabAddressees.push_back(*iterator);
88cdf0e10cSrcweir 	}
89cdf0e10cSrcweir }
90cdf0e10cSrcweir // -------------------------------------------------------------------------
sortKabAddressees(const KabOrder * pOrder)91cdf0e10cSrcweir void KabResultSet::sortKabAddressees(const KabOrder *pOrder)
92cdf0e10cSrcweir {
93cdf0e10cSrcweir 	// We do not use class KAddresseeList, which has a sorting algorithm in it, because
94cdf0e10cSrcweir 	// it uses templates. It would expand to more or less the same code as the one
95cdf0e10cSrcweir 	// which follows, but it would need not be called in a much less convenient way.
96cdf0e10cSrcweir 
97cdf0e10cSrcweir 	KABC::Addressee::List::Iterator
98cdf0e10cSrcweir 		begin = m_aKabAddressees.begin(),
99cdf0e10cSrcweir 		end = m_aKabAddressees.end(),
100cdf0e10cSrcweir 		iterator;
101cdf0e10cSrcweir 
102cdf0e10cSrcweir 	// Bubble sort. Feel free to implement a better algorithm.
103cdf0e10cSrcweir 	while (begin != end)
104cdf0e10cSrcweir 	{
105cdf0e10cSrcweir 		end--;
106cdf0e10cSrcweir 		for (iterator = begin; iterator != end; ++iterator)
107cdf0e10cSrcweir 		{
108cdf0e10cSrcweir 			if (pOrder->compare(*iterator, *end) > 0)
109cdf0e10cSrcweir 				qSwap(*iterator, *end);
110cdf0e10cSrcweir 		}
111cdf0e10cSrcweir 	}
112cdf0e10cSrcweir }
113cdf0e10cSrcweir // -------------------------------------------------------------------------
disposing()114cdf0e10cSrcweir void KabResultSet::disposing()
115cdf0e10cSrcweir {
116cdf0e10cSrcweir 	OPropertySetHelper::disposing();
117cdf0e10cSrcweir 
118cdf0e10cSrcweir 	::osl::MutexGuard aGuard(m_aMutex);
119cdf0e10cSrcweir 
120cdf0e10cSrcweir m_xStatement.clear();
121cdf0e10cSrcweir m_xMetaData.clear();
122cdf0e10cSrcweir }
123cdf0e10cSrcweir // -------------------------------------------------------------------------
queryInterface(const Type & rType)124cdf0e10cSrcweir Any SAL_CALL KabResultSet::queryInterface(const Type & rType) throw(RuntimeException)
125cdf0e10cSrcweir {
126cdf0e10cSrcweir 	Any aRet = OPropertySetHelper::queryInterface(rType);
127cdf0e10cSrcweir 	if (!aRet.hasValue())
128cdf0e10cSrcweir 		aRet = KabResultSet_BASE::queryInterface(rType);
129cdf0e10cSrcweir 	return aRet;
130cdf0e10cSrcweir }
131cdf0e10cSrcweir // -------------------------------------------------------------------------
acquire()132cdf0e10cSrcweir void SAL_CALL KabResultSet::acquire() throw()
133cdf0e10cSrcweir {
134cdf0e10cSrcweir 	KabResultSet_BASE::acquire();
135cdf0e10cSrcweir }
136cdf0e10cSrcweir // -------------------------------------------------------------------------
release()137cdf0e10cSrcweir void SAL_CALL KabResultSet::release() throw()
138cdf0e10cSrcweir {
139cdf0e10cSrcweir 	KabResultSet_BASE::release();
140cdf0e10cSrcweir }
141cdf0e10cSrcweir // -------------------------------------------------------------------------
getTypes()142cdf0e10cSrcweir Sequence<  Type > SAL_CALL KabResultSet::getTypes() throw(RuntimeException)
143cdf0e10cSrcweir {
144cdf0e10cSrcweir 	OTypeCollection aTypes(
145cdf0e10cSrcweir 		::getCppuType( (const Reference< ::com::sun::star::beans::XMultiPropertySet >*) 0),
146cdf0e10cSrcweir 		::getCppuType( (const Reference< ::com::sun::star::beans::XFastPropertySet >*) 0),
147cdf0e10cSrcweir 		::getCppuType( (const Reference< ::com::sun::star::beans::XPropertySet >*) 0));
148cdf0e10cSrcweir 
149cdf0e10cSrcweir 	return comphelper::concatSequences(aTypes.getTypes(), KabResultSet_BASE::getTypes());
150cdf0e10cSrcweir }
151cdf0e10cSrcweir // -------------------------------------------------------------------------
getPropertySetInfo()152cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL KabResultSet::getPropertySetInfo(  ) throw(::com::sun::star::uno::RuntimeException)
153cdf0e10cSrcweir {
154cdf0e10cSrcweir 	return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper());
155cdf0e10cSrcweir }
156cdf0e10cSrcweir // -------------------------------------------------------------------------
findColumn(const::rtl::OUString & columnName)157cdf0e10cSrcweir sal_Int32 SAL_CALL KabResultSet::findColumn(const ::rtl::OUString& columnName) throw(SQLException, RuntimeException)
158cdf0e10cSrcweir {
159cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
160cdf0e10cSrcweir 	checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
161cdf0e10cSrcweir 
162cdf0e10cSrcweir 	// find the first column with the name columnName
163cdf0e10cSrcweir 	Reference< XResultSetMetaData > xMeta = getMetaData();
164cdf0e10cSrcweir 	sal_Int32 nLen = xMeta->getColumnCount();
165cdf0e10cSrcweir 
166cdf0e10cSrcweir 	for (sal_Int32 i = 1; i <= nLen; ++i)
167cdf0e10cSrcweir 		if (xMeta->isCaseSensitive(i) ?
168cdf0e10cSrcweir 			columnName == xMeta->getColumnName(i) :
169cdf0e10cSrcweir 			columnName.equalsIgnoreAsciiCase(xMeta->getColumnName(i)))
170cdf0e10cSrcweir 				return i;
171cdf0e10cSrcweir 
172cdf0e10cSrcweir     ::connectivity::SharedResources aResources;
173cdf0e10cSrcweir     const ::rtl::OUString sError( aResources.getResourceStringWithSubstitution(
174cdf0e10cSrcweir             STR_INVALID_COLUMNNAME,
175cdf0e10cSrcweir             "$columnname$",columnName
176cdf0e10cSrcweir          ) );
177cdf0e10cSrcweir     ::dbtools::throwGenericSQLException(sError,NULL);
178cdf0e10cSrcweir 
179cdf0e10cSrcweir     // Unreachable:
180cdf0e10cSrcweir     OSL_ASSERT(false);
181cdf0e10cSrcweir     return 0;
182cdf0e10cSrcweir }
183cdf0e10cSrcweir // -------------------------------------------------------------------------
getString(sal_Int32 columnIndex)184cdf0e10cSrcweir ::rtl::OUString SAL_CALL KabResultSet::getString(sal_Int32 columnIndex) throw(SQLException, RuntimeException)
185cdf0e10cSrcweir {
186cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
187cdf0e10cSrcweir 	checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
188cdf0e10cSrcweir 
189cdf0e10cSrcweir 	::rtl::OUString aRet;
190cdf0e10cSrcweir 	sal_Int32 nAddressees = m_aKabAddressees.size();
191cdf0e10cSrcweir 	::KABC::Field::List aFields = ::KABC::Field::allFields();
192cdf0e10cSrcweir 
193cdf0e10cSrcweir 	if (m_nRowPos != -1 && m_nRowPos != nAddressees && m_xMetaData.is())
194cdf0e10cSrcweir 	{
195cdf0e10cSrcweir 		sal_Int32 nFieldNumber = m_xMetaData->fieldAtColumn(columnIndex);
196cdf0e10cSrcweir 		QString aQtName;
197cdf0e10cSrcweir 
198cdf0e10cSrcweir 		switch (nFieldNumber)
199cdf0e10cSrcweir 		{
200cdf0e10cSrcweir 			case KAB_FIELD_REVISION:
201cdf0e10cSrcweir // trigger an exception here
202cdf0e10cSrcweir m_bWasNull = true;
203cdf0e10cSrcweir return aRet;
204cdf0e10cSrcweir 			default:
205cdf0e10cSrcweir 				aQtName = aFields[nFieldNumber - KAB_DATA_FIELDS]->value(m_aKabAddressees[m_nRowPos]);
206cdf0e10cSrcweir 		}
207cdf0e10cSrcweir // KDE address book currently does not use NULL values.
208cdf0e10cSrcweir // But it might do it someday
209cdf0e10cSrcweir 		if (!aQtName.isNull())
210cdf0e10cSrcweir 		{
211cdf0e10cSrcweir 			m_bWasNull = false;
212cdf0e10cSrcweir 			aRet = ::rtl::OUString((const sal_Unicode *) aQtName.ucs2());
213cdf0e10cSrcweir 			return aRet;
214cdf0e10cSrcweir 		}
215cdf0e10cSrcweir 	}
216cdf0e10cSrcweir // Trigger an exception ?
217cdf0e10cSrcweir 	m_bWasNull = true;
218cdf0e10cSrcweir 	return aRet;
219cdf0e10cSrcweir }
220cdf0e10cSrcweir // -------------------------------------------------------------------------
getBoolean(sal_Int32)221cdf0e10cSrcweir sal_Bool SAL_CALL KabResultSet::getBoolean(sal_Int32) throw(SQLException, RuntimeException)
222cdf0e10cSrcweir {
223cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
224cdf0e10cSrcweir 	checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
225cdf0e10cSrcweir 
226cdf0e10cSrcweir ::dbtools::throwFunctionNotSupportedException("getBoolean", NULL);
227cdf0e10cSrcweir 
228cdf0e10cSrcweir 	return sal_False;
229cdf0e10cSrcweir }
230cdf0e10cSrcweir // -------------------------------------------------------------------------
getByte(sal_Int32)231cdf0e10cSrcweir sal_Int8 SAL_CALL KabResultSet::getByte(sal_Int32) throw(SQLException, RuntimeException)
232cdf0e10cSrcweir {
233cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
234cdf0e10cSrcweir 	checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
235cdf0e10cSrcweir 
236cdf0e10cSrcweir ::dbtools::throwFunctionNotSupportedException("getByte", NULL);
237cdf0e10cSrcweir 
238cdf0e10cSrcweir 	sal_Int8 nRet = 0;
239cdf0e10cSrcweir 	return nRet;
240cdf0e10cSrcweir }
241cdf0e10cSrcweir // -------------------------------------------------------------------------
getShort(sal_Int32)242cdf0e10cSrcweir sal_Int16 SAL_CALL KabResultSet::getShort(sal_Int32) throw(SQLException, RuntimeException)
243cdf0e10cSrcweir {
244cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
245cdf0e10cSrcweir 	checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
246cdf0e10cSrcweir 
247cdf0e10cSrcweir ::dbtools::throwFunctionNotSupportedException("getShort", NULL);
248cdf0e10cSrcweir 
249cdf0e10cSrcweir 	sal_Int16 nRet = 0;
250cdf0e10cSrcweir 	return nRet;
251cdf0e10cSrcweir }
252cdf0e10cSrcweir // -------------------------------------------------------------------------
getInt(sal_Int32)253cdf0e10cSrcweir sal_Int32 SAL_CALL KabResultSet::getInt(sal_Int32) throw(SQLException, RuntimeException)
254cdf0e10cSrcweir {
255cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
256cdf0e10cSrcweir 	checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
257cdf0e10cSrcweir 
258cdf0e10cSrcweir ::dbtools::throwFunctionNotSupportedException("getInt", NULL);
259cdf0e10cSrcweir 
260cdf0e10cSrcweir 	sal_Int32 nRet = 0;
261cdf0e10cSrcweir 	return nRet;
262cdf0e10cSrcweir }
263cdf0e10cSrcweir // -------------------------------------------------------------------------
getLong(sal_Int32)264cdf0e10cSrcweir sal_Int64 SAL_CALL KabResultSet::getLong(sal_Int32) throw(SQLException, RuntimeException)
265cdf0e10cSrcweir {
266cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
267cdf0e10cSrcweir 	checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
268cdf0e10cSrcweir 
269cdf0e10cSrcweir ::dbtools::throwFunctionNotSupportedException("getLong", NULL);
270cdf0e10cSrcweir 
271cdf0e10cSrcweir 	return sal_Int64();
272cdf0e10cSrcweir }
273cdf0e10cSrcweir // -------------------------------------------------------------------------
getFloat(sal_Int32)274cdf0e10cSrcweir float SAL_CALL KabResultSet::getFloat(sal_Int32) throw(SQLException, RuntimeException)
275cdf0e10cSrcweir {
276cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
277cdf0e10cSrcweir 	checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
278cdf0e10cSrcweir 
279cdf0e10cSrcweir ::dbtools::throwFunctionNotSupportedException("getFloat", NULL);
280cdf0e10cSrcweir 
281cdf0e10cSrcweir 	float nVal(0);
282cdf0e10cSrcweir 	return nVal;
283cdf0e10cSrcweir }
284cdf0e10cSrcweir // -------------------------------------------------------------------------
getDouble(sal_Int32)285cdf0e10cSrcweir double SAL_CALL KabResultSet::getDouble(sal_Int32) throw(SQLException, RuntimeException)
286cdf0e10cSrcweir {
287cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
288cdf0e10cSrcweir 	checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
289cdf0e10cSrcweir 
290cdf0e10cSrcweir ::dbtools::throwFunctionNotSupportedException("getDouble", NULL);
291cdf0e10cSrcweir 
292cdf0e10cSrcweir 	double nRet = 0;
293cdf0e10cSrcweir 	return nRet;
294cdf0e10cSrcweir }
295cdf0e10cSrcweir // -------------------------------------------------------------------------
getBytes(sal_Int32)296cdf0e10cSrcweir Sequence< sal_Int8 > SAL_CALL KabResultSet::getBytes(sal_Int32) throw(SQLException, RuntimeException)
297cdf0e10cSrcweir {
298cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
299cdf0e10cSrcweir 	checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
300cdf0e10cSrcweir 
301cdf0e10cSrcweir ::dbtools::throwFunctionNotSupportedException("", NULL);
302cdf0e10cSrcweir 
303cdf0e10cSrcweir 	return Sequence< sal_Int8 >();
304cdf0e10cSrcweir }
305cdf0e10cSrcweir // -------------------------------------------------------------------------
getDate(sal_Int32)306cdf0e10cSrcweir Date SAL_CALL KabResultSet::getDate(sal_Int32) throw(SQLException, RuntimeException)
307cdf0e10cSrcweir {
308cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
309cdf0e10cSrcweir 	checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
310cdf0e10cSrcweir 
311cdf0e10cSrcweir ::dbtools::throwFunctionNotSupportedException("getDate", NULL);
312cdf0e10cSrcweir 
313cdf0e10cSrcweir 	Date aRet;
314cdf0e10cSrcweir 	return aRet;
315cdf0e10cSrcweir }
316cdf0e10cSrcweir // -------------------------------------------------------------------------
getTime(sal_Int32)317cdf0e10cSrcweir Time SAL_CALL KabResultSet::getTime(sal_Int32) throw(SQLException, RuntimeException)
318cdf0e10cSrcweir {
319cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
320cdf0e10cSrcweir 	checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
321cdf0e10cSrcweir 
322cdf0e10cSrcweir ::dbtools::throwFunctionNotSupportedException("getTime", NULL);
323cdf0e10cSrcweir 
324cdf0e10cSrcweir 	Time nRet;
325cdf0e10cSrcweir 	return nRet;
326cdf0e10cSrcweir }
327cdf0e10cSrcweir // -------------------------------------------------------------------------
getTimestamp(sal_Int32 columnIndex)328cdf0e10cSrcweir DateTime SAL_CALL KabResultSet::getTimestamp(sal_Int32 columnIndex) throw(SQLException, RuntimeException)
329cdf0e10cSrcweir {
330cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
331cdf0e10cSrcweir 	checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
332cdf0e10cSrcweir 
333cdf0e10cSrcweir 	DateTime nRet;
334cdf0e10cSrcweir 	sal_Int32 nAddressees = m_aKabAddressees.size();
335cdf0e10cSrcweir 
336cdf0e10cSrcweir 	if (m_nRowPos != -1 && m_nRowPos != nAddressees && m_xMetaData.is())
337cdf0e10cSrcweir 	{
338cdf0e10cSrcweir 		KabResultSetMetaData *pMeta = static_cast<KabResultSetMetaData *>(m_xMetaData.get());
339cdf0e10cSrcweir 		sal_Int32 nFieldNumber = pMeta->fieldAtColumn(columnIndex);
340cdf0e10cSrcweir 
341cdf0e10cSrcweir 		if (nFieldNumber == KAB_FIELD_REVISION)
342cdf0e10cSrcweir 		{
343cdf0e10cSrcweir 			QDateTime nRevision(m_aKabAddressees[m_nRowPos].revision());
344cdf0e10cSrcweir 
345cdf0e10cSrcweir 			if (!nRevision.isNull())
346cdf0e10cSrcweir 			{
347cdf0e10cSrcweir 				m_bWasNull = false;
348cdf0e10cSrcweir 				nRet.Year = nRevision.date().year();
349cdf0e10cSrcweir 				nRet.Month = nRevision.date().month();
350cdf0e10cSrcweir 				nRet.Day = nRevision.date().day();
351cdf0e10cSrcweir 				nRet.Hours = nRevision.time().hour();
352cdf0e10cSrcweir 				nRet.Minutes = nRevision.time().minute();
353cdf0e10cSrcweir 				nRet.Seconds = nRevision.time().second();
354cdf0e10cSrcweir 				nRet.HundredthSeconds = nRevision.time().msec() / 10;
355cdf0e10cSrcweir 				return nRet;
356cdf0e10cSrcweir 			}
357cdf0e10cSrcweir 		}
358cdf0e10cSrcweir 		else {
359cdf0e10cSrcweir 			;
360cdf0e10cSrcweir         }
361cdf0e10cSrcweir // trigger an exception here
362cdf0e10cSrcweir 	}
363cdf0e10cSrcweir // Trigger an exception ?
364cdf0e10cSrcweir 	m_bWasNull = true;
365cdf0e10cSrcweir 	return nRet;
366cdf0e10cSrcweir }
367cdf0e10cSrcweir // -------------------------------------------------------------------------
getBinaryStream(sal_Int32)368cdf0e10cSrcweir Reference< XInputStream > SAL_CALL KabResultSet::getBinaryStream(sal_Int32) throw(SQLException, RuntimeException)
369cdf0e10cSrcweir {
370cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
371cdf0e10cSrcweir 	checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
372cdf0e10cSrcweir 
373cdf0e10cSrcweir ::dbtools::throwFunctionNotSupportedException("getBinaryStream", NULL);
374cdf0e10cSrcweir 
375cdf0e10cSrcweir 	return NULL;
376cdf0e10cSrcweir }
377cdf0e10cSrcweir // -------------------------------------------------------------------------
getCharacterStream(sal_Int32)378cdf0e10cSrcweir Reference< XInputStream > SAL_CALL KabResultSet::getCharacterStream(sal_Int32) throw(SQLException, RuntimeException)
379cdf0e10cSrcweir {
380cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
381cdf0e10cSrcweir 	checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
382cdf0e10cSrcweir 
383cdf0e10cSrcweir ::dbtools::throwFunctionNotSupportedException("getCharacterStream", NULL);
384cdf0e10cSrcweir 
385cdf0e10cSrcweir 	return NULL;
386cdf0e10cSrcweir }
387cdf0e10cSrcweir // -------------------------------------------------------------------------
getObject(sal_Int32,const Reference<::com::sun::star::container::XNameAccess> &)388cdf0e10cSrcweir Any SAL_CALL KabResultSet::getObject(sal_Int32, const Reference< ::com::sun::star::container::XNameAccess >&) throw(SQLException, RuntimeException)
389cdf0e10cSrcweir {
390cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
391cdf0e10cSrcweir 	checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
392cdf0e10cSrcweir 
393cdf0e10cSrcweir ::dbtools::throwFunctionNotSupportedException("getObject", NULL);
394cdf0e10cSrcweir 
395cdf0e10cSrcweir 	return Any();
396cdf0e10cSrcweir }
397cdf0e10cSrcweir // -------------------------------------------------------------------------
getRef(sal_Int32)398cdf0e10cSrcweir Reference< XRef > SAL_CALL KabResultSet::getRef(sal_Int32) throw(SQLException, RuntimeException)
399cdf0e10cSrcweir {
400cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
401cdf0e10cSrcweir 	checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
402cdf0e10cSrcweir 
403cdf0e10cSrcweir ::dbtools::throwFunctionNotSupportedException("getRef", NULL);
404cdf0e10cSrcweir 
405cdf0e10cSrcweir 	return NULL;
406cdf0e10cSrcweir }
407cdf0e10cSrcweir // -------------------------------------------------------------------------
getBlob(sal_Int32)408cdf0e10cSrcweir Reference< XBlob > SAL_CALL KabResultSet::getBlob(sal_Int32) throw(SQLException, RuntimeException)
409cdf0e10cSrcweir {
410cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
411cdf0e10cSrcweir 	checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
412cdf0e10cSrcweir 
413cdf0e10cSrcweir ::dbtools::throwFunctionNotSupportedException("getBlob", NULL);
414cdf0e10cSrcweir 
415cdf0e10cSrcweir 	return NULL;
416cdf0e10cSrcweir }
417cdf0e10cSrcweir // -------------------------------------------------------------------------
getClob(sal_Int32)418cdf0e10cSrcweir Reference< XClob > SAL_CALL KabResultSet::getClob(sal_Int32) throw(SQLException, RuntimeException)
419cdf0e10cSrcweir {
420cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
421cdf0e10cSrcweir 	checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
422cdf0e10cSrcweir 
423cdf0e10cSrcweir ::dbtools::throwFunctionNotSupportedException("getClob", NULL);
424cdf0e10cSrcweir 
425cdf0e10cSrcweir 	return NULL;
426cdf0e10cSrcweir }
427cdf0e10cSrcweir // -------------------------------------------------------------------------
getArray(sal_Int32)428cdf0e10cSrcweir Reference< XArray > SAL_CALL KabResultSet::getArray(sal_Int32) throw(SQLException, RuntimeException)
429cdf0e10cSrcweir {
430cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
431cdf0e10cSrcweir 	checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
432cdf0e10cSrcweir 
433cdf0e10cSrcweir ::dbtools::throwFunctionNotSupportedException("getArray", NULL);
434cdf0e10cSrcweir 
435cdf0e10cSrcweir 	return NULL;
436cdf0e10cSrcweir }
437cdf0e10cSrcweir // -------------------------------------------------------------------------
getMetaData()438cdf0e10cSrcweir Reference< XResultSetMetaData > SAL_CALL KabResultSet::getMetaData() throw(SQLException, RuntimeException)
439cdf0e10cSrcweir {
440cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
441cdf0e10cSrcweir 	checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
442cdf0e10cSrcweir 
443cdf0e10cSrcweir 	if (!m_xMetaData.is())
444cdf0e10cSrcweir 		m_xMetaData = new KabResultSetMetaData(m_xStatement->getOwnConnection());
445cdf0e10cSrcweir 
446cdf0e10cSrcweir 	Reference< XResultSetMetaData > xMetaData = m_xMetaData.get();
447cdf0e10cSrcweir 	return xMetaData;
448cdf0e10cSrcweir }
449cdf0e10cSrcweir // -------------------------------------------------------------------------
isBeforeFirst()450cdf0e10cSrcweir sal_Bool SAL_CALL KabResultSet::isBeforeFirst() throw(SQLException, RuntimeException)
451cdf0e10cSrcweir {
452cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
453cdf0e10cSrcweir 	checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
454cdf0e10cSrcweir 
455cdf0e10cSrcweir 	if (m_nRowPos == -1)
456cdf0e10cSrcweir 		return sal_True;
457cdf0e10cSrcweir 
458cdf0e10cSrcweir 	return sal_False;
459cdf0e10cSrcweir }
460cdf0e10cSrcweir // -------------------------------------------------------------------------
isAfterLast()461cdf0e10cSrcweir sal_Bool SAL_CALL KabResultSet::isAfterLast() throw(SQLException, RuntimeException)
462cdf0e10cSrcweir {
463cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
464cdf0e10cSrcweir 	checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
465cdf0e10cSrcweir 
466cdf0e10cSrcweir 	sal_Int32 nAddressees = m_aKabAddressees.size();
467cdf0e10cSrcweir 	if (m_nRowPos == nAddressees)
468cdf0e10cSrcweir 		return sal_True;
469cdf0e10cSrcweir 
470cdf0e10cSrcweir 	return sal_False;
471cdf0e10cSrcweir }
472cdf0e10cSrcweir // -------------------------------------------------------------------------
isFirst()473cdf0e10cSrcweir sal_Bool SAL_CALL KabResultSet::isFirst() throw(SQLException, RuntimeException)
474cdf0e10cSrcweir {
475cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
476cdf0e10cSrcweir 	checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
477cdf0e10cSrcweir 
478cdf0e10cSrcweir 	if (m_nRowPos == 0)
479cdf0e10cSrcweir 		return sal_True;
480cdf0e10cSrcweir 
481cdf0e10cSrcweir 	return sal_False;
482cdf0e10cSrcweir }
483cdf0e10cSrcweir // -------------------------------------------------------------------------
isLast()484cdf0e10cSrcweir sal_Bool SAL_CALL KabResultSet::isLast() throw(SQLException, RuntimeException)
485cdf0e10cSrcweir {
486cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
487cdf0e10cSrcweir 	checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
488cdf0e10cSrcweir 
489cdf0e10cSrcweir 	sal_Int32 nAddressees = m_aKabAddressees.size();
490cdf0e10cSrcweir 	if (m_nRowPos == nAddressees - 1)
491cdf0e10cSrcweir 		return sal_True;
492cdf0e10cSrcweir 
493cdf0e10cSrcweir 	return sal_False;
494cdf0e10cSrcweir }
495cdf0e10cSrcweir // -------------------------------------------------------------------------
beforeFirst()496cdf0e10cSrcweir void SAL_CALL KabResultSet::beforeFirst() throw(SQLException, RuntimeException)
497cdf0e10cSrcweir {
498cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
499cdf0e10cSrcweir 	checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
500cdf0e10cSrcweir 
501cdf0e10cSrcweir 	// move before the first row
502cdf0e10cSrcweir 	m_nRowPos = -1;
503cdf0e10cSrcweir }
504cdf0e10cSrcweir // -------------------------------------------------------------------------
afterLast()505cdf0e10cSrcweir void SAL_CALL KabResultSet::afterLast() throw(SQLException, RuntimeException)
506cdf0e10cSrcweir {
507cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
508cdf0e10cSrcweir 	checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
509cdf0e10cSrcweir 
510cdf0e10cSrcweir 	// move after the last row
511cdf0e10cSrcweir 	sal_Int32 nAddressees = m_aKabAddressees.size();
512cdf0e10cSrcweir 	m_nRowPos = nAddressees;
513cdf0e10cSrcweir }
514cdf0e10cSrcweir // -------------------------------------------------------------------------
close()515cdf0e10cSrcweir void SAL_CALL KabResultSet::close() throw(SQLException, RuntimeException)
516cdf0e10cSrcweir {
517cdf0e10cSrcweir 	{
518cdf0e10cSrcweir 		::osl::MutexGuard aGuard( m_aMutex );
519cdf0e10cSrcweir 		checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
520cdf0e10cSrcweir 	}
521cdf0e10cSrcweir 	dispose();
522cdf0e10cSrcweir }
523cdf0e10cSrcweir // -------------------------------------------------------------------------
first()524cdf0e10cSrcweir sal_Bool SAL_CALL KabResultSet::first() throw(SQLException, RuntimeException)
525cdf0e10cSrcweir {
526cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
527cdf0e10cSrcweir 	checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
528cdf0e10cSrcweir 
529cdf0e10cSrcweir 	sal_Int32 nAddressees = m_aKabAddressees.size();
530cdf0e10cSrcweir 	if (nAddressees == 0)
531cdf0e10cSrcweir 		return sal_False;
532cdf0e10cSrcweir 
533cdf0e10cSrcweir 	m_nRowPos = 0;
534cdf0e10cSrcweir 	return sal_True;
535cdf0e10cSrcweir }
536cdf0e10cSrcweir // -------------------------------------------------------------------------
last()537cdf0e10cSrcweir sal_Bool SAL_CALL KabResultSet::last() throw(SQLException, RuntimeException)
538cdf0e10cSrcweir {
539cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
540cdf0e10cSrcweir 	checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
541cdf0e10cSrcweir 
542cdf0e10cSrcweir 	sal_Int32 nAddressees = m_aKabAddressees.size();
543cdf0e10cSrcweir 	if (nAddressees == 0)
544cdf0e10cSrcweir 		return sal_False;
545cdf0e10cSrcweir 
546cdf0e10cSrcweir 	m_nRowPos = nAddressees - 1;
547cdf0e10cSrcweir 	return sal_True;
548cdf0e10cSrcweir }
549cdf0e10cSrcweir // -------------------------------------------------------------------------
getRow()550cdf0e10cSrcweir sal_Int32 SAL_CALL KabResultSet::getRow() throw(SQLException, RuntimeException)
551cdf0e10cSrcweir {
552cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
553cdf0e10cSrcweir 	checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
554cdf0e10cSrcweir 
555cdf0e10cSrcweir 	return m_nRowPos;
556cdf0e10cSrcweir }
557cdf0e10cSrcweir // -------------------------------------------------------------------------
absolute(sal_Int32 row)558cdf0e10cSrcweir sal_Bool SAL_CALL KabResultSet::absolute(sal_Int32 row) throw(SQLException, RuntimeException)
559cdf0e10cSrcweir {
560cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
561cdf0e10cSrcweir 	checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
562cdf0e10cSrcweir 
563cdf0e10cSrcweir 	sal_Int32 nAddressees = m_aKabAddressees.size();
564cdf0e10cSrcweir 	if (row <= -1 ||
565cdf0e10cSrcweir 	    row >= nAddressees)
566cdf0e10cSrcweir 		return sal_False;
567cdf0e10cSrcweir 
568cdf0e10cSrcweir 	m_nRowPos = row;
569cdf0e10cSrcweir 	return sal_True;
570cdf0e10cSrcweir }
571cdf0e10cSrcweir // -------------------------------------------------------------------------
relative(sal_Int32 row)572cdf0e10cSrcweir sal_Bool SAL_CALL KabResultSet::relative(sal_Int32 row) throw(SQLException, RuntimeException)
573cdf0e10cSrcweir {
574cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
575cdf0e10cSrcweir 	checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
576cdf0e10cSrcweir 
577cdf0e10cSrcweir 	return absolute(m_nRowPos + row);
578cdf0e10cSrcweir }
579cdf0e10cSrcweir // -------------------------------------------------------------------------
next()580cdf0e10cSrcweir sal_Bool SAL_CALL KabResultSet::next() throw(SQLException, RuntimeException)
581cdf0e10cSrcweir {
582cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
583cdf0e10cSrcweir 	checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
584cdf0e10cSrcweir 
585cdf0e10cSrcweir 	return absolute(m_nRowPos + 1);
586cdf0e10cSrcweir }
587cdf0e10cSrcweir // -------------------------------------------------------------------------
previous()588cdf0e10cSrcweir sal_Bool SAL_CALL KabResultSet::previous() throw(SQLException, RuntimeException)
589cdf0e10cSrcweir {
590cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
591cdf0e10cSrcweir 	checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
592cdf0e10cSrcweir 
593cdf0e10cSrcweir 	return absolute(m_nRowPos - 1);
594cdf0e10cSrcweir }
595cdf0e10cSrcweir // -------------------------------------------------------------------------
getStatement()596cdf0e10cSrcweir Reference< XInterface > SAL_CALL KabResultSet::getStatement() throw(SQLException, RuntimeException)
597cdf0e10cSrcweir {
598cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
599cdf0e10cSrcweir 	checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
600cdf0e10cSrcweir 
601cdf0e10cSrcweir 	Reference< XStatement > xStatement = m_xStatement.get();
602cdf0e10cSrcweir 	return xStatement;
603cdf0e10cSrcweir }
604cdf0e10cSrcweir // -------------------------------------------------------------------------
rowDeleted()605cdf0e10cSrcweir sal_Bool SAL_CALL KabResultSet::rowDeleted() throw(SQLException, RuntimeException)
606cdf0e10cSrcweir {
607cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
608cdf0e10cSrcweir 	checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
609cdf0e10cSrcweir 
610cdf0e10cSrcweir 	return sal_False;
611cdf0e10cSrcweir }
612cdf0e10cSrcweir // -------------------------------------------------------------------------
rowInserted()613cdf0e10cSrcweir sal_Bool SAL_CALL KabResultSet::rowInserted() throw(SQLException, RuntimeException)
614cdf0e10cSrcweir {
615cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
616cdf0e10cSrcweir 	checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
617cdf0e10cSrcweir 
618cdf0e10cSrcweir 	return sal_False;
619cdf0e10cSrcweir }
620cdf0e10cSrcweir // -------------------------------------------------------------------------
rowUpdated()621cdf0e10cSrcweir sal_Bool SAL_CALL KabResultSet::rowUpdated() throw(SQLException, RuntimeException)
622cdf0e10cSrcweir {
623cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
624cdf0e10cSrcweir 	checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
625cdf0e10cSrcweir 
626cdf0e10cSrcweir 	return sal_False;
627cdf0e10cSrcweir }
628cdf0e10cSrcweir // -------------------------------------------------------------------------
wasNull()629cdf0e10cSrcweir sal_Bool SAL_CALL KabResultSet::wasNull() throw(SQLException, RuntimeException)
630cdf0e10cSrcweir {
631cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
632cdf0e10cSrcweir 	checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
633cdf0e10cSrcweir 
634cdf0e10cSrcweir 	return m_bWasNull;
635cdf0e10cSrcweir }
636cdf0e10cSrcweir // -------------------------------------------------------------------------
cancel()637cdf0e10cSrcweir void SAL_CALL KabResultSet::cancel() throw(RuntimeException)
638cdf0e10cSrcweir {
639cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
640cdf0e10cSrcweir 	checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
641cdf0e10cSrcweir }
642cdf0e10cSrcweir // -------------------------------------------------------------------------
clearWarnings()643cdf0e10cSrcweir void SAL_CALL KabResultSet::clearWarnings() throw(SQLException, RuntimeException)
644cdf0e10cSrcweir {
645cdf0e10cSrcweir }
646cdf0e10cSrcweir // -------------------------------------------------------------------------
getWarnings()647cdf0e10cSrcweir Any SAL_CALL KabResultSet::getWarnings() throw(SQLException, RuntimeException)
648cdf0e10cSrcweir {
649cdf0e10cSrcweir 	return Any();
650cdf0e10cSrcweir }
651cdf0e10cSrcweir // -------------------------------------------------------------------------
insertRow()652cdf0e10cSrcweir void SAL_CALL KabResultSet::insertRow() throw(SQLException, RuntimeException)
653cdf0e10cSrcweir {
654cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
655cdf0e10cSrcweir 	checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
656cdf0e10cSrcweir 
657cdf0e10cSrcweir 	// you only have to implement this if you want to insert new rows
658cdf0e10cSrcweir }
659cdf0e10cSrcweir // -------------------------------------------------------------------------
updateRow()660cdf0e10cSrcweir void SAL_CALL KabResultSet::updateRow() throw(SQLException, RuntimeException)
661cdf0e10cSrcweir {
662cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
663cdf0e10cSrcweir 	checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
664cdf0e10cSrcweir 
665cdf0e10cSrcweir 	// only when you allow updates
666cdf0e10cSrcweir }
667cdf0e10cSrcweir // -------------------------------------------------------------------------
deleteRow()668cdf0e10cSrcweir void SAL_CALL KabResultSet::deleteRow() throw(SQLException, RuntimeException)
669cdf0e10cSrcweir {
670cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
671cdf0e10cSrcweir 	checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
672cdf0e10cSrcweir }
673cdf0e10cSrcweir // -------------------------------------------------------------------------
cancelRowUpdates()674cdf0e10cSrcweir void SAL_CALL KabResultSet::cancelRowUpdates() throw(SQLException, RuntimeException)
675cdf0e10cSrcweir {
676cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
677cdf0e10cSrcweir 	checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
678cdf0e10cSrcweir }
679cdf0e10cSrcweir // -------------------------------------------------------------------------
moveToInsertRow()680cdf0e10cSrcweir void SAL_CALL KabResultSet::moveToInsertRow() throw(SQLException, RuntimeException)
681cdf0e10cSrcweir {
682cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
683cdf0e10cSrcweir 	checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
684cdf0e10cSrcweir 
685cdf0e10cSrcweir 	// only when you allow inserts
686cdf0e10cSrcweir }
687cdf0e10cSrcweir // -------------------------------------------------------------------------
moveToCurrentRow()688cdf0e10cSrcweir void SAL_CALL KabResultSet::moveToCurrentRow() throw(SQLException, RuntimeException)
689cdf0e10cSrcweir {
690cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
691cdf0e10cSrcweir 	checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
692cdf0e10cSrcweir }
693cdf0e10cSrcweir // -------------------------------------------------------------------------
updateNull(sal_Int32)694cdf0e10cSrcweir void SAL_CALL KabResultSet::updateNull(sal_Int32) throw(SQLException, RuntimeException)
695cdf0e10cSrcweir {
696cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
697cdf0e10cSrcweir 	checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
698cdf0e10cSrcweir }
699cdf0e10cSrcweir // -------------------------------------------------------------------------
updateBoolean(sal_Int32,sal_Bool)700cdf0e10cSrcweir void SAL_CALL KabResultSet::updateBoolean(sal_Int32, sal_Bool) throw(SQLException, RuntimeException)
701cdf0e10cSrcweir {
702cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
703cdf0e10cSrcweir 	checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
704cdf0e10cSrcweir }
705cdf0e10cSrcweir // -------------------------------------------------------------------------
updateByte(sal_Int32,sal_Int8)706cdf0e10cSrcweir void SAL_CALL KabResultSet::updateByte(sal_Int32, sal_Int8) throw(SQLException, RuntimeException)
707cdf0e10cSrcweir {
708cdf0e10cSrcweir 	checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
709cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
710cdf0e10cSrcweir }
711cdf0e10cSrcweir // -------------------------------------------------------------------------
updateShort(sal_Int32,sal_Int16)712cdf0e10cSrcweir void SAL_CALL KabResultSet::updateShort(sal_Int32, sal_Int16) throw(SQLException, RuntimeException)
713cdf0e10cSrcweir {
714cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
715cdf0e10cSrcweir 	checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
716cdf0e10cSrcweir }
717cdf0e10cSrcweir // -------------------------------------------------------------------------
updateInt(sal_Int32,sal_Int32)718cdf0e10cSrcweir void SAL_CALL KabResultSet::updateInt(sal_Int32, sal_Int32) throw(SQLException, RuntimeException)
719cdf0e10cSrcweir {
720cdf0e10cSrcweir 	checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
721cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
722cdf0e10cSrcweir }
723cdf0e10cSrcweir // -------------------------------------------------------------------------
updateLong(sal_Int32,sal_Int64)724cdf0e10cSrcweir void SAL_CALL KabResultSet::updateLong(sal_Int32, sal_Int64) throw(SQLException, RuntimeException)
725cdf0e10cSrcweir {
726cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
727cdf0e10cSrcweir 	checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
728cdf0e10cSrcweir }
729cdf0e10cSrcweir // -----------------------------------------------------------------------
updateFloat(sal_Int32,float)730cdf0e10cSrcweir void SAL_CALL KabResultSet::updateFloat(sal_Int32, float) throw(SQLException, RuntimeException)
731cdf0e10cSrcweir {
732cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
733cdf0e10cSrcweir 	checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
734cdf0e10cSrcweir }
735cdf0e10cSrcweir // -------------------------------------------------------------------------
updateDouble(sal_Int32,double)736cdf0e10cSrcweir void SAL_CALL KabResultSet::updateDouble(sal_Int32, double) throw(SQLException, RuntimeException)
737cdf0e10cSrcweir {
738cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
739cdf0e10cSrcweir 	checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
740cdf0e10cSrcweir }
741cdf0e10cSrcweir // -------------------------------------------------------------------------
updateString(sal_Int32,const::rtl::OUString &)742cdf0e10cSrcweir void SAL_CALL KabResultSet::updateString(sal_Int32, const ::rtl::OUString&) throw(SQLException, RuntimeException)
743cdf0e10cSrcweir {
744cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
745cdf0e10cSrcweir 	checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
746cdf0e10cSrcweir }
747cdf0e10cSrcweir // -------------------------------------------------------------------------
updateBytes(sal_Int32,const Sequence<sal_Int8> &)748cdf0e10cSrcweir void SAL_CALL KabResultSet::updateBytes(sal_Int32, const Sequence< sal_Int8 >&) throw(SQLException, RuntimeException)
749cdf0e10cSrcweir {
750cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
751cdf0e10cSrcweir 	checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
752cdf0e10cSrcweir }
753cdf0e10cSrcweir // -------------------------------------------------------------------------
updateDate(sal_Int32,const Date &)754cdf0e10cSrcweir void SAL_CALL KabResultSet::updateDate(sal_Int32, const Date&) throw(SQLException, RuntimeException)
755cdf0e10cSrcweir {
756cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
757cdf0e10cSrcweir 	checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
758cdf0e10cSrcweir }
759cdf0e10cSrcweir // -------------------------------------------------------------------------
updateTime(sal_Int32,const Time &)760cdf0e10cSrcweir void SAL_CALL KabResultSet::updateTime(sal_Int32, const Time&) throw(SQLException, RuntimeException)
761cdf0e10cSrcweir {
762cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
763cdf0e10cSrcweir 	checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
764cdf0e10cSrcweir }
765cdf0e10cSrcweir // -------------------------------------------------------------------------
updateTimestamp(sal_Int32,const DateTime &)766cdf0e10cSrcweir void SAL_CALL KabResultSet::updateTimestamp(sal_Int32, const DateTime&) throw(SQLException, RuntimeException)
767cdf0e10cSrcweir {
768cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
769cdf0e10cSrcweir 	checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
770cdf0e10cSrcweir }
771cdf0e10cSrcweir // -------------------------------------------------------------------------
updateBinaryStream(sal_Int32,const Reference<XInputStream> &,sal_Int32)772cdf0e10cSrcweir void SAL_CALL KabResultSet::updateBinaryStream(sal_Int32, const Reference< XInputStream >&, sal_Int32) throw(SQLException, RuntimeException)
773cdf0e10cSrcweir {
774cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
775cdf0e10cSrcweir 	checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
776cdf0e10cSrcweir }
777cdf0e10cSrcweir // -------------------------------------------------------------------------
updateCharacterStream(sal_Int32,const Reference<XInputStream> &,sal_Int32)778cdf0e10cSrcweir void SAL_CALL KabResultSet::updateCharacterStream(sal_Int32, const Reference< XInputStream >&, sal_Int32) throw(SQLException, RuntimeException)
779cdf0e10cSrcweir {
780cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
781cdf0e10cSrcweir 	checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
782cdf0e10cSrcweir }
783cdf0e10cSrcweir // -------------------------------------------------------------------------
refreshRow()784cdf0e10cSrcweir void SAL_CALL KabResultSet::refreshRow() throw(SQLException, RuntimeException)
785cdf0e10cSrcweir {
786cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
787cdf0e10cSrcweir 	checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
788cdf0e10cSrcweir }
789cdf0e10cSrcweir // -------------------------------------------------------------------------
updateObject(sal_Int32,const Any &)790cdf0e10cSrcweir void SAL_CALL KabResultSet::updateObject(sal_Int32, const Any&) throw(SQLException, RuntimeException)
791cdf0e10cSrcweir {
792cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
793cdf0e10cSrcweir 	checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
794cdf0e10cSrcweir }
795cdf0e10cSrcweir // -------------------------------------------------------------------------
updateNumericObject(sal_Int32,const Any &,sal_Int32)796cdf0e10cSrcweir void SAL_CALL KabResultSet::updateNumericObject(sal_Int32, const Any&, sal_Int32) throw(SQLException, RuntimeException)
797cdf0e10cSrcweir {
798cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
799cdf0e10cSrcweir 	checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
800cdf0e10cSrcweir }
801cdf0e10cSrcweir // -------------------------------------------------------------------------
802cdf0e10cSrcweir // XRowLocate
getBookmark()803cdf0e10cSrcweir Any SAL_CALL KabResultSet::getBookmark() throw( SQLException,  RuntimeException)
804cdf0e10cSrcweir {
805cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
806cdf0e10cSrcweir 	checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
807cdf0e10cSrcweir 
808cdf0e10cSrcweir         sal_Int32 nAddressees = m_aKabAddressees.size();
809cdf0e10cSrcweir 
810cdf0e10cSrcweir         if (m_nRowPos != -1 && m_nRowPos != nAddressees)
811cdf0e10cSrcweir         {
812cdf0e10cSrcweir                 QString aQtName = m_aKabAddressees[m_nRowPos].uid();
813cdf0e10cSrcweir        		::rtl::OUString sUniqueIdentifier = ::rtl::OUString((const sal_Unicode *) aQtName.ucs2());
814cdf0e10cSrcweir 		return makeAny(sUniqueIdentifier);
815cdf0e10cSrcweir 	}
816cdf0e10cSrcweir 	return Any();
817cdf0e10cSrcweir }
818cdf0e10cSrcweir // -------------------------------------------------------------------------
moveToBookmark(const Any & bookmark)819cdf0e10cSrcweir sal_Bool SAL_CALL KabResultSet::moveToBookmark(const  Any& bookmark) throw( SQLException,  RuntimeException)
820cdf0e10cSrcweir {
821cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
822cdf0e10cSrcweir 	checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
823cdf0e10cSrcweir 
824cdf0e10cSrcweir 	::rtl::OUString sBookmark = comphelper::getString(bookmark);
825cdf0e10cSrcweir         sal_Int32 nAddressees = m_aKabAddressees.size();
826cdf0e10cSrcweir 
827cdf0e10cSrcweir 	for (sal_Int32 nRow = 0; nRow < nAddressees; nRow++)
828cdf0e10cSrcweir 	{
829cdf0e10cSrcweir                 QString aQtName = m_aKabAddressees[nRow].uid();
830cdf0e10cSrcweir        		::rtl::OUString sUniqueIdentifier = ::rtl::OUString((const sal_Unicode *) aQtName.ucs2());
831cdf0e10cSrcweir 
832cdf0e10cSrcweir 		if (sUniqueIdentifier == sBookmark)
833cdf0e10cSrcweir 		{
834cdf0e10cSrcweir 			m_nRowPos = nRow;
835cdf0e10cSrcweir 			return sal_True;
836cdf0e10cSrcweir 		}
837cdf0e10cSrcweir 	}
838cdf0e10cSrcweir 	return sal_False;
839cdf0e10cSrcweir }
840cdf0e10cSrcweir // -------------------------------------------------------------------------
moveRelativeToBookmark(const Any & bookmark,sal_Int32 rows)841cdf0e10cSrcweir sal_Bool SAL_CALL KabResultSet::moveRelativeToBookmark(const  Any& bookmark, sal_Int32 rows) throw( SQLException,  RuntimeException)
842cdf0e10cSrcweir {
843cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
844cdf0e10cSrcweir 	checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
845cdf0e10cSrcweir 
846cdf0e10cSrcweir 	sal_Int32 nRowSave = m_nRowPos;
847cdf0e10cSrcweir 
848cdf0e10cSrcweir 	if (moveToBookmark(bookmark))
849cdf0e10cSrcweir 	{
850cdf0e10cSrcweir 		sal_Int32 nAddressees = m_aKabAddressees.size();
851cdf0e10cSrcweir 
852cdf0e10cSrcweir 		m_nRowPos += rows;
853cdf0e10cSrcweir 
854cdf0e10cSrcweir 		if (-1 < m_nRowPos && m_nRowPos < nAddressees)
855cdf0e10cSrcweir 			return sal_True;
856cdf0e10cSrcweir 	}
857cdf0e10cSrcweir 
858cdf0e10cSrcweir 	m_nRowPos = nRowSave;
859cdf0e10cSrcweir 	return sal_False;
860cdf0e10cSrcweir }
861cdf0e10cSrcweir // -------------------------------------------------------------------------
compareBookmarks(const Any & firstItem,const Any & secondItem)862cdf0e10cSrcweir sal_Int32 SAL_CALL KabResultSet::compareBookmarks(const  Any& firstItem, const  Any& secondItem) throw( SQLException,  RuntimeException)
863cdf0e10cSrcweir {
864cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
865cdf0e10cSrcweir 	checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
866cdf0e10cSrcweir 
867cdf0e10cSrcweir 	::rtl::OUString sFirst = comphelper::getString(firstItem);
868cdf0e10cSrcweir 	::rtl::OUString sSecond = comphelper::getString(secondItem);
869cdf0e10cSrcweir 
870cdf0e10cSrcweir 	if (sFirst < sSecond)
871cdf0e10cSrcweir 		return CompareBookmark::LESS;
872cdf0e10cSrcweir 	if (sFirst > sSecond)
873cdf0e10cSrcweir 		return CompareBookmark::GREATER;
874cdf0e10cSrcweir 	return CompareBookmark::EQUAL;
875cdf0e10cSrcweir }
876cdf0e10cSrcweir // -------------------------------------------------------------------------
hasOrderedBookmarks()877cdf0e10cSrcweir sal_Bool SAL_CALL KabResultSet::hasOrderedBookmarks() throw( SQLException,  RuntimeException)
878cdf0e10cSrcweir {
879cdf0e10cSrcweir 	return sal_False;
880cdf0e10cSrcweir }
881cdf0e10cSrcweir // -------------------------------------------------------------------------
hashBookmark(const Any & bookmark)882cdf0e10cSrcweir sal_Int32 SAL_CALL KabResultSet::hashBookmark(const  Any& bookmark) throw( SQLException,  RuntimeException)
883cdf0e10cSrcweir {
884cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
885cdf0e10cSrcweir 	checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
886cdf0e10cSrcweir 
887cdf0e10cSrcweir 	::rtl::OUString sBookmark = comphelper::getString(bookmark);
888cdf0e10cSrcweir 
889cdf0e10cSrcweir 	return sBookmark.hashCode();
890cdf0e10cSrcweir }
891cdf0e10cSrcweir // -------------------------------------------------------------------------
892cdf0e10cSrcweir // XDeleteRows
deleteRows(const Sequence<Any> &)893cdf0e10cSrcweir Sequence< sal_Int32 > SAL_CALL KabResultSet::deleteRows(const  Sequence<  Any >&) throw( SQLException,  RuntimeException)
894cdf0e10cSrcweir {
895cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
896cdf0e10cSrcweir 	checkDisposed(KabResultSet_BASE::rBHelper.bDisposed);
897cdf0e10cSrcweir 
898cdf0e10cSrcweir 	return Sequence< sal_Int32 >();
899cdf0e10cSrcweir }
900cdf0e10cSrcweir // -------------------------------------------------------------------------
createArrayHelper() const901cdf0e10cSrcweir IPropertyArrayHelper* KabResultSet::createArrayHelper() const
902cdf0e10cSrcweir {
903cdf0e10cSrcweir 	Sequence< Property > aProps(6);
904cdf0e10cSrcweir 	Property* pProperties = aProps.getArray();
905cdf0e10cSrcweir 	sal_Int32 nPos = 0;
906cdf0e10cSrcweir 	DECL_PROP1IMPL(CURSORNAME,			::rtl::OUString) PropertyAttribute::READONLY);
907cdf0e10cSrcweir 	DECL_PROP0(FETCHDIRECTION,			sal_Int32);
908cdf0e10cSrcweir 	DECL_PROP0(FETCHSIZE,				sal_Int32);
909cdf0e10cSrcweir 	DECL_BOOL_PROP1IMPL(ISBOOKMARKABLE) PropertyAttribute::READONLY);
910cdf0e10cSrcweir 	DECL_PROP1IMPL(RESULTSETCONCURRENCY,sal_Int32) PropertyAttribute::READONLY);
911cdf0e10cSrcweir 	DECL_PROP1IMPL(RESULTSETTYPE,		sal_Int32) PropertyAttribute::READONLY);
912cdf0e10cSrcweir 
913cdf0e10cSrcweir 	return new OPropertyArrayHelper(aProps);
914cdf0e10cSrcweir }
915cdf0e10cSrcweir // -------------------------------------------------------------------------
getInfoHelper()916cdf0e10cSrcweir IPropertyArrayHelper & KabResultSet::getInfoHelper()
917cdf0e10cSrcweir {
918cdf0e10cSrcweir 	return *static_cast<KabResultSet*>(this)->getArrayHelper();
919cdf0e10cSrcweir }
920cdf0e10cSrcweir // -------------------------------------------------------------------------
convertFastPropertyValue(Any &,Any &,sal_Int32 nHandle,const Any &)921cdf0e10cSrcweir sal_Bool KabResultSet::convertFastPropertyValue(
922cdf0e10cSrcweir 			Any &,
923cdf0e10cSrcweir 			Any &,
924cdf0e10cSrcweir 			sal_Int32 nHandle,
925cdf0e10cSrcweir 			const Any& )
926cdf0e10cSrcweir 				throw (::com::sun::star::lang::IllegalArgumentException)
927cdf0e10cSrcweir {
928cdf0e10cSrcweir 	switch (nHandle)
929cdf0e10cSrcweir 	{
930cdf0e10cSrcweir 		case PROPERTY_ID_ISBOOKMARKABLE:
931cdf0e10cSrcweir 		case PROPERTY_ID_CURSORNAME:
932cdf0e10cSrcweir 		case PROPERTY_ID_RESULTSETCONCURRENCY:
933cdf0e10cSrcweir 		case PROPERTY_ID_RESULTSETTYPE:
934cdf0e10cSrcweir 			throw ::com::sun::star::lang::IllegalArgumentException();
935cdf0e10cSrcweir 			break;
936cdf0e10cSrcweir 		case PROPERTY_ID_FETCHDIRECTION:
937cdf0e10cSrcweir 		case PROPERTY_ID_FETCHSIZE:
938cdf0e10cSrcweir 		default:
939cdf0e10cSrcweir 			;
940cdf0e10cSrcweir 	}
941cdf0e10cSrcweir 	return sal_False;
942cdf0e10cSrcweir }
943cdf0e10cSrcweir // -------------------------------------------------------------------------
setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any &)944cdf0e10cSrcweir void KabResultSet::setFastPropertyValue_NoBroadcast(
945cdf0e10cSrcweir 			sal_Int32 nHandle,
946cdf0e10cSrcweir 			const Any& )
947cdf0e10cSrcweir 				 throw (Exception)
948cdf0e10cSrcweir {
949cdf0e10cSrcweir 	switch (nHandle)
950cdf0e10cSrcweir 	{
951cdf0e10cSrcweir 		case PROPERTY_ID_ISBOOKMARKABLE:
952cdf0e10cSrcweir 		case PROPERTY_ID_CURSORNAME:
953cdf0e10cSrcweir 		case PROPERTY_ID_RESULTSETCONCURRENCY:
954cdf0e10cSrcweir 		case PROPERTY_ID_RESULTSETTYPE:
955cdf0e10cSrcweir 			throw Exception();
956cdf0e10cSrcweir 			break;
957cdf0e10cSrcweir 		case PROPERTY_ID_FETCHDIRECTION:
958cdf0e10cSrcweir 			break;
959cdf0e10cSrcweir 		case PROPERTY_ID_FETCHSIZE:
960cdf0e10cSrcweir 			break;
961cdf0e10cSrcweir 		default:
962cdf0e10cSrcweir 			;
963cdf0e10cSrcweir 	}
964cdf0e10cSrcweir }
965cdf0e10cSrcweir // -------------------------------------------------------------------------
getFastPropertyValue(Any & _rValue,sal_Int32 nHandle) const966cdf0e10cSrcweir void KabResultSet::getFastPropertyValue(
967cdf0e10cSrcweir 			Any& _rValue,
968cdf0e10cSrcweir 			sal_Int32 nHandle) const
969cdf0e10cSrcweir {
970cdf0e10cSrcweir 	switch (nHandle)
971cdf0e10cSrcweir 	{
972cdf0e10cSrcweir 		case PROPERTY_ID_ISBOOKMARKABLE:
973cdf0e10cSrcweir             _rValue <<= (sal_Bool)sal_False;
974cdf0e10cSrcweir             break;
975cdf0e10cSrcweir 		case PROPERTY_ID_CURSORNAME:
976cdf0e10cSrcweir 		case PROPERTY_ID_RESULTSETCONCURRENCY:
977cdf0e10cSrcweir 		case PROPERTY_ID_RESULTSETTYPE:
978cdf0e10cSrcweir 		case PROPERTY_ID_FETCHDIRECTION:
979cdf0e10cSrcweir 		case PROPERTY_ID_FETCHSIZE:
980cdf0e10cSrcweir 			;
981cdf0e10cSrcweir 	}
982cdf0e10cSrcweir }
983cdf0e10cSrcweir // -----------------------------------------------------------------------------
984