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