1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
29*cdf0e10cSrcweir #include "precompiled_connectivity.hxx"
30*cdf0e10cSrcweir #include "ado/AResultSet.hxx"
31*cdf0e10cSrcweir #include "ado/AResultSetMetaData.hxx"
32*cdf0e10cSrcweir #include <com/sun/star/sdbc/DataType.hpp>
33*cdf0e10cSrcweir #include <com/sun/star/sdbc/KeyRule.hpp>
34*cdf0e10cSrcweir #include <com/sun/star/sdbc/IndexType.hpp>
35*cdf0e10cSrcweir #include <comphelper/property.hxx>
36*cdf0e10cSrcweir #include <com/sun/star/lang/DisposedException.hpp>
37*cdf0e10cSrcweir #include <com/sun/star/sdbc/ResultSetConcurrency.hpp>
38*cdf0e10cSrcweir #include <com/sun/star/sdbc/ResultSetType.hpp>
39*cdf0e10cSrcweir #include <com/sun/star/sdbc/FetchDirection.hpp>
40*cdf0e10cSrcweir #include <cppuhelper/typeprovider.hxx>
41*cdf0e10cSrcweir #include <comphelper/sequence.hxx>
42*cdf0e10cSrcweir #include <com/sun/star/beans/PropertyAttribute.hpp>
43*cdf0e10cSrcweir #include <comphelper/seqstream.hxx>
44*cdf0e10cSrcweir #include "connectivity/dbexception.hxx"
45*cdf0e10cSrcweir #include "connectivity/dbtools.hxx"
46*cdf0e10cSrcweir #include <comphelper/types.hxx>
47*cdf0e10cSrcweir 
48*cdf0e10cSrcweir using namespace ::comphelper;
49*cdf0e10cSrcweir 
50*cdf0e10cSrcweir 
51*cdf0e10cSrcweir #include <oledb.h>
52*cdf0e10cSrcweir 
53*cdf0e10cSrcweir #define CHECK_RETURN(x)													\
54*cdf0e10cSrcweir 	if(!SUCCEEDED(x))																\
55*cdf0e10cSrcweir 		ADOS::ThrowException(*m_pStmt->m_pConnection->getConnection(),*this);
56*cdf0e10cSrcweir 
57*cdf0e10cSrcweir using namespace connectivity::ado;
58*cdf0e10cSrcweir using namespace com::sun::star::uno;
59*cdf0e10cSrcweir using namespace com::sun::star::lang;
60*cdf0e10cSrcweir using namespace com::sun::star::beans;
61*cdf0e10cSrcweir using namespace com::sun::star::sdbc;
62*cdf0e10cSrcweir 
63*cdf0e10cSrcweir //------------------------------------------------------------------------------
64*cdf0e10cSrcweir //	IMPLEMENT_SERVICE_INFO(OResultSet,"com.sun.star.sdbcx.AResultSet","com.sun.star.sdbc.ResultSet");
65*cdf0e10cSrcweir ::rtl::OUString SAL_CALL OResultSet::getImplementationName(  ) throw (::com::sun::star::uno::RuntimeException)	\
66*cdf0e10cSrcweir {
67*cdf0e10cSrcweir 	return ::rtl::OUString::createFromAscii("com.sun.star.sdbcx.ado.ResultSet");
68*cdf0e10cSrcweir }
69*cdf0e10cSrcweir // -------------------------------------------------------------------------
70*cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL OResultSet::getSupportedServiceNames(  ) throw(::com::sun::star::uno::RuntimeException)
71*cdf0e10cSrcweir {
72*cdf0e10cSrcweir 	::com::sun::star::uno::Sequence< ::rtl::OUString > aSupported(2);
73*cdf0e10cSrcweir 	aSupported[0] = ::rtl::OUString::createFromAscii("com.sun.star.sdbc.ResultSet");
74*cdf0e10cSrcweir 	aSupported[1] = ::rtl::OUString::createFromAscii("com.sun.star.sdbcx.ResultSet");
75*cdf0e10cSrcweir 	return aSupported;
76*cdf0e10cSrcweir }
77*cdf0e10cSrcweir // -------------------------------------------------------------------------
78*cdf0e10cSrcweir sal_Bool SAL_CALL OResultSet::supportsService( const ::rtl::OUString& _rServiceName ) throw(::com::sun::star::uno::RuntimeException)
79*cdf0e10cSrcweir {
80*cdf0e10cSrcweir 	Sequence< ::rtl::OUString > aSupported(getSupportedServiceNames());
81*cdf0e10cSrcweir 	const ::rtl::OUString* pSupported = aSupported.getConstArray();
82*cdf0e10cSrcweir 	const ::rtl::OUString* pEnd = pSupported + aSupported.getLength();
83*cdf0e10cSrcweir 	for (;pSupported != pEnd && !pSupported->equals(_rServiceName); ++pSupported)
84*cdf0e10cSrcweir 		;
85*cdf0e10cSrcweir 
86*cdf0e10cSrcweir 	return pSupported != pEnd;
87*cdf0e10cSrcweir }
88*cdf0e10cSrcweir // -------------------------------------------------------------------------
89*cdf0e10cSrcweir OResultSet::OResultSet(ADORecordset* _pRecordSet,OStatement_Base* pStmt) :	OResultSet_BASE(m_aMutex)
90*cdf0e10cSrcweir 						,OPropertySetHelper(OResultSet_BASE::rBHelper)
91*cdf0e10cSrcweir 						,m_xStatement(*pStmt)
92*cdf0e10cSrcweir 						,m_pStmt(pStmt)
93*cdf0e10cSrcweir 						,m_nRowPos(0)
94*cdf0e10cSrcweir 						,m_xMetaData(NULL)
95*cdf0e10cSrcweir 						,m_pRecordSet(_pRecordSet)
96*cdf0e10cSrcweir 						,m_bEOF(sal_False)
97*cdf0e10cSrcweir {
98*cdf0e10cSrcweir }
99*cdf0e10cSrcweir // -------------------------------------------------------------------------
100*cdf0e10cSrcweir OResultSet::OResultSet(ADORecordset* _pRecordSet) :	OResultSet_BASE(m_aMutex)
101*cdf0e10cSrcweir 						,OPropertySetHelper(OResultSet_BASE::rBHelper)
102*cdf0e10cSrcweir 						,m_xStatement(NULL)
103*cdf0e10cSrcweir 						,m_xMetaData(NULL)
104*cdf0e10cSrcweir 						,m_pRecordSet(_pRecordSet)
105*cdf0e10cSrcweir 						,m_bEOF(sal_False)
106*cdf0e10cSrcweir {
107*cdf0e10cSrcweir }
108*cdf0e10cSrcweir // -----------------------------------------------------------------------------
109*cdf0e10cSrcweir void OResultSet::construct()
110*cdf0e10cSrcweir {
111*cdf0e10cSrcweir 	osl_incrementInterlockedCount( &m_refCount );
112*cdf0e10cSrcweir 	if (!m_pRecordSet)
113*cdf0e10cSrcweir 	{
114*cdf0e10cSrcweir 		OSL_ENSURE( sal_False, "OResultSet::construct: no RecordSet!" );
115*cdf0e10cSrcweir 		Reference< XInterface > xInt( *this );
116*cdf0e10cSrcweir 		osl_decrementInterlockedCount( &m_refCount );
117*cdf0e10cSrcweir 		::dbtools::throwFunctionSequenceException( xInt );
118*cdf0e10cSrcweir 	}
119*cdf0e10cSrcweir 	m_pRecordSet->AddRef();
120*cdf0e10cSrcweir 	VARIANT_BOOL bIsAtBOF;
121*cdf0e10cSrcweir 	CHECK_RETURN(m_pRecordSet->get_BOF(&bIsAtBOF))
122*cdf0e10cSrcweir 	m_bOnFirstAfterOpen = bIsAtBOF != VARIANT_TRUE;
123*cdf0e10cSrcweir 	osl_decrementInterlockedCount( &m_refCount );
124*cdf0e10cSrcweir }
125*cdf0e10cSrcweir // -------------------------------------------------------------------------
126*cdf0e10cSrcweir OResultSet::~OResultSet()
127*cdf0e10cSrcweir {
128*cdf0e10cSrcweir 	if(m_pRecordSet)
129*cdf0e10cSrcweir 		m_pRecordSet->Release();
130*cdf0e10cSrcweir }
131*cdf0e10cSrcweir // -------------------------------------------------------------------------
132*cdf0e10cSrcweir void OResultSet::disposing(void)
133*cdf0e10cSrcweir {
134*cdf0e10cSrcweir 	OPropertySetHelper::disposing();
135*cdf0e10cSrcweir 
136*cdf0e10cSrcweir 	::osl::MutexGuard aGuard(m_aMutex);
137*cdf0e10cSrcweir 	if(m_pRecordSet)
138*cdf0e10cSrcweir 		m_pRecordSet->Close();
139*cdf0e10cSrcweir m_xStatement.clear();
140*cdf0e10cSrcweir m_xMetaData.clear();
141*cdf0e10cSrcweir }
142*cdf0e10cSrcweir // -------------------------------------------------------------------------
143*cdf0e10cSrcweir Any SAL_CALL OResultSet::queryInterface( const Type & rType ) throw(RuntimeException)
144*cdf0e10cSrcweir {
145*cdf0e10cSrcweir 	Any aRet = OPropertySetHelper::queryInterface(rType);
146*cdf0e10cSrcweir 	return aRet.hasValue() ? aRet : OResultSet_BASE::queryInterface(rType);
147*cdf0e10cSrcweir }
148*cdf0e10cSrcweir // -------------------------------------------------------------------------
149*cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL OResultSet::getTypes(  ) throw(::com::sun::star::uno::RuntimeException)
150*cdf0e10cSrcweir {
151*cdf0e10cSrcweir 	::cppu::OTypeCollection aTypes(	::getCppuType( (const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XMultiPropertySet > *)0 ),
152*cdf0e10cSrcweir 									::getCppuType( (const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XFastPropertySet > *)0 ),
153*cdf0e10cSrcweir 									::getCppuType( (const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > *)0 ));
154*cdf0e10cSrcweir 
155*cdf0e10cSrcweir 	return ::comphelper::concatSequences(aTypes.getTypes(),OResultSet_BASE::getTypes());
156*cdf0e10cSrcweir }
157*cdf0e10cSrcweir 
158*cdf0e10cSrcweir // -------------------------------------------------------------------------
159*cdf0e10cSrcweir 
160*cdf0e10cSrcweir sal_Int32 SAL_CALL OResultSet::findColumn( const ::rtl::OUString& columnName ) throw(SQLException, RuntimeException)
161*cdf0e10cSrcweir {
162*cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
163*cdf0e10cSrcweir 	checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
164*cdf0e10cSrcweir 
165*cdf0e10cSrcweir 
166*cdf0e10cSrcweir 	Reference< XResultSetMetaData > xMeta = getMetaData();
167*cdf0e10cSrcweir 	sal_Int32 nLen = xMeta->getColumnCount();
168*cdf0e10cSrcweir 	sal_Int32 i = 1;
169*cdf0e10cSrcweir 	for(;i<=nLen;++i)
170*cdf0e10cSrcweir 		if(xMeta->isCaseSensitive(i) ? columnName == xMeta->getColumnName(i) :
171*cdf0e10cSrcweir 			columnName.equalsIgnoreAsciiCase(xMeta->getColumnName(i)))
172*cdf0e10cSrcweir 			break;
173*cdf0e10cSrcweir 	return i;
174*cdf0e10cSrcweir }
175*cdf0e10cSrcweir #define BLOCK_SIZE 256
176*cdf0e10cSrcweir // -------------------------------------------------------------------------
177*cdf0e10cSrcweir Reference< ::com::sun::star::io::XInputStream > SAL_CALL OResultSet::getBinaryStream( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
178*cdf0e10cSrcweir {
179*cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
180*cdf0e10cSrcweir 	checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
181*cdf0e10cSrcweir 
182*cdf0e10cSrcweir 	WpADOField aField = ADOS::getField(m_pRecordSet,columnIndex);
183*cdf0e10cSrcweir 
184*cdf0e10cSrcweir 	if((aField.GetAttributes() & adFldLong) == adFldLong)
185*cdf0e10cSrcweir 	{
186*cdf0e10cSrcweir 		//Copy the data only upto the Actual Size of Field.
187*cdf0e10cSrcweir 		sal_Int32 nSize = aField.GetActualSize();
188*cdf0e10cSrcweir 		Sequence<sal_Int8> aData(nSize);
189*cdf0e10cSrcweir 		long index = 0;
190*cdf0e10cSrcweir 		while(index < nSize)
191*cdf0e10cSrcweir 		{
192*cdf0e10cSrcweir 			m_aValue = aField.GetChunk(BLOCK_SIZE);
193*cdf0e10cSrcweir 			if(m_aValue.isNull())
194*cdf0e10cSrcweir 				break;
195*cdf0e10cSrcweir 			UCHAR chData;
196*cdf0e10cSrcweir 			for(long index2 = 0;index2 < BLOCK_SIZE;++index2)
197*cdf0e10cSrcweir 			{
198*cdf0e10cSrcweir 				HRESULT hr = ::SafeArrayGetElement(m_aValue.parray,&index2,&chData);
199*cdf0e10cSrcweir 				if(SUCCEEDED(hr))
200*cdf0e10cSrcweir 				{
201*cdf0e10cSrcweir 					//Take BYTE by BYTE and advance Memory Location
202*cdf0e10cSrcweir 					aData.getArray()[index++] = chData;
203*cdf0e10cSrcweir 				}
204*cdf0e10cSrcweir 				else
205*cdf0e10cSrcweir 					break;
206*cdf0e10cSrcweir 			}
207*cdf0e10cSrcweir 		}
208*cdf0e10cSrcweir 
209*cdf0e10cSrcweir 		return new ::comphelper::SequenceInputStream(aData);
210*cdf0e10cSrcweir 	}
211*cdf0e10cSrcweir 	// else we ask for a bytesequence
212*cdf0e10cSrcweir 	aField.get_Value(m_aValue);
213*cdf0e10cSrcweir 
214*cdf0e10cSrcweir 	return m_aValue.isNull() ? NULL : new ::comphelper::SequenceInputStream(m_aValue);
215*cdf0e10cSrcweir }
216*cdf0e10cSrcweir // -------------------------------------------------------------------------
217*cdf0e10cSrcweir Reference< ::com::sun::star::io::XInputStream > SAL_CALL OResultSet::getCharacterStream( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
218*cdf0e10cSrcweir {
219*cdf0e10cSrcweir     ::dbtools::throwFeatureNotImplementedException( "XRow::getCharacterStream", *this );
220*cdf0e10cSrcweir 	return NULL;
221*cdf0e10cSrcweir }
222*cdf0e10cSrcweir // -----------------------------------------------------------------------------
223*cdf0e10cSrcweir OLEVariant OResultSet::getValue(sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
224*cdf0e10cSrcweir {
225*cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
226*cdf0e10cSrcweir 	checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
227*cdf0e10cSrcweir 
228*cdf0e10cSrcweir 	WpADOField aField = ADOS::getField(m_pRecordSet,columnIndex);
229*cdf0e10cSrcweir 	aField.get_Value(m_aValue);
230*cdf0e10cSrcweir 	return m_aValue;
231*cdf0e10cSrcweir }
232*cdf0e10cSrcweir // -------------------------------------------------------------------------
233*cdf0e10cSrcweir sal_Bool SAL_CALL OResultSet::getBoolean( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
234*cdf0e10cSrcweir {
235*cdf0e10cSrcweir 	return getValue(columnIndex);
236*cdf0e10cSrcweir }
237*cdf0e10cSrcweir // -------------------------------------------------------------------------
238*cdf0e10cSrcweir 
239*cdf0e10cSrcweir sal_Int8 SAL_CALL OResultSet::getByte( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
240*cdf0e10cSrcweir {
241*cdf0e10cSrcweir 	return getValue(columnIndex);
242*cdf0e10cSrcweir }
243*cdf0e10cSrcweir // -------------------------------------------------------------------------
244*cdf0e10cSrcweir 
245*cdf0e10cSrcweir Sequence< sal_Int8 > SAL_CALL OResultSet::getBytes( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
246*cdf0e10cSrcweir {
247*cdf0e10cSrcweir 	return getValue(columnIndex);
248*cdf0e10cSrcweir }
249*cdf0e10cSrcweir // -------------------------------------------------------------------------
250*cdf0e10cSrcweir 
251*cdf0e10cSrcweir ::com::sun::star::util::Date SAL_CALL OResultSet::getDate( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
252*cdf0e10cSrcweir {
253*cdf0e10cSrcweir 	return getValue(columnIndex);
254*cdf0e10cSrcweir }
255*cdf0e10cSrcweir // -------------------------------------------------------------------------
256*cdf0e10cSrcweir 
257*cdf0e10cSrcweir double SAL_CALL OResultSet::getDouble( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
258*cdf0e10cSrcweir {
259*cdf0e10cSrcweir 	return getValue(columnIndex);
260*cdf0e10cSrcweir }
261*cdf0e10cSrcweir // -------------------------------------------------------------------------
262*cdf0e10cSrcweir 
263*cdf0e10cSrcweir float SAL_CALL OResultSet::getFloat( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
264*cdf0e10cSrcweir {
265*cdf0e10cSrcweir 	return getValue(columnIndex);
266*cdf0e10cSrcweir }
267*cdf0e10cSrcweir // -------------------------------------------------------------------------
268*cdf0e10cSrcweir 
269*cdf0e10cSrcweir sal_Int32 SAL_CALL OResultSet::getInt( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
270*cdf0e10cSrcweir {
271*cdf0e10cSrcweir 	return getValue(columnIndex);
272*cdf0e10cSrcweir }
273*cdf0e10cSrcweir // -------------------------------------------------------------------------
274*cdf0e10cSrcweir 
275*cdf0e10cSrcweir sal_Int32 SAL_CALL OResultSet::getRow(  ) throw(SQLException, RuntimeException)
276*cdf0e10cSrcweir {
277*cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
278*cdf0e10cSrcweir 	checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
279*cdf0e10cSrcweir 
280*cdf0e10cSrcweir 
281*cdf0e10cSrcweir 	PositionEnum aPos;
282*cdf0e10cSrcweir 	m_pRecordSet->get_AbsolutePosition(&aPos);
283*cdf0e10cSrcweir 	return  (aPos > 0) ? aPos : m_nRowPos;
284*cdf0e10cSrcweir 	// return the rowcount from driver if the driver doesn't support this return our count
285*cdf0e10cSrcweir }
286*cdf0e10cSrcweir // -------------------------------------------------------------------------
287*cdf0e10cSrcweir 
288*cdf0e10cSrcweir sal_Int64 SAL_CALL OResultSet::getLong( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
289*cdf0e10cSrcweir {
290*cdf0e10cSrcweir     ::dbtools::throwFeatureNotImplementedException( "XRow::getLong", *this );
291*cdf0e10cSrcweir 	return sal_Int64(0);
292*cdf0e10cSrcweir }
293*cdf0e10cSrcweir // -------------------------------------------------------------------------
294*cdf0e10cSrcweir 
295*cdf0e10cSrcweir Reference< XResultSetMetaData > SAL_CALL OResultSet::getMetaData(  ) throw(SQLException, RuntimeException)
296*cdf0e10cSrcweir {
297*cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
298*cdf0e10cSrcweir 	checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
299*cdf0e10cSrcweir 
300*cdf0e10cSrcweir 
301*cdf0e10cSrcweir 	if(!m_xMetaData.is())
302*cdf0e10cSrcweir 		m_xMetaData = new OResultSetMetaData(m_pRecordSet);
303*cdf0e10cSrcweir 	return m_xMetaData;
304*cdf0e10cSrcweir }
305*cdf0e10cSrcweir // -------------------------------------------------------------------------
306*cdf0e10cSrcweir Reference< XArray > SAL_CALL OResultSet::getArray( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
307*cdf0e10cSrcweir {
308*cdf0e10cSrcweir     ::dbtools::throwFeatureNotImplementedException( "XRow::getArray", *this );
309*cdf0e10cSrcweir 	return NULL;
310*cdf0e10cSrcweir }
311*cdf0e10cSrcweir 
312*cdf0e10cSrcweir // -------------------------------------------------------------------------
313*cdf0e10cSrcweir 
314*cdf0e10cSrcweir Reference< XClob > SAL_CALL OResultSet::getClob( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
315*cdf0e10cSrcweir {
316*cdf0e10cSrcweir     ::dbtools::throwFeatureNotImplementedException( "XRow::getClob", *this );
317*cdf0e10cSrcweir 	return NULL;
318*cdf0e10cSrcweir }
319*cdf0e10cSrcweir // -------------------------------------------------------------------------
320*cdf0e10cSrcweir Reference< XBlob > SAL_CALL OResultSet::getBlob( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
321*cdf0e10cSrcweir {
322*cdf0e10cSrcweir     ::dbtools::throwFeatureNotImplementedException( "XRow::getBlob", *this );
323*cdf0e10cSrcweir 	return NULL;
324*cdf0e10cSrcweir }
325*cdf0e10cSrcweir // -------------------------------------------------------------------------
326*cdf0e10cSrcweir 
327*cdf0e10cSrcweir Reference< XRef > SAL_CALL OResultSet::getRef( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
328*cdf0e10cSrcweir {
329*cdf0e10cSrcweir     ::dbtools::throwFeatureNotImplementedException( "XRow::getRef", *this );
330*cdf0e10cSrcweir 	return NULL;
331*cdf0e10cSrcweir }
332*cdf0e10cSrcweir // -------------------------------------------------------------------------
333*cdf0e10cSrcweir 
334*cdf0e10cSrcweir Any SAL_CALL OResultSet::getObject( sal_Int32 columnIndex, const Reference< ::com::sun::star::container::XNameAccess >& /*typeMap*/ ) throw(SQLException, RuntimeException)
335*cdf0e10cSrcweir {
336*cdf0e10cSrcweir     return getValue(columnIndex).makeAny();
337*cdf0e10cSrcweir }
338*cdf0e10cSrcweir // -------------------------------------------------------------------------
339*cdf0e10cSrcweir 
340*cdf0e10cSrcweir sal_Int16 SAL_CALL OResultSet::getShort( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
341*cdf0e10cSrcweir {
342*cdf0e10cSrcweir 	return getValue(columnIndex);
343*cdf0e10cSrcweir }
344*cdf0e10cSrcweir // -------------------------------------------------------------------------
345*cdf0e10cSrcweir 
346*cdf0e10cSrcweir ::rtl::OUString SAL_CALL OResultSet::getString( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
347*cdf0e10cSrcweir {
348*cdf0e10cSrcweir 	return getValue(columnIndex);
349*cdf0e10cSrcweir }
350*cdf0e10cSrcweir 
351*cdf0e10cSrcweir // -------------------------------------------------------------------------
352*cdf0e10cSrcweir 
353*cdf0e10cSrcweir 
354*cdf0e10cSrcweir ::com::sun::star::util::Time SAL_CALL OResultSet::getTime( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
355*cdf0e10cSrcweir {
356*cdf0e10cSrcweir 	return getValue(columnIndex);
357*cdf0e10cSrcweir }
358*cdf0e10cSrcweir // -------------------------------------------------------------------------
359*cdf0e10cSrcweir 
360*cdf0e10cSrcweir 
361*cdf0e10cSrcweir ::com::sun::star::util::DateTime SAL_CALL OResultSet::getTimestamp( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
362*cdf0e10cSrcweir {
363*cdf0e10cSrcweir 	return getValue(columnIndex);
364*cdf0e10cSrcweir }
365*cdf0e10cSrcweir // -------------------------------------------------------------------------
366*cdf0e10cSrcweir 
367*cdf0e10cSrcweir sal_Bool SAL_CALL OResultSet::isAfterLast(  ) throw(SQLException, RuntimeException)
368*cdf0e10cSrcweir {
369*cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
370*cdf0e10cSrcweir 	checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
371*cdf0e10cSrcweir 
372*cdf0e10cSrcweir 
373*cdf0e10cSrcweir 	VARIANT_BOOL bIsAtEOF;
374*cdf0e10cSrcweir 	CHECK_RETURN(m_pRecordSet->get_EOF(&bIsAtEOF))
375*cdf0e10cSrcweir 	return bIsAtEOF == VARIANT_TRUE;
376*cdf0e10cSrcweir }
377*cdf0e10cSrcweir // -------------------------------------------------------------------------
378*cdf0e10cSrcweir sal_Bool SAL_CALL OResultSet::isFirst(  ) throw(SQLException, RuntimeException)
379*cdf0e10cSrcweir {
380*cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
381*cdf0e10cSrcweir 	checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
382*cdf0e10cSrcweir 
383*cdf0e10cSrcweir 
384*cdf0e10cSrcweir 	return m_nRowPos == 1;
385*cdf0e10cSrcweir }
386*cdf0e10cSrcweir // -------------------------------------------------------------------------
387*cdf0e10cSrcweir sal_Bool SAL_CALL OResultSet::isLast(  ) throw(SQLException, RuntimeException)
388*cdf0e10cSrcweir {
389*cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
390*cdf0e10cSrcweir 	checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
391*cdf0e10cSrcweir 
392*cdf0e10cSrcweir 
393*cdf0e10cSrcweir 	return sal_True;
394*cdf0e10cSrcweir }
395*cdf0e10cSrcweir // -------------------------------------------------------------------------
396*cdf0e10cSrcweir void SAL_CALL OResultSet::beforeFirst(  ) throw(SQLException, RuntimeException)
397*cdf0e10cSrcweir {
398*cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
399*cdf0e10cSrcweir 	checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
400*cdf0e10cSrcweir 
401*cdf0e10cSrcweir 
402*cdf0e10cSrcweir 	if(first())
403*cdf0e10cSrcweir 		m_bOnFirstAfterOpen = !previous();
404*cdf0e10cSrcweir }
405*cdf0e10cSrcweir // -------------------------------------------------------------------------
406*cdf0e10cSrcweir void SAL_CALL OResultSet::afterLast(  ) throw(SQLException, RuntimeException)
407*cdf0e10cSrcweir {
408*cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
409*cdf0e10cSrcweir 	checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
410*cdf0e10cSrcweir 
411*cdf0e10cSrcweir 
412*cdf0e10cSrcweir 	if(last())
413*cdf0e10cSrcweir 		next();
414*cdf0e10cSrcweir 	m_bEOF = sal_True;
415*cdf0e10cSrcweir }
416*cdf0e10cSrcweir // -------------------------------------------------------------------------
417*cdf0e10cSrcweir 
418*cdf0e10cSrcweir void SAL_CALL OResultSet::close(  ) throw(SQLException, RuntimeException)
419*cdf0e10cSrcweir {
420*cdf0e10cSrcweir 	{
421*cdf0e10cSrcweir 		::osl::MutexGuard aGuard( m_aMutex );
422*cdf0e10cSrcweir 		checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
423*cdf0e10cSrcweir 
424*cdf0e10cSrcweir 	}
425*cdf0e10cSrcweir 	dispose();
426*cdf0e10cSrcweir }
427*cdf0e10cSrcweir // -------------------------------------------------------------------------
428*cdf0e10cSrcweir 
429*cdf0e10cSrcweir sal_Bool SAL_CALL OResultSet::first(  ) throw(SQLException, RuntimeException)
430*cdf0e10cSrcweir {
431*cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
432*cdf0e10cSrcweir 	checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
433*cdf0e10cSrcweir 
434*cdf0e10cSrcweir 
435*cdf0e10cSrcweir 	if(SUCCEEDED(m_pRecordSet->MoveFirst()))
436*cdf0e10cSrcweir 	{
437*cdf0e10cSrcweir 		m_nRowPos = 1;
438*cdf0e10cSrcweir 		m_bOnFirstAfterOpen = sal_False;
439*cdf0e10cSrcweir 		return sal_True;
440*cdf0e10cSrcweir 	}
441*cdf0e10cSrcweir 	return sal_False;
442*cdf0e10cSrcweir }
443*cdf0e10cSrcweir // -------------------------------------------------------------------------
444*cdf0e10cSrcweir 
445*cdf0e10cSrcweir sal_Bool SAL_CALL OResultSet::last(  ) throw(SQLException, RuntimeException)
446*cdf0e10cSrcweir {
447*cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
448*cdf0e10cSrcweir 	checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
449*cdf0e10cSrcweir 
450*cdf0e10cSrcweir 
451*cdf0e10cSrcweir 	sal_Bool bRet = SUCCEEDED(m_pRecordSet->MoveLast());
452*cdf0e10cSrcweir 	if(bRet)
453*cdf0e10cSrcweir 	{
454*cdf0e10cSrcweir 		m_pRecordSet->get_RecordCount(&m_nRowPos);
455*cdf0e10cSrcweir 		m_bOnFirstAfterOpen = sal_False;
456*cdf0e10cSrcweir 	}
457*cdf0e10cSrcweir 	return bRet;
458*cdf0e10cSrcweir }
459*cdf0e10cSrcweir // -------------------------------------------------------------------------
460*cdf0e10cSrcweir sal_Bool SAL_CALL OResultSet::absolute( sal_Int32 row ) throw(SQLException, RuntimeException)
461*cdf0e10cSrcweir {
462*cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
463*cdf0e10cSrcweir 	checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
464*cdf0e10cSrcweir 
465*cdf0e10cSrcweir 
466*cdf0e10cSrcweir 	if(!row)				 // absolute with zero not allowed
467*cdf0e10cSrcweir 		::dbtools::throwFunctionSequenceException(*this);
468*cdf0e10cSrcweir 
469*cdf0e10cSrcweir 	sal_Bool bCheck = sal_True;
470*cdf0e10cSrcweir 	if(row < 0)
471*cdf0e10cSrcweir 	{
472*cdf0e10cSrcweir         bCheck = SUCCEEDED(m_pRecordSet->MoveLast());
473*cdf0e10cSrcweir 		if ( bCheck )
474*cdf0e10cSrcweir 		{
475*cdf0e10cSrcweir 			while(++row < 0 && bCheck)
476*cdf0e10cSrcweir 				bCheck = SUCCEEDED(m_pRecordSet->MovePrevious());
477*cdf0e10cSrcweir 		}
478*cdf0e10cSrcweir 	}
479*cdf0e10cSrcweir 	else
480*cdf0e10cSrcweir 	{
481*cdf0e10cSrcweir 		first();
482*cdf0e10cSrcweir 		OLEVariant aEmpty;
483*cdf0e10cSrcweir 		aEmpty.setNoArg();
484*cdf0e10cSrcweir 		bCheck = SUCCEEDED(m_pRecordSet->Move(row-1,aEmpty)); // move to row -1 because we stand already on the first
485*cdf0e10cSrcweir 		if(bCheck)
486*cdf0e10cSrcweir 			m_nRowPos = row;
487*cdf0e10cSrcweir 	}
488*cdf0e10cSrcweir 	if(bCheck)
489*cdf0e10cSrcweir 		m_bOnFirstAfterOpen = sal_False;
490*cdf0e10cSrcweir 	return bCheck;
491*cdf0e10cSrcweir }
492*cdf0e10cSrcweir // -------------------------------------------------------------------------
493*cdf0e10cSrcweir sal_Bool SAL_CALL OResultSet::relative( sal_Int32 row ) throw(SQLException, RuntimeException)
494*cdf0e10cSrcweir {
495*cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
496*cdf0e10cSrcweir 	checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
497*cdf0e10cSrcweir 
498*cdf0e10cSrcweir 
499*cdf0e10cSrcweir 	OLEVariant aEmpty;
500*cdf0e10cSrcweir 	aEmpty.setNoArg();
501*cdf0e10cSrcweir 	sal_Int32 nNewPos = row;
502*cdf0e10cSrcweir 	if ( m_bOnFirstAfterOpen && nNewPos > 0 )
503*cdf0e10cSrcweir 		--nNewPos;
504*cdf0e10cSrcweir 	sal_Bool bRet = SUCCEEDED(m_pRecordSet->Move(row,aEmpty));
505*cdf0e10cSrcweir 	if(bRet)
506*cdf0e10cSrcweir 	{
507*cdf0e10cSrcweir 		m_nRowPos += row;
508*cdf0e10cSrcweir 		m_bOnFirstAfterOpen = sal_False;
509*cdf0e10cSrcweir 	}
510*cdf0e10cSrcweir 	return bRet;
511*cdf0e10cSrcweir }
512*cdf0e10cSrcweir // -------------------------------------------------------------------------
513*cdf0e10cSrcweir sal_Bool SAL_CALL OResultSet::previous(  ) throw(SQLException, RuntimeException)
514*cdf0e10cSrcweir {
515*cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
516*cdf0e10cSrcweir 	checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
517*cdf0e10cSrcweir 
518*cdf0e10cSrcweir 	sal_Bool bRet = SUCCEEDED(m_pRecordSet->MovePrevious());
519*cdf0e10cSrcweir 	if(bRet)
520*cdf0e10cSrcweir 	{
521*cdf0e10cSrcweir 		--m_nRowPos;
522*cdf0e10cSrcweir 		m_bOnFirstAfterOpen = sal_False;
523*cdf0e10cSrcweir 	}
524*cdf0e10cSrcweir 	return bRet;
525*cdf0e10cSrcweir }
526*cdf0e10cSrcweir // -------------------------------------------------------------------------
527*cdf0e10cSrcweir Reference< XInterface > SAL_CALL OResultSet::getStatement(  ) throw(SQLException, RuntimeException)
528*cdf0e10cSrcweir {
529*cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
530*cdf0e10cSrcweir 	checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
531*cdf0e10cSrcweir 	return m_xStatement;
532*cdf0e10cSrcweir }
533*cdf0e10cSrcweir // -------------------------------------------------------------------------
534*cdf0e10cSrcweir 
535*cdf0e10cSrcweir sal_Bool SAL_CALL OResultSet::rowDeleted(  ) throw(SQLException, RuntimeException)
536*cdf0e10cSrcweir {
537*cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
538*cdf0e10cSrcweir 	checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
539*cdf0e10cSrcweir 
540*cdf0e10cSrcweir 
541*cdf0e10cSrcweir 	RecordStatusEnum eRec;
542*cdf0e10cSrcweir 	m_pRecordSet->get_Status((sal_Int32*)&eRec);
543*cdf0e10cSrcweir 	sal_Bool  bRet = (eRec & adRecDeleted) == adRecDeleted;
544*cdf0e10cSrcweir 	if(bRet)
545*cdf0e10cSrcweir 		--m_nRowPos;
546*cdf0e10cSrcweir 	return bRet;
547*cdf0e10cSrcweir }
548*cdf0e10cSrcweir // -------------------------------------------------------------------------
549*cdf0e10cSrcweir sal_Bool SAL_CALL OResultSet::rowInserted(  ) throw(SQLException, RuntimeException)
550*cdf0e10cSrcweir {	::osl::MutexGuard aGuard( m_aMutex );
551*cdf0e10cSrcweir 	checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
552*cdf0e10cSrcweir 
553*cdf0e10cSrcweir 
554*cdf0e10cSrcweir 	RecordStatusEnum eRec;
555*cdf0e10cSrcweir 	m_pRecordSet->get_Status((sal_Int32*)&eRec);
556*cdf0e10cSrcweir 	sal_Bool  bRet = (eRec & adRecNew) == adRecNew;
557*cdf0e10cSrcweir 	if(bRet)
558*cdf0e10cSrcweir 		++m_nRowPos;
559*cdf0e10cSrcweir 	return bRet;
560*cdf0e10cSrcweir }
561*cdf0e10cSrcweir // -------------------------------------------------------------------------
562*cdf0e10cSrcweir sal_Bool SAL_CALL OResultSet::rowUpdated(  ) throw(SQLException, RuntimeException)
563*cdf0e10cSrcweir {
564*cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
565*cdf0e10cSrcweir 	checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
566*cdf0e10cSrcweir 
567*cdf0e10cSrcweir 
568*cdf0e10cSrcweir 	RecordStatusEnum eRec;
569*cdf0e10cSrcweir 	m_pRecordSet->get_Status((sal_Int32*)&eRec);
570*cdf0e10cSrcweir 	return (eRec & adRecModified) == adRecModified;
571*cdf0e10cSrcweir }
572*cdf0e10cSrcweir // -------------------------------------------------------------------------
573*cdf0e10cSrcweir 
574*cdf0e10cSrcweir sal_Bool SAL_CALL OResultSet::isBeforeFirst(  ) throw(SQLException, RuntimeException)
575*cdf0e10cSrcweir {
576*cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
577*cdf0e10cSrcweir 	checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
578*cdf0e10cSrcweir 
579*cdf0e10cSrcweir 
580*cdf0e10cSrcweir 	OSL_ENSURE(!m_nRowPos,"OResultSet::isBeforeFirst: Error in setting m_nRowPos!");
581*cdf0e10cSrcweir 	VARIANT_BOOL bIsAtBOF = VARIANT_TRUE;
582*cdf0e10cSrcweir 	if(!m_bOnFirstAfterOpen)
583*cdf0e10cSrcweir 	{
584*cdf0e10cSrcweir 		OSL_ENSURE(!m_nRowPos,"OResultSet::isBeforeFirst: Error in setting m_nRowPos!");
585*cdf0e10cSrcweir 		m_pRecordSet->get_BOF(&bIsAtBOF);
586*cdf0e10cSrcweir 	}
587*cdf0e10cSrcweir 	return bIsAtBOF == VARIANT_TRUE;
588*cdf0e10cSrcweir }
589*cdf0e10cSrcweir // -------------------------------------------------------------------------
590*cdf0e10cSrcweir 
591*cdf0e10cSrcweir sal_Bool SAL_CALL OResultSet::next(  ) throw(SQLException, RuntimeException)
592*cdf0e10cSrcweir {
593*cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
594*cdf0e10cSrcweir 	checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
595*cdf0e10cSrcweir 
596*cdf0e10cSrcweir 
597*cdf0e10cSrcweir 	sal_Bool bRet = sal_True;
598*cdf0e10cSrcweir 	if(m_bOnFirstAfterOpen)
599*cdf0e10cSrcweir 	{
600*cdf0e10cSrcweir 		m_bOnFirstAfterOpen = sal_False;
601*cdf0e10cSrcweir 		++m_nRowPos;
602*cdf0e10cSrcweir 	}
603*cdf0e10cSrcweir 	else
604*cdf0e10cSrcweir 	{
605*cdf0e10cSrcweir 		bRet = SUCCEEDED(m_pRecordSet->MoveNext());
606*cdf0e10cSrcweir 
607*cdf0e10cSrcweir 		if(bRet)
608*cdf0e10cSrcweir 		{
609*cdf0e10cSrcweir 			VARIANT_BOOL bIsAtEOF;
610*cdf0e10cSrcweir 			CHECK_RETURN(m_pRecordSet->get_EOF(&bIsAtEOF))
611*cdf0e10cSrcweir 			bRet = bIsAtEOF != VARIANT_TRUE;
612*cdf0e10cSrcweir 			++m_nRowPos;
613*cdf0e10cSrcweir 		}
614*cdf0e10cSrcweir 		else
615*cdf0e10cSrcweir 			ADOS::ThrowException(*m_pStmt->m_pConnection->getConnection(),*this);
616*cdf0e10cSrcweir 	}
617*cdf0e10cSrcweir 
618*cdf0e10cSrcweir 	return bRet;
619*cdf0e10cSrcweir }
620*cdf0e10cSrcweir // -------------------------------------------------------------------------
621*cdf0e10cSrcweir 
622*cdf0e10cSrcweir sal_Bool SAL_CALL OResultSet::wasNull(  ) throw(SQLException, RuntimeException)
623*cdf0e10cSrcweir {
624*cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
625*cdf0e10cSrcweir 	checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
626*cdf0e10cSrcweir 
627*cdf0e10cSrcweir 
628*cdf0e10cSrcweir 	return m_aValue.isNull();
629*cdf0e10cSrcweir }
630*cdf0e10cSrcweir // -------------------------------------------------------------------------
631*cdf0e10cSrcweir 
632*cdf0e10cSrcweir void SAL_CALL OResultSet::cancel(  ) throw(RuntimeException)
633*cdf0e10cSrcweir {
634*cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
635*cdf0e10cSrcweir 	checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
636*cdf0e10cSrcweir 
637*cdf0e10cSrcweir 
638*cdf0e10cSrcweir 	m_pRecordSet->Cancel();
639*cdf0e10cSrcweir }
640*cdf0e10cSrcweir // -------------------------------------------------------------------------
641*cdf0e10cSrcweir void SAL_CALL OResultSet::clearWarnings(  ) throw(SQLException, RuntimeException)
642*cdf0e10cSrcweir {
643*cdf0e10cSrcweir }
644*cdf0e10cSrcweir // -------------------------------------------------------------------------
645*cdf0e10cSrcweir Any SAL_CALL OResultSet::getWarnings(  ) throw(SQLException, RuntimeException)
646*cdf0e10cSrcweir {
647*cdf0e10cSrcweir 	return Any();
648*cdf0e10cSrcweir }
649*cdf0e10cSrcweir // -------------------------------------------------------------------------
650*cdf0e10cSrcweir void SAL_CALL OResultSet::insertRow(  ) throw(SQLException, RuntimeException)
651*cdf0e10cSrcweir {
652*cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
653*cdf0e10cSrcweir 	checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
654*cdf0e10cSrcweir 
655*cdf0e10cSrcweir 
656*cdf0e10cSrcweir 	OLEVariant aEmpty;
657*cdf0e10cSrcweir 	aEmpty.setNoArg();
658*cdf0e10cSrcweir 	m_pRecordSet->AddNew(aEmpty,aEmpty);
659*cdf0e10cSrcweir }
660*cdf0e10cSrcweir // -------------------------------------------------------------------------
661*cdf0e10cSrcweir void SAL_CALL OResultSet::updateRow(  ) throw(SQLException, RuntimeException)
662*cdf0e10cSrcweir {
663*cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
664*cdf0e10cSrcweir 	checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
665*cdf0e10cSrcweir 
666*cdf0e10cSrcweir 
667*cdf0e10cSrcweir 	OLEVariant aEmpty;
668*cdf0e10cSrcweir 	aEmpty.setNoArg();
669*cdf0e10cSrcweir 	m_pRecordSet->Update(aEmpty,aEmpty);
670*cdf0e10cSrcweir }
671*cdf0e10cSrcweir // -------------------------------------------------------------------------
672*cdf0e10cSrcweir void SAL_CALL OResultSet::deleteRow(  ) throw(SQLException, RuntimeException)
673*cdf0e10cSrcweir {
674*cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
675*cdf0e10cSrcweir 	checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
676*cdf0e10cSrcweir 
677*cdf0e10cSrcweir 
678*cdf0e10cSrcweir 	m_pRecordSet->Delete(adAffectCurrent);
679*cdf0e10cSrcweir 	m_pRecordSet->UpdateBatch(adAffectCurrent);
680*cdf0e10cSrcweir }
681*cdf0e10cSrcweir // -------------------------------------------------------------------------
682*cdf0e10cSrcweir 
683*cdf0e10cSrcweir void SAL_CALL OResultSet::cancelRowUpdates(  ) throw(SQLException, RuntimeException)
684*cdf0e10cSrcweir {
685*cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
686*cdf0e10cSrcweir 	checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
687*cdf0e10cSrcweir 
688*cdf0e10cSrcweir 
689*cdf0e10cSrcweir 	m_pRecordSet->CancelUpdate();
690*cdf0e10cSrcweir }
691*cdf0e10cSrcweir // -------------------------------------------------------------------------
692*cdf0e10cSrcweir 
693*cdf0e10cSrcweir void SAL_CALL OResultSet::moveToInsertRow(  ) throw(SQLException, RuntimeException)
694*cdf0e10cSrcweir {
695*cdf0e10cSrcweir  //   ::osl::MutexGuard aGuard( m_aMutex );
696*cdf0e10cSrcweir 	//checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
697*cdf0e10cSrcweir  //   if ( getResultSetConcurrency() == ResultSetConcurrency::READ_ONLY )
698*cdf0e10cSrcweir  //       throw SQLException();
699*cdf0e10cSrcweir }
700*cdf0e10cSrcweir // -------------------------------------------------------------------------
701*cdf0e10cSrcweir 
702*cdf0e10cSrcweir void SAL_CALL OResultSet::moveToCurrentRow(  ) throw(SQLException, RuntimeException)
703*cdf0e10cSrcweir {
704*cdf0e10cSrcweir }
705*cdf0e10cSrcweir // -----------------------------------------------------------------------------
706*cdf0e10cSrcweir void OResultSet::updateValue(sal_Int32 columnIndex,const OLEVariant& x)
707*cdf0e10cSrcweir {
708*cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
709*cdf0e10cSrcweir 	checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
710*cdf0e10cSrcweir 
711*cdf0e10cSrcweir 	WpADOField aField = ADOS::getField(m_pRecordSet,columnIndex);
712*cdf0e10cSrcweir 	aField.PutValue(x);
713*cdf0e10cSrcweir }
714*cdf0e10cSrcweir // -------------------------------------------------------------------------
715*cdf0e10cSrcweir void SAL_CALL OResultSet::updateNull( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
716*cdf0e10cSrcweir {
717*cdf0e10cSrcweir 	OLEVariant x;
718*cdf0e10cSrcweir 	x.setNull();
719*cdf0e10cSrcweir 	updateValue(columnIndex,x);
720*cdf0e10cSrcweir }
721*cdf0e10cSrcweir // -------------------------------------------------------------------------
722*cdf0e10cSrcweir 
723*cdf0e10cSrcweir void SAL_CALL OResultSet::updateBoolean( sal_Int32 columnIndex, sal_Bool x ) throw(SQLException, RuntimeException)
724*cdf0e10cSrcweir {
725*cdf0e10cSrcweir 	updateValue(columnIndex,x);
726*cdf0e10cSrcweir }
727*cdf0e10cSrcweir // -------------------------------------------------------------------------
728*cdf0e10cSrcweir void SAL_CALL OResultSet::updateByte( sal_Int32 columnIndex, sal_Int8 x ) throw(SQLException, RuntimeException)
729*cdf0e10cSrcweir {
730*cdf0e10cSrcweir 	updateValue(columnIndex,x);
731*cdf0e10cSrcweir }
732*cdf0e10cSrcweir // -------------------------------------------------------------------------
733*cdf0e10cSrcweir 
734*cdf0e10cSrcweir void SAL_CALL OResultSet::updateShort( sal_Int32 columnIndex, sal_Int16 x ) throw(SQLException, RuntimeException)
735*cdf0e10cSrcweir {
736*cdf0e10cSrcweir 	updateValue(columnIndex,x);
737*cdf0e10cSrcweir }
738*cdf0e10cSrcweir // -------------------------------------------------------------------------
739*cdf0e10cSrcweir void SAL_CALL OResultSet::updateInt( sal_Int32 columnIndex, sal_Int32 x ) throw(SQLException, RuntimeException)
740*cdf0e10cSrcweir {
741*cdf0e10cSrcweir 	updateValue(columnIndex,x);
742*cdf0e10cSrcweir }
743*cdf0e10cSrcweir // -------------------------------------------------------------------------
744*cdf0e10cSrcweir void SAL_CALL OResultSet::updateLong( sal_Int32 columnIndex, sal_Int64 x ) throw(SQLException, RuntimeException)
745*cdf0e10cSrcweir {
746*cdf0e10cSrcweir 	updateValue(columnIndex,x);
747*cdf0e10cSrcweir }
748*cdf0e10cSrcweir // -----------------------------------------------------------------------
749*cdf0e10cSrcweir void SAL_CALL OResultSet::updateFloat( sal_Int32 columnIndex, float x ) throw(SQLException, RuntimeException)
750*cdf0e10cSrcweir {
751*cdf0e10cSrcweir 	updateValue(columnIndex,x);
752*cdf0e10cSrcweir }
753*cdf0e10cSrcweir // -------------------------------------------------------------------------
754*cdf0e10cSrcweir 
755*cdf0e10cSrcweir void SAL_CALL OResultSet::updateDouble( sal_Int32 columnIndex, double x ) throw(SQLException, RuntimeException)
756*cdf0e10cSrcweir {
757*cdf0e10cSrcweir 	updateValue(columnIndex,x);
758*cdf0e10cSrcweir }
759*cdf0e10cSrcweir // -------------------------------------------------------------------------
760*cdf0e10cSrcweir void SAL_CALL OResultSet::updateString( sal_Int32 columnIndex, const ::rtl::OUString& x ) throw(SQLException, RuntimeException)
761*cdf0e10cSrcweir {
762*cdf0e10cSrcweir 	updateValue(columnIndex,x);
763*cdf0e10cSrcweir }
764*cdf0e10cSrcweir // -------------------------------------------------------------------------
765*cdf0e10cSrcweir void SAL_CALL OResultSet::updateBytes( sal_Int32 columnIndex, const Sequence< sal_Int8 >& x ) throw(SQLException, RuntimeException)
766*cdf0e10cSrcweir {
767*cdf0e10cSrcweir 	updateValue(columnIndex,x);
768*cdf0e10cSrcweir }
769*cdf0e10cSrcweir // -------------------------------------------------------------------------
770*cdf0e10cSrcweir void SAL_CALL OResultSet::updateDate( sal_Int32 columnIndex, const ::com::sun::star::util::Date& x ) throw(SQLException, RuntimeException)
771*cdf0e10cSrcweir {
772*cdf0e10cSrcweir 	updateValue(columnIndex,x);
773*cdf0e10cSrcweir }
774*cdf0e10cSrcweir // -------------------------------------------------------------------------
775*cdf0e10cSrcweir 
776*cdf0e10cSrcweir void SAL_CALL OResultSet::updateTime( sal_Int32 columnIndex, const ::com::sun::star::util::Time& x ) throw(SQLException, RuntimeException)
777*cdf0e10cSrcweir {
778*cdf0e10cSrcweir 	updateValue(columnIndex,x);
779*cdf0e10cSrcweir }
780*cdf0e10cSrcweir // -------------------------------------------------------------------------
781*cdf0e10cSrcweir 
782*cdf0e10cSrcweir void SAL_CALL OResultSet::updateTimestamp( sal_Int32 columnIndex, const ::com::sun::star::util::DateTime& x ) throw(SQLException, RuntimeException)
783*cdf0e10cSrcweir {
784*cdf0e10cSrcweir 	updateValue(columnIndex,x);
785*cdf0e10cSrcweir }
786*cdf0e10cSrcweir // -------------------------------------------------------------------------
787*cdf0e10cSrcweir 
788*cdf0e10cSrcweir void SAL_CALL OResultSet::updateBinaryStream( sal_Int32 columnIndex, const Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(SQLException, RuntimeException)
789*cdf0e10cSrcweir {
790*cdf0e10cSrcweir     if(!x.is())
791*cdf0e10cSrcweir 		::dbtools::throwFunctionSequenceException(*this);
792*cdf0e10cSrcweir 
793*cdf0e10cSrcweir 	Sequence<sal_Int8> aSeq;
794*cdf0e10cSrcweir 	x->readBytes(aSeq,length);
795*cdf0e10cSrcweir 	updateBytes(columnIndex,aSeq);
796*cdf0e10cSrcweir }
797*cdf0e10cSrcweir // -------------------------------------------------------------------------
798*cdf0e10cSrcweir void SAL_CALL OResultSet::updateCharacterStream( sal_Int32 columnIndex, const Reference< ::com::sun::star::io::XInputStream >& x, sal_Int32 length ) throw(SQLException, RuntimeException)
799*cdf0e10cSrcweir {
800*cdf0e10cSrcweir     if(!x.is())
801*cdf0e10cSrcweir 		::dbtools::throwFunctionSequenceException(*this);
802*cdf0e10cSrcweir 
803*cdf0e10cSrcweir 	Sequence<sal_Int8> aSeq;
804*cdf0e10cSrcweir 	x->readBytes(aSeq,length);
805*cdf0e10cSrcweir 	updateBytes(columnIndex,aSeq);
806*cdf0e10cSrcweir }
807*cdf0e10cSrcweir // -------------------------------------------------------------------------
808*cdf0e10cSrcweir void SAL_CALL OResultSet::refreshRow(  ) throw(SQLException, RuntimeException)
809*cdf0e10cSrcweir {
810*cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
811*cdf0e10cSrcweir 	checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
812*cdf0e10cSrcweir 
813*cdf0e10cSrcweir 
814*cdf0e10cSrcweir 	m_pRecordSet->Resync(adAffectCurrent,adResyncAllValues);
815*cdf0e10cSrcweir }
816*cdf0e10cSrcweir // -------------------------------------------------------------------------
817*cdf0e10cSrcweir void SAL_CALL OResultSet::updateObject( sal_Int32 columnIndex, const Any& x ) throw(SQLException, RuntimeException)
818*cdf0e10cSrcweir {
819*cdf0e10cSrcweir 	if (!::dbtools::implUpdateObject(this, columnIndex, x))
820*cdf0e10cSrcweir 		throw SQLException();
821*cdf0e10cSrcweir }
822*cdf0e10cSrcweir // -------------------------------------------------------------------------
823*cdf0e10cSrcweir 
824*cdf0e10cSrcweir void SAL_CALL OResultSet::updateNumericObject( sal_Int32 columnIndex, const Any& x, sal_Int32 /*scale*/ ) throw(SQLException, RuntimeException)
825*cdf0e10cSrcweir {
826*cdf0e10cSrcweir 	if (!::dbtools::implUpdateObject(this, columnIndex, x))
827*cdf0e10cSrcweir 		throw SQLException();
828*cdf0e10cSrcweir }
829*cdf0e10cSrcweir //------------------------------------------------------------------------------
830*cdf0e10cSrcweir // XRowLocate
831*cdf0e10cSrcweir Any SAL_CALL OResultSet::getBookmark(  ) throw(SQLException, RuntimeException)
832*cdf0e10cSrcweir {
833*cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
834*cdf0e10cSrcweir 	checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
835*cdf0e10cSrcweir 
836*cdf0e10cSrcweir 	if(m_nRowPos < (sal_Int32)m_aBookmarks.size()) // this bookmark was already fetched
837*cdf0e10cSrcweir 		return makeAny(sal_Int32(m_nRowPos-1));
838*cdf0e10cSrcweir 
839*cdf0e10cSrcweir 	OLEVariant aVar;
840*cdf0e10cSrcweir 	m_pRecordSet->get_Bookmark(&aVar);
841*cdf0e10cSrcweir 	m_aBookmarks.push_back(aVar);
842*cdf0e10cSrcweir 	return makeAny((sal_Int32)(m_aBookmarks.size()-1));
843*cdf0e10cSrcweir 
844*cdf0e10cSrcweir }
845*cdf0e10cSrcweir //------------------------------------------------------------------------------
846*cdf0e10cSrcweir sal_Bool SAL_CALL OResultSet::moveToBookmark( const Any& bookmark ) throw(SQLException, RuntimeException)
847*cdf0e10cSrcweir {
848*cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
849*cdf0e10cSrcweir 	checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
850*cdf0e10cSrcweir 
851*cdf0e10cSrcweir 
852*cdf0e10cSrcweir 	sal_Int32 nPos;
853*cdf0e10cSrcweir 	bookmark >>= nPos;
854*cdf0e10cSrcweir 	OSL_ENSURE(nPos >= 0 && nPos < (sal_Int32)m_aBookmarks.size(),"Invalid Index for vector");
855*cdf0e10cSrcweir 	if(nPos < 0 || nPos >= (sal_Int32)m_aBookmarks.size())
856*cdf0e10cSrcweir 		::dbtools::throwFunctionSequenceException(*this);
857*cdf0e10cSrcweir 
858*cdf0e10cSrcweir 	return SUCCEEDED(m_pRecordSet->Move(0,m_aBookmarks[nPos]));
859*cdf0e10cSrcweir }
860*cdf0e10cSrcweir //------------------------------------------------------------------------------
861*cdf0e10cSrcweir sal_Bool SAL_CALL OResultSet::moveRelativeToBookmark( const Any& bookmark, sal_Int32 rows ) throw(SQLException, RuntimeException)
862*cdf0e10cSrcweir {
863*cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
864*cdf0e10cSrcweir 	checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
865*cdf0e10cSrcweir 
866*cdf0e10cSrcweir 
867*cdf0e10cSrcweir 	sal_Int32 nPos;
868*cdf0e10cSrcweir 	bookmark >>= nPos;
869*cdf0e10cSrcweir 	nPos += rows;
870*cdf0e10cSrcweir 	OSL_ENSURE(nPos >= 0 && nPos < (sal_Int32)m_aBookmarks.size(),"Invalid Index for vector");
871*cdf0e10cSrcweir 	if(nPos < 0 || nPos >= (sal_Int32)m_aBookmarks.size())
872*cdf0e10cSrcweir 		::dbtools::throwFunctionSequenceException(*this);
873*cdf0e10cSrcweir 	return SUCCEEDED(m_pRecordSet->Move(rows,m_aBookmarks[nPos]));
874*cdf0e10cSrcweir }
875*cdf0e10cSrcweir //------------------------------------------------------------------------------
876*cdf0e10cSrcweir sal_Int32 SAL_CALL OResultSet::compareBookmarks( const Any& first, const Any& second ) throw(SQLException, RuntimeException)
877*cdf0e10cSrcweir {
878*cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
879*cdf0e10cSrcweir 	checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
880*cdf0e10cSrcweir 
881*cdf0e10cSrcweir 	sal_Int32 nPos1;
882*cdf0e10cSrcweir 	first >>= nPos1;
883*cdf0e10cSrcweir 	sal_Int32 nPos2;
884*cdf0e10cSrcweir 	second >>= nPos2;
885*cdf0e10cSrcweir 	if(nPos1 == nPos2)	// they should be equal
886*cdf0e10cSrcweir 		return sal_True;
887*cdf0e10cSrcweir 
888*cdf0e10cSrcweir 	OSL_ENSURE((nPos1 >= 0 && nPos1 < (sal_Int32)m_aBookmarks.size()) || (nPos1 >= 0 && nPos2 < (sal_Int32)m_aBookmarks.size()),"Invalid Index for vector");
889*cdf0e10cSrcweir 
890*cdf0e10cSrcweir 	CompareEnum eNum;
891*cdf0e10cSrcweir 	m_pRecordSet->CompareBookmarks(m_aBookmarks[nPos1],m_aBookmarks[nPos2],&eNum);
892*cdf0e10cSrcweir 	return ((sal_Int32)eNum) +1;
893*cdf0e10cSrcweir }
894*cdf0e10cSrcweir //------------------------------------------------------------------------------
895*cdf0e10cSrcweir sal_Bool SAL_CALL OResultSet::hasOrderedBookmarks(  ) throw(SQLException, RuntimeException)
896*cdf0e10cSrcweir {
897*cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
898*cdf0e10cSrcweir 	checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
899*cdf0e10cSrcweir 
900*cdf0e10cSrcweir 
901*cdf0e10cSrcweir 	ADOProperties* pProps = NULL;
902*cdf0e10cSrcweir 	m_pRecordSet->get_Properties(&pProps);
903*cdf0e10cSrcweir 	WpADOProperties aProps;
904*cdf0e10cSrcweir 	aProps.setWithOutAddRef(pProps);
905*cdf0e10cSrcweir 	ADOS::ThrowException(*((OConnection*)m_pStmt->getConnection().get())->getConnection(),*this);
906*cdf0e10cSrcweir 	OSL_ENSURE(aProps.IsValid(),"There are no properties at the connection");
907*cdf0e10cSrcweir 
908*cdf0e10cSrcweir 	WpADOProperty aProp(aProps.GetItem(::rtl::OUString::createFromAscii("Bookmarks Ordered")));
909*cdf0e10cSrcweir 	OLEVariant aVar;
910*cdf0e10cSrcweir 	if(aProp.IsValid())
911*cdf0e10cSrcweir 		aVar = aProp.GetValue();
912*cdf0e10cSrcweir 	else
913*cdf0e10cSrcweir 		ADOS::ThrowException(*((OConnection*)m_pStmt->getConnection().get())->getConnection(),*this);
914*cdf0e10cSrcweir 
915*cdf0e10cSrcweir 	sal_Bool bValue(sal_False);
916*cdf0e10cSrcweir 	if(!aVar.isNull() && !aVar.isEmpty())
917*cdf0e10cSrcweir 		bValue = aVar;
918*cdf0e10cSrcweir 	return bValue;
919*cdf0e10cSrcweir }
920*cdf0e10cSrcweir //------------------------------------------------------------------------------
921*cdf0e10cSrcweir sal_Int32 SAL_CALL OResultSet::hashBookmark( const Any& bookmark ) throw(SQLException, RuntimeException)
922*cdf0e10cSrcweir {
923*cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
924*cdf0e10cSrcweir 	checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
925*cdf0e10cSrcweir 
926*cdf0e10cSrcweir 
927*cdf0e10cSrcweir 	sal_Int32 nPos;
928*cdf0e10cSrcweir 	bookmark >>= nPos;
929*cdf0e10cSrcweir 	return nPos;
930*cdf0e10cSrcweir }
931*cdf0e10cSrcweir //------------------------------------------------------------------------------
932*cdf0e10cSrcweir // XDeleteRows
933*cdf0e10cSrcweir Sequence< sal_Int32 > SAL_CALL OResultSet::deleteRows( const Sequence< Any >& rows ) throw(SQLException, RuntimeException)
934*cdf0e10cSrcweir {
935*cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
936*cdf0e10cSrcweir 	checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
937*cdf0e10cSrcweir 
938*cdf0e10cSrcweir 
939*cdf0e10cSrcweir 	OLEVariant aVar;
940*cdf0e10cSrcweir 	sal_Int32 nPos;
941*cdf0e10cSrcweir 
942*cdf0e10cSrcweir 	// Create SafeArray Bounds and initialize the array
943*cdf0e10cSrcweir 	SAFEARRAYBOUND rgsabound[1];
944*cdf0e10cSrcweir 	rgsabound[0].lLbound   = 0;
945*cdf0e10cSrcweir 	rgsabound[0].cElements = rows.getLength();
946*cdf0e10cSrcweir 	SAFEARRAY *psa         = SafeArrayCreate( VT_VARIANT, 1, rgsabound );
947*cdf0e10cSrcweir 
948*cdf0e10cSrcweir 	const Any* pBegin = rows.getConstArray();
949*cdf0e10cSrcweir 	const Any* pEnd = pBegin + rows.getLength();
950*cdf0e10cSrcweir 	for(sal_Int32 i=0;pBegin != pEnd ;++pBegin,++i)
951*cdf0e10cSrcweir 	{
952*cdf0e10cSrcweir 		*pBegin >>= nPos;
953*cdf0e10cSrcweir 		SafeArrayPutElement(psa,&i,&m_aBookmarks[nPos]);
954*cdf0e10cSrcweir 	}
955*cdf0e10cSrcweir 
956*cdf0e10cSrcweir 	// Initialize and fill the SafeArray
957*cdf0e10cSrcweir 	OLEVariant vsa;
958*cdf0e10cSrcweir 	vsa.setArray(psa,VT_VARIANT);
959*cdf0e10cSrcweir 
960*cdf0e10cSrcweir 	m_pRecordSet->put_Filter(vsa);
961*cdf0e10cSrcweir 	m_pRecordSet->Delete(adAffectGroup);
962*cdf0e10cSrcweir 	m_pRecordSet->UpdateBatch(adAffectGroup);
963*cdf0e10cSrcweir 
964*cdf0e10cSrcweir 	Sequence< sal_Int32 > aSeq(rows.getLength());
965*cdf0e10cSrcweir 	if(first())
966*cdf0e10cSrcweir 	{
967*cdf0e10cSrcweir 		sal_Int32* pSeq = aSeq.getArray();
968*cdf0e10cSrcweir 		sal_Int32 i=0;
969*cdf0e10cSrcweir 		do
970*cdf0e10cSrcweir 		{
971*cdf0e10cSrcweir 			OSL_ENSURE(i<aSeq.getLength(),"Index greater than length of sequence");
972*cdf0e10cSrcweir 			m_pRecordSet->get_Status(&pSeq[i]);
973*cdf0e10cSrcweir 			if(pSeq[i++] == adRecDeleted)
974*cdf0e10cSrcweir 				--m_nRowPos;
975*cdf0e10cSrcweir 		}
976*cdf0e10cSrcweir 		while(next());
977*cdf0e10cSrcweir 	}
978*cdf0e10cSrcweir 	return aSeq;
979*cdf0e10cSrcweir }
980*cdf0e10cSrcweir //------------------------------------------------------------------------------
981*cdf0e10cSrcweir sal_Int32 OResultSet::getResultSetConcurrency() const
982*cdf0e10cSrcweir 	throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
983*cdf0e10cSrcweir {
984*cdf0e10cSrcweir 	sal_Int32 nValue=ResultSetConcurrency::READ_ONLY;
985*cdf0e10cSrcweir 	LockTypeEnum eRet;
986*cdf0e10cSrcweir 	if(!SUCCEEDED(m_pRecordSet->get_LockType(&eRet)))
987*cdf0e10cSrcweir 	{
988*cdf0e10cSrcweir 		switch(eRet)
989*cdf0e10cSrcweir 		{
990*cdf0e10cSrcweir 			case adLockReadOnly:
991*cdf0e10cSrcweir 				nValue = ResultSetConcurrency::READ_ONLY;
992*cdf0e10cSrcweir 				break;
993*cdf0e10cSrcweir 			default:
994*cdf0e10cSrcweir 				nValue = ResultSetConcurrency::UPDATABLE;
995*cdf0e10cSrcweir 				break;
996*cdf0e10cSrcweir 		}
997*cdf0e10cSrcweir 	}
998*cdf0e10cSrcweir 	return nValue;
999*cdf0e10cSrcweir }
1000*cdf0e10cSrcweir //------------------------------------------------------------------------------
1001*cdf0e10cSrcweir sal_Int32 OResultSet::getResultSetType() const
1002*cdf0e10cSrcweir 	throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
1003*cdf0e10cSrcweir {
1004*cdf0e10cSrcweir 	sal_Int32 nValue=0;
1005*cdf0e10cSrcweir 	CursorTypeEnum eRet;
1006*cdf0e10cSrcweir 	if(!SUCCEEDED(m_pRecordSet->get_CursorType(&eRet)))
1007*cdf0e10cSrcweir 	{
1008*cdf0e10cSrcweir 		switch(eRet)
1009*cdf0e10cSrcweir 		{
1010*cdf0e10cSrcweir 			case adOpenUnspecified:
1011*cdf0e10cSrcweir 			case adOpenForwardOnly:
1012*cdf0e10cSrcweir 				nValue = ResultSetType::FORWARD_ONLY;
1013*cdf0e10cSrcweir 				break;
1014*cdf0e10cSrcweir 			case adOpenStatic:
1015*cdf0e10cSrcweir 			case adOpenKeyset:
1016*cdf0e10cSrcweir 				nValue = ResultSetType::SCROLL_INSENSITIVE;
1017*cdf0e10cSrcweir 				break;
1018*cdf0e10cSrcweir 			case adOpenDynamic:
1019*cdf0e10cSrcweir 				nValue = ResultSetType::SCROLL_SENSITIVE;
1020*cdf0e10cSrcweir 				break;
1021*cdf0e10cSrcweir 		}
1022*cdf0e10cSrcweir 	}
1023*cdf0e10cSrcweir 	return nValue;
1024*cdf0e10cSrcweir }
1025*cdf0e10cSrcweir //------------------------------------------------------------------------------
1026*cdf0e10cSrcweir sal_Int32 OResultSet::getFetchDirection() const
1027*cdf0e10cSrcweir 	throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
1028*cdf0e10cSrcweir {
1029*cdf0e10cSrcweir 	return FetchDirection::FORWARD;
1030*cdf0e10cSrcweir }
1031*cdf0e10cSrcweir //------------------------------------------------------------------------------
1032*cdf0e10cSrcweir sal_Int32 OResultSet::getFetchSize() const
1033*cdf0e10cSrcweir 	throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
1034*cdf0e10cSrcweir {
1035*cdf0e10cSrcweir 	sal_Int32 nValue=-1;
1036*cdf0e10cSrcweir 	m_pRecordSet->get_CacheSize(&nValue);
1037*cdf0e10cSrcweir 	return nValue;
1038*cdf0e10cSrcweir }
1039*cdf0e10cSrcweir //------------------------------------------------------------------------------
1040*cdf0e10cSrcweir ::rtl::OUString OResultSet::getCursorName() const
1041*cdf0e10cSrcweir 	throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
1042*cdf0e10cSrcweir {
1043*cdf0e10cSrcweir 	return ::rtl::OUString();
1044*cdf0e10cSrcweir }
1045*cdf0e10cSrcweir 
1046*cdf0e10cSrcweir //------------------------------------------------------------------------------
1047*cdf0e10cSrcweir void OResultSet::setFetchDirection(sal_Int32 /*_par0*/)
1048*cdf0e10cSrcweir 	throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
1049*cdf0e10cSrcweir {
1050*cdf0e10cSrcweir     ::dbtools::throwFeatureNotImplementedException( "ResultSet::FetchDirection", *this );
1051*cdf0e10cSrcweir }
1052*cdf0e10cSrcweir //------------------------------------------------------------------------------
1053*cdf0e10cSrcweir void OResultSet::setFetchSize(sal_Int32 _par0)
1054*cdf0e10cSrcweir 	throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
1055*cdf0e10cSrcweir {
1056*cdf0e10cSrcweir 	m_pRecordSet->put_CacheSize(_par0);
1057*cdf0e10cSrcweir }
1058*cdf0e10cSrcweir // -------------------------------------------------------------------------
1059*cdf0e10cSrcweir ::cppu::IPropertyArrayHelper* OResultSet::createArrayHelper( ) const
1060*cdf0e10cSrcweir {
1061*cdf0e10cSrcweir 	Sequence< com::sun::star::beans::Property > aProps(5);
1062*cdf0e10cSrcweir 	com::sun::star::beans::Property* pProperties = aProps.getArray();
1063*cdf0e10cSrcweir 	sal_Int32 nPos = 0;
1064*cdf0e10cSrcweir 
1065*cdf0e10cSrcweir 	//	DECL_PROP1IMPL(CURSORNAME,			::rtl::OUString) PropertyAttribute::READONLY);
1066*cdf0e10cSrcweir 	DECL_PROP0(FETCHDIRECTION,			sal_Int32);
1067*cdf0e10cSrcweir 	DECL_PROP0(FETCHSIZE,				sal_Int32);
1068*cdf0e10cSrcweir 	DECL_BOOL_PROP1IMPL(ISBOOKMARKABLE) PropertyAttribute::READONLY);
1069*cdf0e10cSrcweir 	DECL_PROP1IMPL(RESULTSETCONCURRENCY,sal_Int32) PropertyAttribute::READONLY);
1070*cdf0e10cSrcweir 	DECL_PROP1IMPL(RESULTSETTYPE,		sal_Int32) PropertyAttribute::READONLY);
1071*cdf0e10cSrcweir 
1072*cdf0e10cSrcweir 	return new ::cppu::OPropertyArrayHelper(aProps);
1073*cdf0e10cSrcweir }
1074*cdf0e10cSrcweir // -------------------------------------------------------------------------
1075*cdf0e10cSrcweir ::cppu::IPropertyArrayHelper & OResultSet::getInfoHelper()
1076*cdf0e10cSrcweir {
1077*cdf0e10cSrcweir 	return *const_cast<OResultSet*>(this)->getArrayHelper();
1078*cdf0e10cSrcweir }
1079*cdf0e10cSrcweir // -------------------------------------------------------------------------
1080*cdf0e10cSrcweir sal_Bool OResultSet::convertFastPropertyValue(
1081*cdf0e10cSrcweir 							Any & rConvertedValue,
1082*cdf0e10cSrcweir 							Any & rOldValue,
1083*cdf0e10cSrcweir 							sal_Int32 nHandle,
1084*cdf0e10cSrcweir 							const Any& rValue )
1085*cdf0e10cSrcweir 								throw (::com::sun::star::lang::IllegalArgumentException)
1086*cdf0e10cSrcweir {
1087*cdf0e10cSrcweir 	switch(nHandle)
1088*cdf0e10cSrcweir 	{
1089*cdf0e10cSrcweir 		case PROPERTY_ID_ISBOOKMARKABLE:
1090*cdf0e10cSrcweir 		case PROPERTY_ID_CURSORNAME:
1091*cdf0e10cSrcweir 		case PROPERTY_ID_RESULTSETCONCURRENCY:
1092*cdf0e10cSrcweir 		case PROPERTY_ID_RESULTSETTYPE:
1093*cdf0e10cSrcweir 			throw ::com::sun::star::lang::IllegalArgumentException();
1094*cdf0e10cSrcweir 			break;
1095*cdf0e10cSrcweir 		case PROPERTY_ID_FETCHDIRECTION:
1096*cdf0e10cSrcweir 			return ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, getFetchDirection());
1097*cdf0e10cSrcweir 		case PROPERTY_ID_FETCHSIZE:
1098*cdf0e10cSrcweir 			return ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, getFetchSize());
1099*cdf0e10cSrcweir 		default:
1100*cdf0e10cSrcweir 			;
1101*cdf0e10cSrcweir 	}
1102*cdf0e10cSrcweir 	return sal_False;
1103*cdf0e10cSrcweir }
1104*cdf0e10cSrcweir // -------------------------------------------------------------------------
1105*cdf0e10cSrcweir void OResultSet::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& rValue)throw (Exception)
1106*cdf0e10cSrcweir {
1107*cdf0e10cSrcweir 	switch(nHandle)
1108*cdf0e10cSrcweir 	{
1109*cdf0e10cSrcweir 		case PROPERTY_ID_ISBOOKMARKABLE:
1110*cdf0e10cSrcweir 		case PROPERTY_ID_CURSORNAME:
1111*cdf0e10cSrcweir 		case PROPERTY_ID_RESULTSETCONCURRENCY:
1112*cdf0e10cSrcweir 		case PROPERTY_ID_RESULTSETTYPE:
1113*cdf0e10cSrcweir 			throw Exception();
1114*cdf0e10cSrcweir 			break;
1115*cdf0e10cSrcweir 		case PROPERTY_ID_FETCHDIRECTION:
1116*cdf0e10cSrcweir 			setFetchDirection(getINT32(rValue));
1117*cdf0e10cSrcweir 			break;
1118*cdf0e10cSrcweir 		case PROPERTY_ID_FETCHSIZE:
1119*cdf0e10cSrcweir 			setFetchSize(getINT32(rValue));
1120*cdf0e10cSrcweir 			break;
1121*cdf0e10cSrcweir 		default:
1122*cdf0e10cSrcweir 			;
1123*cdf0e10cSrcweir 	}
1124*cdf0e10cSrcweir }
1125*cdf0e10cSrcweir // -------------------------------------------------------------------------
1126*cdf0e10cSrcweir void OResultSet::getFastPropertyValue(Any& rValue,sal_Int32 nHandle) const
1127*cdf0e10cSrcweir {
1128*cdf0e10cSrcweir 	switch(nHandle)
1129*cdf0e10cSrcweir 	{
1130*cdf0e10cSrcweir 		case PROPERTY_ID_ISBOOKMARKABLE:
1131*cdf0e10cSrcweir 			{
1132*cdf0e10cSrcweir 				VARIANT_BOOL bBool;
1133*cdf0e10cSrcweir 				m_pRecordSet->Supports(adBookmark,&bBool);
1134*cdf0e10cSrcweir 				sal_Bool bRet = bBool == VARIANT_TRUE;
1135*cdf0e10cSrcweir 				rValue.setValue(&bRet, ::getCppuBooleanType() );
1136*cdf0e10cSrcweir 			}
1137*cdf0e10cSrcweir 			break;
1138*cdf0e10cSrcweir 		case PROPERTY_ID_CURSORNAME:
1139*cdf0e10cSrcweir 			rValue <<= getCursorName();
1140*cdf0e10cSrcweir 			break;
1141*cdf0e10cSrcweir 		case PROPERTY_ID_RESULTSETCONCURRENCY:
1142*cdf0e10cSrcweir 			rValue <<= getResultSetConcurrency();
1143*cdf0e10cSrcweir 			break;
1144*cdf0e10cSrcweir 		case PROPERTY_ID_RESULTSETTYPE:
1145*cdf0e10cSrcweir 			rValue <<= getResultSetType();
1146*cdf0e10cSrcweir 			break;
1147*cdf0e10cSrcweir 		case PROPERTY_ID_FETCHDIRECTION:
1148*cdf0e10cSrcweir 			rValue <<= getFetchDirection();
1149*cdf0e10cSrcweir 			break;
1150*cdf0e10cSrcweir 		case PROPERTY_ID_FETCHSIZE:
1151*cdf0e10cSrcweir 			rValue <<= getFetchSize();
1152*cdf0e10cSrcweir 			break;
1153*cdf0e10cSrcweir 	}
1154*cdf0e10cSrcweir }
1155*cdf0e10cSrcweir // -----------------------------------------------------------------------------
1156*cdf0e10cSrcweir void SAL_CALL OResultSet::acquire() throw()
1157*cdf0e10cSrcweir {
1158*cdf0e10cSrcweir 	OResultSet_BASE::acquire();
1159*cdf0e10cSrcweir }
1160*cdf0e10cSrcweir // -----------------------------------------------------------------------------
1161*cdf0e10cSrcweir void SAL_CALL OResultSet::release() throw()
1162*cdf0e10cSrcweir {
1163*cdf0e10cSrcweir 	OResultSet_BASE::release();
1164*cdf0e10cSrcweir }
1165*cdf0e10cSrcweir // -----------------------------------------------------------------------------
1166*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL OResultSet::getPropertySetInfo(  ) throw(::com::sun::star::uno::RuntimeException)
1167*cdf0e10cSrcweir {
1168*cdf0e10cSrcweir 	return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper());
1169*cdf0e10cSrcweir }
1170*cdf0e10cSrcweir // -----------------------------------------------------------------------------
1171*cdf0e10cSrcweir 
1172*cdf0e10cSrcweir 
1173*cdf0e10cSrcweir 
1174