merge the formfield patch from ooo-build
[ooovba.git] / connectivity / source / drivers / ado / ADatabaseMetaDataResultSet.cxx
blob783707b8e0ce80837c579a4c57a65445c544b83a
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: ADatabaseMetaDataResultSet.cxx,v $
10 * $Revision: 1.24 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_connectivity.hxx"
33 #include <comphelper/sequence.hxx>
34 #include "ado/ADatabaseMetaDataResultSet.hxx"
35 #include "ado/ADatabaseMetaDataResultSetMetaData.hxx"
36 #include <com/sun/star/sdbc/DataType.hpp>
37 #include <com/sun/star/sdbc/ColumnValue.hpp>
38 #include <com/sun/star/sdbc/KeyRule.hpp>
39 #include <com/sun/star/sdbc/ProcedureResult.hpp>
40 #include <com/sun/star/sdbc/IndexType.hpp>
41 #include <comphelper/property.hxx>
42 #include <com/sun/star/lang/DisposedException.hpp>
43 #include <com/sun/star/sdbc/ResultSetConcurrency.hpp>
44 #include <com/sun/star/sdbc/ResultSetType.hpp>
45 #include <com/sun/star/sdbc/FetchDirection.hpp>
46 #include <cppuhelper/typeprovider.hxx>
47 #include <comphelper/seqstream.hxx>
48 #include "connectivity/dbexception.hxx"
51 #include <oledb.h>
53 using namespace dbtools;
54 using namespace connectivity::ado;
55 using namespace cppu;
56 using namespace ::comphelper;
57 //------------------------------------------------------------------------------
58 using namespace ::com::sun::star::lang;
59 using namespace com::sun::star::uno;
60 using namespace com::sun::star::lang;
61 using namespace com::sun::star::beans;
62 using namespace com::sun::star::sdbc;
64 // -------------------------------------------------------------------------
65 ODatabaseMetaDataResultSet::ODatabaseMetaDataResultSet(ADORecordset* _pRecordSet)
66 :ODatabaseMetaDataResultSet_BASE(m_aMutex)
67 ,OPropertySetHelper(ODatabaseMetaDataResultSet_BASE::rBHelper)
68 ,m_aStatement(NULL)
69 ,m_xMetaData(NULL)
70 ,m_pRecordSet(_pRecordSet)
71 ,m_bEOF(sal_False)
73 osl_incrementInterlockedCount( &m_refCount );
74 m_aColMapping.push_back(-1);
75 if(_pRecordSet)
77 m_pRecordSet->AddRef();
78 VARIANT_BOOL bIsAtBOF;
79 m_pRecordSet->get_BOF(&bIsAtBOF);
80 m_bOnFirstAfterOpen = bIsAtBOF != VARIANT_TRUE;
82 else
83 m_bOnFirstAfterOpen = sal_False;
84 osl_decrementInterlockedCount( &m_refCount );
85 // allocBuffer();
88 // -------------------------------------------------------------------------
89 ODatabaseMetaDataResultSet::~ODatabaseMetaDataResultSet()
91 if(m_pRecordSet)
92 m_pRecordSet->Release();
94 // -------------------------------------------------------------------------
95 void ODatabaseMetaDataResultSet::disposing(void)
97 OPropertySetHelper::disposing();
99 ::osl::MutexGuard aGuard(m_aMutex);
100 if(m_pRecordSet)
101 m_pRecordSet->Close();
102 m_aStatement = NULL;
103 m_xMetaData.clear();
105 // -------------------------------------------------------------------------
106 Any SAL_CALL ODatabaseMetaDataResultSet::queryInterface( const Type & rType ) throw(RuntimeException)
108 Any aRet = OPropertySetHelper::queryInterface(rType);
109 return aRet.hasValue() ? aRet : ODatabaseMetaDataResultSet_BASE::queryInterface(rType);
111 // -------------------------------------------------------------------------
112 ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL ODatabaseMetaDataResultSet::getTypes( ) throw(::com::sun::star::uno::RuntimeException)
114 ::cppu::OTypeCollection aTypes( ::getCppuType( (const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XMultiPropertySet > *)0 ),
115 ::getCppuType( (const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XFastPropertySet > *)0 ),
116 ::getCppuType( (const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > *)0 ));
118 return ::comphelper::concatSequences(aTypes.getTypes(),ODatabaseMetaDataResultSet_BASE::getTypes());
120 // -----------------------------------------------------------------------------
121 void ODatabaseMetaDataResultSet::checkRecordSet() throw(SQLException)
123 if(!m_pRecordSet)
124 throwFunctionSequenceException(*this);
126 // -------------------------------------------------------------------------
128 sal_Int32 SAL_CALL ODatabaseMetaDataResultSet::findColumn( const ::rtl::OUString& columnName ) throw(SQLException, RuntimeException)
130 ::osl::MutexGuard aGuard( m_aMutex );
131 checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed );
134 Reference< XResultSetMetaData > xMeta = getMetaData();
135 sal_Int32 nLen = xMeta->getColumnCount();
136 sal_Int32 i = 1;
137 for(;i<=nLen;++i)
138 if(xMeta->isCaseSensitive(i) ? columnName == xMeta->getColumnName(i) :
139 columnName.equalsIgnoreAsciiCase(xMeta->getColumnName(i)))
140 break;
141 return i;
143 #define BLOCK_SIZE 256
144 // -------------------------------------------------------------------------
145 Reference< ::com::sun::star::io::XInputStream > SAL_CALL ODatabaseMetaDataResultSet::getBinaryStream( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
147 ::osl::MutexGuard aGuard( m_aMutex );
148 checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
150 checkRecordSet();
153 columnIndex = mapColumn(columnIndex);
154 WpADOField aField = ADOS::getField(m_pRecordSet,columnIndex);
155 if((aField.GetAttributes() & adFldLong) == adFldLong)
157 //Copy the data only upto the Actual Size of Field.
158 sal_Int32 nSize = aField.GetActualSize();
159 Sequence<sal_Int8> aData(nSize);
160 long index = 0;
161 while(index < nSize)
163 m_aValue = aField.GetChunk(BLOCK_SIZE);
164 if(m_aValue.isNull())
165 break;
166 UCHAR chData;
167 for(long index2 = 0;index2 < BLOCK_SIZE;++index2)
169 HRESULT hr = ::SafeArrayGetElement(m_aValue.parray,&index2,&chData);
170 if(SUCCEEDED(hr))
172 //Take BYTE by BYTE and advance Memory Location
173 aData.getArray()[index++] = chData;
175 else
176 break;
179 return index ? Reference< ::com::sun::star::io::XInputStream >(new SequenceInputStream(aData)) : Reference< ::com::sun::star::io::XInputStream >();
181 // else we ask for a bytesequence
182 aField.get_Value(m_aValue);
183 if(m_aValue.isNull())
184 return NULL;
185 return new SequenceInputStream(m_aValue);
187 // -------------------------------------------------------------------------
188 Reference< ::com::sun::star::io::XInputStream > SAL_CALL ODatabaseMetaDataResultSet::getCharacterStream( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
190 ::dbtools::throwFeatureNotImplementedException( "XRow::getCharacterStream", *this );
191 return NULL;
194 // -------------------------------------------------------------------------
195 sal_Bool SAL_CALL ODatabaseMetaDataResultSet::getBoolean( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
197 ::osl::MutexGuard aGuard( m_aMutex );
199 if ( !m_aValueRange.empty() && columnIndex == 11 && (m_aValueRangeIter = m_aValueRange.find(columnIndex)) != m_aValueRange.end() )
201 getValue(2);
202 if ( static_cast<sal_Int16>(m_aValue) != adCurrency )
203 return sal_False;
205 return getValue(columnIndex);
207 // -------------------------------------------------------------------------
209 sal_Int8 SAL_CALL ODatabaseMetaDataResultSet::getByte( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
211 ::osl::MutexGuard aGuard( m_aMutex );
213 getValue(columnIndex);
215 columnIndex = mapColumn(columnIndex);
217 if(m_aValue.isNull())
218 return 0;
219 if ( !m_aValueRange.empty() && (m_aValueRangeIter = m_aValueRange.find(columnIndex)) != m_aValueRange.end())
220 return (sal_Int8)(*m_aValueRangeIter).second[(sal_Int32)m_aValue];
221 else if(m_aStrValueRange.size() && (m_aStrValueRangeIter = m_aStrValueRange.find(columnIndex)) != m_aStrValueRange.end())
222 return (sal_Int8)(*m_aStrValueRangeIter).second[m_aValue];
224 return m_aValue;
226 // -------------------------------------------------------------------------
228 Sequence< sal_Int8 > SAL_CALL ODatabaseMetaDataResultSet::getBytes( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
230 return getValue(columnIndex);
232 // -------------------------------------------------------------------------
234 ::com::sun::star::util::Date SAL_CALL ODatabaseMetaDataResultSet::getDate( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
236 return getValue(columnIndex);
238 // -------------------------------------------------------------------------
240 double SAL_CALL ODatabaseMetaDataResultSet::getDouble( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
242 return getValue(columnIndex);
244 // -------------------------------------------------------------------------
246 float SAL_CALL ODatabaseMetaDataResultSet::getFloat( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
248 return getValue(columnIndex);
250 // -------------------------------------------------------------------------
252 sal_Int32 SAL_CALL ODatabaseMetaDataResultSet::getInt( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
254 ::osl::MutexGuard aGuard( m_aMutex );
257 getValue(columnIndex);
259 columnIndex = mapColumn(columnIndex);
260 if(m_aValue.isNull())
261 return 0;
263 if(m_aValueRange.size() && (m_aValueRangeIter = m_aValueRange.find(columnIndex)) != m_aValueRange.end())
264 return (*m_aValueRangeIter).second[(sal_Int32)m_aValue];
265 else if(m_aStrValueRange.size() && (m_aStrValueRangeIter = m_aStrValueRange.find(columnIndex)) != m_aStrValueRange.end())
266 return (*m_aStrValueRangeIter).second[m_aValue];
268 return m_aValue;
270 // -------------------------------------------------------------------------
272 sal_Int32 SAL_CALL ODatabaseMetaDataResultSet::getRow( ) throw(SQLException, RuntimeException)
274 ::dbtools::throwFeatureNotImplementedException( "XResultSet::getRow", *this );
275 return 0;
277 // -------------------------------------------------------------------------
279 sal_Int64 SAL_CALL ODatabaseMetaDataResultSet::getLong( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
281 ::dbtools::throwFeatureNotImplementedException( "XRow::getLong", *this );
282 return sal_Int64(0);
284 // -------------------------------------------------------------------------
286 Reference< XResultSetMetaData > SAL_CALL ODatabaseMetaDataResultSet::getMetaData( ) throw(SQLException, RuntimeException)
288 ::osl::MutexGuard aGuard( m_aMutex );
289 checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
291 checkRecordSet();
294 if(!m_xMetaData.is())
295 m_xMetaData = new ODatabaseMetaDataResultSetMetaData(m_pRecordSet,this);
297 return m_xMetaData;
299 // -------------------------------------------------------------------------
300 Reference< XArray > SAL_CALL ODatabaseMetaDataResultSet::getArray( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
302 ::dbtools::throwFeatureNotImplementedException( "XRow::getRow", *this );
303 return NULL;
306 // -------------------------------------------------------------------------
308 Reference< XClob > SAL_CALL ODatabaseMetaDataResultSet::getClob( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
310 ::dbtools::throwFeatureNotImplementedException( "XRow::getRow", *this );
311 return NULL;
313 // -------------------------------------------------------------------------
314 Reference< XBlob > SAL_CALL ODatabaseMetaDataResultSet::getBlob( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
316 ::dbtools::throwFeatureNotImplementedException( "XRow::getRow", *this );
317 return NULL;
319 // -------------------------------------------------------------------------
321 Reference< XRef > SAL_CALL ODatabaseMetaDataResultSet::getRef( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException)
323 ::dbtools::throwFeatureNotImplementedException( "XRow::getRow", *this );
324 return NULL;
326 // -------------------------------------------------------------------------
328 Any SAL_CALL ODatabaseMetaDataResultSet::getObject( sal_Int32 columnIndex, const Reference< ::com::sun::star::container::XNameAccess >& /*typeMap*/ ) throw(SQLException, RuntimeException)
330 ::osl::MutexGuard aGuard( m_aMutex );
331 checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
333 checkRecordSet();
336 columnIndex = mapColumn(columnIndex);
337 return Any();
339 // -------------------------------------------------------------------------
341 sal_Int16 SAL_CALL ODatabaseMetaDataResultSet::getShort( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
343 ::osl::MutexGuard aGuard( m_aMutex );
345 getValue(columnIndex);
347 columnIndex = mapColumn(columnIndex);
348 if(m_aValue.isNull())
349 return 0;
351 if(m_aValueRange.size() && (m_aValueRangeIter = m_aValueRange.find(columnIndex)) != m_aValueRange.end())
352 return (sal_Int16)(*m_aValueRangeIter).second[(sal_Int32)m_aValue];
353 else if(m_aStrValueRange.size() && (m_aStrValueRangeIter = m_aStrValueRange.find(columnIndex)) != m_aStrValueRange.end())
354 return (sal_Int16)(*m_aStrValueRangeIter).second[m_aValue];
356 return m_aValue;
358 // -------------------------------------------------------------------------
360 ::rtl::OUString SAL_CALL ODatabaseMetaDataResultSet::getString( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
362 ::osl::MutexGuard aGuard( m_aMutex );
364 getValue(columnIndex);
367 columnIndex = mapColumn(columnIndex);
368 if(m_aValue.isNull())
369 return ::rtl::OUString();
370 if(m_aIntValueRange.size() && (m_aIntValueRangeIter = m_aIntValueRange.find(columnIndex)) != m_aIntValueRange.end())
371 return (*m_aIntValueRangeIter).second[m_aValue];
373 return m_aValue;
376 // -------------------------------------------------------------------------
379 ::com::sun::star::util::Time SAL_CALL ODatabaseMetaDataResultSet::getTime( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
381 return getValue(columnIndex);
383 // -------------------------------------------------------------------------
386 ::com::sun::star::util::DateTime SAL_CALL ODatabaseMetaDataResultSet::getTimestamp( sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
388 return getValue(columnIndex);
390 // -------------------------------------------------------------------------
392 sal_Bool SAL_CALL ODatabaseMetaDataResultSet::isAfterLast( ) throw(SQLException, RuntimeException)
394 ::osl::MutexGuard aGuard( m_aMutex );
395 checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
397 checkRecordSet();
400 VARIANT_BOOL bIsAtEOF;
401 m_pRecordSet->get_EOF(&bIsAtEOF);
402 return bIsAtEOF == VARIANT_TRUE;
404 // -------------------------------------------------------------------------
405 sal_Bool SAL_CALL ODatabaseMetaDataResultSet::isFirst( ) throw(SQLException, RuntimeException)
407 ::osl::MutexGuard aGuard( m_aMutex );
408 checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
410 checkRecordSet();
413 return m_nRowPos == 1;
415 // -------------------------------------------------------------------------
416 sal_Bool SAL_CALL ODatabaseMetaDataResultSet::isLast( ) throw(SQLException, RuntimeException)
418 ::osl::MutexGuard aGuard( m_aMutex );
419 checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
421 checkRecordSet();
424 return sal_True;
426 // -------------------------------------------------------------------------
427 void SAL_CALL ODatabaseMetaDataResultSet::beforeFirst( ) throw(SQLException, RuntimeException)
429 ::osl::MutexGuard aGuard( m_aMutex );
430 checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
432 checkRecordSet();
435 if(first())
436 previous();
438 // -------------------------------------------------------------------------
439 void SAL_CALL ODatabaseMetaDataResultSet::afterLast( ) throw(SQLException, RuntimeException)
441 ::osl::MutexGuard aGuard( m_aMutex );
442 checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
444 checkRecordSet();
447 if(last())
448 next();
449 m_bEOF = sal_True;
451 // -------------------------------------------------------------------------
453 void SAL_CALL ODatabaseMetaDataResultSet::close( ) throw(SQLException, RuntimeException)
456 ::osl::MutexGuard aGuard( m_aMutex );
457 checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
460 dispose();
462 // -------------------------------------------------------------------------
464 sal_Bool SAL_CALL ODatabaseMetaDataResultSet::first( ) throw(SQLException, RuntimeException)
466 ::osl::MutexGuard aGuard( m_aMutex );
467 checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
470 if(!m_pRecordSet)
471 return sal_False;
473 sal_Bool bRet = SUCCEEDED(m_pRecordSet->MoveFirst());
474 if ( bRet )
475 m_nRowPos = 1;
476 return bRet;
478 // -------------------------------------------------------------------------
480 sal_Bool SAL_CALL ODatabaseMetaDataResultSet::last( ) throw(SQLException, RuntimeException)
482 ::osl::MutexGuard aGuard( m_aMutex );
483 checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed );
486 return m_pRecordSet && SUCCEEDED(m_pRecordSet->MoveLast()) ? sal_True : sal_False;
488 // -------------------------------------------------------------------------
489 sal_Bool SAL_CALL ODatabaseMetaDataResultSet::absolute( sal_Int32 row ) throw(SQLException, RuntimeException)
491 ::osl::MutexGuard aGuard( m_aMutex );
492 checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
495 if(first())
497 OLEVariant aEmpty;
498 aEmpty.setNoArg();
499 sal_Bool bRet = SUCCEEDED(m_pRecordSet->Move(row,aEmpty));
500 if(bRet)
501 m_nRowPos = row;
502 return bRet;
504 return sal_False;
506 // -------------------------------------------------------------------------
507 sal_Bool SAL_CALL ODatabaseMetaDataResultSet::relative( sal_Int32 row ) throw(SQLException, RuntimeException)
509 ::osl::MutexGuard aGuard( m_aMutex );
510 checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
513 if(!m_pRecordSet)
514 return sal_False;
516 OLEVariant aEmpty;
517 aEmpty.setNoArg();
518 sal_Bool bRet = SUCCEEDED(m_pRecordSet->Move(row,aEmpty));
519 if(bRet)
520 m_nRowPos += row;
521 return bRet;
523 // -------------------------------------------------------------------------
524 sal_Bool SAL_CALL ODatabaseMetaDataResultSet::previous( ) throw(SQLException, RuntimeException)
526 ::osl::MutexGuard aGuard( m_aMutex );
527 checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
530 if(!m_pRecordSet)
531 return sal_False;
533 sal_Bool bRet = SUCCEEDED(m_pRecordSet->MovePrevious());
534 if(bRet)
535 --m_nRowPos;
536 return bRet;
538 // -------------------------------------------------------------------------
539 Reference< XInterface > SAL_CALL ODatabaseMetaDataResultSet::getStatement( ) throw(SQLException, RuntimeException)
541 return m_aStatement.get();
543 // -------------------------------------------------------------------------
545 sal_Bool SAL_CALL ODatabaseMetaDataResultSet::rowDeleted( ) throw(SQLException, RuntimeException)
547 ::osl::MutexGuard aGuard( m_aMutex );
548 checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
550 checkRecordSet();
553 RecordStatusEnum eRec;
554 m_pRecordSet->get_Status((sal_Int32*)&eRec);
555 return (eRec & adRecDeleted) == adRecDeleted;
557 // -------------------------------------------------------------------------
558 sal_Bool SAL_CALL ODatabaseMetaDataResultSet::rowInserted( ) throw(SQLException, RuntimeException)
559 { ::osl::MutexGuard aGuard( m_aMutex );
560 checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
562 checkRecordSet();
565 RecordStatusEnum eRec;
566 m_pRecordSet->get_Status((sal_Int32*)&eRec);
567 return (eRec & adRecNew) == adRecNew;
569 // -------------------------------------------------------------------------
570 sal_Bool SAL_CALL ODatabaseMetaDataResultSet::rowUpdated( ) throw(SQLException, RuntimeException)
572 ::osl::MutexGuard aGuard( m_aMutex );
573 checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
575 checkRecordSet();
578 RecordStatusEnum eRec;
579 m_pRecordSet->get_Status((sal_Int32*)&eRec);
580 return (eRec & adRecModified) == adRecModified;
582 // -------------------------------------------------------------------------
584 sal_Bool SAL_CALL ODatabaseMetaDataResultSet::isBeforeFirst( ) throw(SQLException, RuntimeException)
586 ::osl::MutexGuard aGuard( m_aMutex );
587 checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
590 if(!m_pRecordSet)
591 return sal_True;
593 VARIANT_BOOL bIsAtBOF;
594 m_pRecordSet->get_BOF(&bIsAtBOF);
595 return bIsAtBOF == VARIANT_TRUE;
597 // -------------------------------------------------------------------------
599 sal_Bool SAL_CALL ODatabaseMetaDataResultSet::next( ) throw(SQLException, RuntimeException)
601 ::osl::MutexGuard aGuard( m_aMutex );
602 checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
605 if(!m_pRecordSet)
606 return sal_False;
608 if(m_bOnFirstAfterOpen)
610 m_bOnFirstAfterOpen = sal_False;
611 return sal_True;
613 else
614 return SUCCEEDED(m_pRecordSet->MoveNext());
616 // -------------------------------------------------------------------------
618 sal_Bool SAL_CALL ODatabaseMetaDataResultSet::wasNull( ) throw(SQLException, RuntimeException)
620 ::osl::MutexGuard aGuard( m_aMutex );
621 checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
623 checkRecordSet();
626 return m_aValue.isNull();
628 // -------------------------------------------------------------------------
629 void SAL_CALL ODatabaseMetaDataResultSet::refreshRow( ) throw(SQLException, RuntimeException)
631 ::osl::MutexGuard aGuard( m_aMutex );
632 checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
634 checkRecordSet();
637 m_pRecordSet->Resync(adAffectCurrent,adResyncAllValues);
639 // -------------------------------------------------------------------------
641 void SAL_CALL ODatabaseMetaDataResultSet::cancel( ) throw(RuntimeException)
643 ::osl::MutexGuard aGuard( m_aMutex );
644 checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
646 checkRecordSet();
649 m_pRecordSet->Cancel();
651 // -------------------------------------------------------------------------
652 void SAL_CALL ODatabaseMetaDataResultSet::clearWarnings( ) throw(SQLException, RuntimeException)
655 // -------------------------------------------------------------------------
656 Any SAL_CALL ODatabaseMetaDataResultSet::getWarnings( ) throw(SQLException, RuntimeException)
658 return Any();
660 //------------------------------------------------------------------------------
661 sal_Int32 ODatabaseMetaDataResultSet::getResultSetConcurrency() const
662 throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
664 return ResultSetConcurrency::READ_ONLY;
666 //------------------------------------------------------------------------------
667 sal_Int32 ODatabaseMetaDataResultSet::getResultSetType() const
668 throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
670 return ResultSetType::FORWARD_ONLY;
672 //------------------------------------------------------------------------------
673 sal_Int32 ODatabaseMetaDataResultSet::getFetchDirection() const
674 throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
676 return FetchDirection::FORWARD;
678 //------------------------------------------------------------------------------
679 sal_Int32 ODatabaseMetaDataResultSet::getFetchSize() const
680 throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
682 sal_Int32 nValue=-1;
683 if(m_pRecordSet)
684 m_pRecordSet->get_CacheSize(&nValue);
685 return nValue;
687 //------------------------------------------------------------------------------
688 ::rtl::OUString ODatabaseMetaDataResultSet::getCursorName() const
689 throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
691 return ::rtl::OUString();
694 //------------------------------------------------------------------------------
695 void ODatabaseMetaDataResultSet::setFetchDirection(sal_Int32 /*_par0*/)
696 throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
698 ::dbtools::throwFeatureNotImplementedException( "ResultSet::FetchDirection", *this );
700 //------------------------------------------------------------------------------
701 void ODatabaseMetaDataResultSet::setFetchSize(sal_Int32 _par0)
702 throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException)
704 if(m_pRecordSet)
705 m_pRecordSet->put_CacheSize(_par0);
707 // -------------------------------------------------------------------------
708 ::cppu::IPropertyArrayHelper* ODatabaseMetaDataResultSet::createArrayHelper( ) const
711 Sequence< com::sun::star::beans::Property > aProps(5);
712 com::sun::star::beans::Property* pProperties = aProps.getArray();
713 sal_Int32 nPos = 0;
714 DECL_PROP0(CURSORNAME, ::rtl::OUString);
715 DECL_PROP0(FETCHDIRECTION, sal_Int32);
716 DECL_PROP0(FETCHSIZE, sal_Int32);
717 DECL_PROP0(RESULTSETCONCURRENCY,sal_Int32);
718 DECL_PROP0(RESULTSETTYPE, sal_Int32);
720 return new ::cppu::OPropertyArrayHelper(aProps);
722 // -------------------------------------------------------------------------
723 ::cppu::IPropertyArrayHelper & ODatabaseMetaDataResultSet::getInfoHelper()
725 return *const_cast<ODatabaseMetaDataResultSet*>(this)->getArrayHelper();
727 // -------------------------------------------------------------------------
728 sal_Bool ODatabaseMetaDataResultSet::convertFastPropertyValue(
729 Any & rConvertedValue,
730 Any & rOldValue,
731 sal_Int32 nHandle,
732 const Any& rValue )
733 throw (::com::sun::star::lang::IllegalArgumentException)
735 switch(nHandle)
737 case PROPERTY_ID_CURSORNAME:
738 case PROPERTY_ID_RESULTSETCONCURRENCY:
739 case PROPERTY_ID_RESULTSETTYPE:
740 throw ::com::sun::star::lang::IllegalArgumentException();
741 break;
742 case PROPERTY_ID_FETCHDIRECTION:
743 return ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, getFetchDirection());
744 case PROPERTY_ID_FETCHSIZE:
745 return ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, getFetchSize());
746 default:
749 return sal_False;
751 // -------------------------------------------------------------------------
752 void ODatabaseMetaDataResultSet::setFastPropertyValue_NoBroadcast(
753 sal_Int32 nHandle,
754 const Any& /*rValue*/
756 throw (Exception)
758 switch(nHandle)
760 case PROPERTY_ID_CURSORNAME:
761 case PROPERTY_ID_RESULTSETCONCURRENCY:
762 case PROPERTY_ID_RESULTSETTYPE:
763 case PROPERTY_ID_FETCHDIRECTION:
764 case PROPERTY_ID_FETCHSIZE:
765 throw Exception();
766 break;
767 default:
768 OSL_ENSURE(0,"setFastPropertyValue_NoBroadcast: Illegal handle value!");
771 // -------------------------------------------------------------------------
772 void ODatabaseMetaDataResultSet::getFastPropertyValue(
773 Any& rValue,
774 sal_Int32 nHandle
775 ) const
777 switch(nHandle)
779 case PROPERTY_ID_CURSORNAME:
780 rValue <<= getCursorName();
781 break;
782 case PROPERTY_ID_RESULTSETCONCURRENCY:
783 rValue <<= getResultSetConcurrency();
784 break;
785 case PROPERTY_ID_RESULTSETTYPE:
786 rValue <<= getResultSetType();
787 break;
788 case PROPERTY_ID_FETCHDIRECTION:
789 rValue <<= getFetchDirection();
790 break;
791 case PROPERTY_ID_FETCHSIZE:
792 rValue <<= getFetchSize();
793 break;
796 // -------------------------------------------------------------------------
797 void ODatabaseMetaDataResultSet::setProceduresMap()
800 for(sal_Int32 i=1;i<4;i++)
801 m_aColMapping.push_back(i);
802 m_aColMapping.push_back(5);
803 m_aColMapping.push_back(7);
804 m_aColMapping.push_back(8);
805 m_aColMapping.push_back(6);
806 m_aColMapping.push_back(4);
808 TInt2IntMap aMap;
809 aMap[DB_PT_UNKNOWN] = ProcedureResult::UNKNOWN;
810 aMap[DB_PT_PROCEDURE] = ProcedureResult::NONE;
811 aMap[DB_PT_FUNCTION] = ProcedureResult::RETURN;
812 m_aValueRange[4] = aMap;
814 ODatabaseMetaDataResultSetMetaData* pMetaData = new ODatabaseMetaDataResultSetMetaData(m_pRecordSet,this);
815 pMetaData->setProceduresMap();
816 m_xMetaData = pMetaData;
818 // -------------------------------------------------------------------------
819 void ODatabaseMetaDataResultSet::setCatalogsMap()
821 m_aColMapping.push_back(1);
823 m_xMetaData = new ODatabaseMetaDataResultSetMetaData(m_pRecordSet,this);
825 // -------------------------------------------------------------------------
826 void ODatabaseMetaDataResultSet::setSchemasMap()
828 m_aColMapping.push_back(2);
830 m_xMetaData = new ODatabaseMetaDataResultSetMetaData(m_pRecordSet,this);
832 // -------------------------------------------------------------------------
833 void ODatabaseMetaDataResultSet::setColumnPrivilegesMap()
836 m_aColMapping.push_back(3);
837 m_aColMapping.push_back(4);
838 m_aColMapping.push_back(5);
839 m_aColMapping.push_back(6);
840 m_aColMapping.push_back(2);
841 m_aColMapping.push_back(9);
842 m_aColMapping.push_back(10);
844 ODatabaseMetaDataResultSetMetaData* pMetaData = new ODatabaseMetaDataResultSetMetaData(m_pRecordSet,this);
845 pMetaData->setColumnPrivilegesMap();
846 m_xMetaData = pMetaData;
848 // -------------------------------------------------------------------------
849 void ODatabaseMetaDataResultSet::setColumnsMap()
852 for(sal_Int32 i=1;i<5;++i)
853 m_aColMapping.push_back(i);
855 m_aColMapping.push_back(12);
856 m_aColMapping.push_back(12); // is used as TYPE_NAME
858 m_aColMapping.push_back(14);
859 m_aColMapping.push_back(6);
860 m_aColMapping.push_back(17);
861 m_aColMapping.push_back(18);
863 m_aColMapping.push_back(11);
864 m_aColMapping.push_back(29);
865 m_aColMapping.push_back(9);
866 m_aColMapping.push_back(18);
867 m_aColMapping.push_back(18);
869 m_aColMapping.push_back(15);
870 m_aColMapping.push_back(7);
871 m_aColMapping.push_back(11);
873 TInt2IntMap aMap;
874 aMap[adEmpty] = ADOS::MapADOType2Jdbc(adEmpty);
875 aMap[adTinyInt] = ADOS::MapADOType2Jdbc(adTinyInt);
876 aMap[adSmallInt] = ADOS::MapADOType2Jdbc(adSmallInt);
877 aMap[adInteger] = ADOS::MapADOType2Jdbc(adInteger);
878 aMap[adBigInt] = ADOS::MapADOType2Jdbc(adBigInt);
879 aMap[adUnsignedTinyInt] = ADOS::MapADOType2Jdbc(adUnsignedTinyInt);
880 aMap[adUnsignedSmallInt]= ADOS::MapADOType2Jdbc(adUnsignedSmallInt);
881 aMap[adUnsignedInt] = ADOS::MapADOType2Jdbc(adUnsignedInt);
882 aMap[adUnsignedBigInt] = ADOS::MapADOType2Jdbc(adUnsignedBigInt);
883 aMap[adSingle] = ADOS::MapADOType2Jdbc(adSingle);
884 aMap[adDouble] = ADOS::MapADOType2Jdbc(adDouble);
885 aMap[adCurrency] = ADOS::MapADOType2Jdbc(adCurrency);
886 aMap[adDecimal] = ADOS::MapADOType2Jdbc(adDecimal);
887 aMap[adNumeric] = ADOS::MapADOType2Jdbc(adNumeric);
888 aMap[adBoolean] = ADOS::MapADOType2Jdbc(adBoolean);
889 aMap[adError] = ADOS::MapADOType2Jdbc(adError);
890 aMap[adUserDefined] = ADOS::MapADOType2Jdbc(adUserDefined);
891 aMap[adVariant] = ADOS::MapADOType2Jdbc(adVariant);
892 aMap[adIDispatch] = ADOS::MapADOType2Jdbc(adIDispatch);
893 aMap[adIUnknown] = ADOS::MapADOType2Jdbc(adIUnknown);
894 aMap[adGUID] = ADOS::MapADOType2Jdbc(adGUID);
895 aMap[adDate] = ADOS::MapADOType2Jdbc(adDate);
896 aMap[adDBDate] = ADOS::MapADOType2Jdbc(adDBDate);
897 aMap[adDBTime] = ADOS::MapADOType2Jdbc(adDBTime);
898 aMap[adDBTimeStamp] = ADOS::MapADOType2Jdbc(adDBTimeStamp);
899 aMap[adBSTR] = ADOS::MapADOType2Jdbc(adBSTR);
900 aMap[adChar] = ADOS::MapADOType2Jdbc(adChar);
901 aMap[adVarChar] = ADOS::MapADOType2Jdbc(adVarChar);
902 aMap[adLongVarChar] = ADOS::MapADOType2Jdbc(adLongVarChar);
903 aMap[adWChar] = ADOS::MapADOType2Jdbc(adWChar);
904 aMap[adVarWChar] = ADOS::MapADOType2Jdbc(adVarWChar);
905 aMap[adLongVarWChar] = ADOS::MapADOType2Jdbc(adLongVarWChar);
906 aMap[adBinary] = ADOS::MapADOType2Jdbc(adBinary);
907 aMap[adVarBinary] = ADOS::MapADOType2Jdbc(adVarBinary);
908 aMap[adLongVarBinary] = ADOS::MapADOType2Jdbc(adLongVarBinary);
909 aMap[adChapter] = ADOS::MapADOType2Jdbc(adChapter);
910 aMap[adFileTime] = ADOS::MapADOType2Jdbc(adFileTime);
911 aMap[adPropVariant] = ADOS::MapADOType2Jdbc(adPropVariant);
912 aMap[adVarNumeric] = ADOS::MapADOType2Jdbc(adVarNumeric);
913 // aMap[adArray] = ADOS::MapADOType2Jdbc(adArray);
915 m_aValueRange[12] = aMap;
917 ::std::map< sal_Int32,::rtl::OUString> aMap2;
918 aMap2[0] = ::rtl::OUString::createFromAscii("YES");
919 aMap2[1] = ::rtl::OUString::createFromAscii("NO");
920 m_aIntValueRange[18] = aMap2;
922 ODatabaseMetaDataResultSetMetaData* pMetaData = new ODatabaseMetaDataResultSetMetaData(m_pRecordSet,this);
923 pMetaData->setColumnsMap();
924 m_xMetaData = pMetaData;
926 // -------------------------------------------------------------------------
927 void ODatabaseMetaDataResultSet::setTablesMap()
930 for(sal_Int32 i=1;i<5;i++)
931 m_aColMapping.push_back(i);
932 m_aColMapping.push_back(6);
934 ODatabaseMetaDataResultSetMetaData* pMetaData = new ODatabaseMetaDataResultSetMetaData(m_pRecordSet,this);
935 pMetaData->setTablesMap();
936 m_xMetaData = pMetaData;
938 // -------------------------------------------------------------------------
939 void ODatabaseMetaDataResultSet::setProcedureColumnsMap()
942 for(sal_Int32 i=1;i<5;i++)
943 m_aColMapping.push_back(i);
944 m_aColMapping.push_back(6);
945 m_aColMapping.push_back(10);
946 m_aColMapping.push_back(16);
947 m_aColMapping.push_back(13);
948 m_aColMapping.push_back(11);
949 m_aColMapping.push_back(12);
951 m_aColMapping.push_back(9);
952 m_aColMapping.push_back(14);
954 TInt2IntMap aMap;
955 aMap[DBTYPE_EMPTY] = DataType::SQLNULL;
956 aMap[DBTYPE_NULL] = DataType::SQLNULL;
957 aMap[DBTYPE_I2] = DataType::SMALLINT;
958 aMap[DBTYPE_I4] = DataType::INTEGER;
959 aMap[DBTYPE_R4] = DataType::FLOAT;
960 aMap[DBTYPE_R8] = DataType::DOUBLE;
961 aMap[DBTYPE_CY] = DataType::BIGINT;
962 aMap[DBTYPE_DATE] = DataType::DATE;
963 aMap[DBTYPE_BSTR] = DataType::VARCHAR;
964 aMap[DBTYPE_IDISPATCH] = DataType::OBJECT;
965 aMap[DBTYPE_ERROR] = DataType::OTHER;
966 aMap[DBTYPE_BOOL] = DataType::BIT;
967 aMap[DBTYPE_VARIANT] = DataType::STRUCT;
968 aMap[DBTYPE_IUNKNOWN] = DataType::OTHER;
969 aMap[DBTYPE_DECIMAL] = DataType::DECIMAL;
970 aMap[DBTYPE_UI1] = DataType::TINYINT;
971 aMap[DBTYPE_ARRAY] = DataType::ARRAY;
972 aMap[DBTYPE_BYREF] = DataType::REF;
973 aMap[DBTYPE_I1] = DataType::CHAR;
974 aMap[DBTYPE_UI2] = DataType::SMALLINT;
975 aMap[DBTYPE_UI4] = DataType::INTEGER;
977 // aMap[The] = ;
978 // aMap[in] = ;
979 aMap[DBTYPE_I8] = DataType::BIGINT;
980 aMap[DBTYPE_UI8] = DataType::BIGINT;
981 aMap[DBTYPE_GUID] = DataType::OTHER;
982 aMap[DBTYPE_VECTOR] = DataType::OTHER;
983 aMap[DBTYPE_FILETIME] = DataType::OTHER;
984 aMap[DBTYPE_RESERVED] = DataType::OTHER;
986 // aMap[The] = ;
987 aMap[DBTYPE_BYTES] = DataType::VARBINARY;
988 aMap[DBTYPE_STR] = DataType::LONGVARCHAR;
989 aMap[DBTYPE_WSTR] = DataType::LONGVARCHAR;
990 aMap[DBTYPE_NUMERIC] = DataType::NUMERIC;
991 aMap[DBTYPE_UDT] = DataType::OTHER;
992 aMap[DBTYPE_DBDATE] = DataType::DATE;
993 aMap[DBTYPE_DBTIME] = DataType::TIME;
994 aMap[DBTYPE_DBTIMESTAMP] = DataType::TIMESTAMP;
995 aMap[DBTYPE_HCHAPTER] = DataType::OTHER;
996 aMap[DBTYPE_PROPVARIANT] = DataType::OTHER;
997 aMap[DBTYPE_VARNUMERIC] = DataType::NUMERIC;
999 m_aValueRange[10] = aMap;
1001 ODatabaseMetaDataResultSetMetaData* pMetaData = new ODatabaseMetaDataResultSetMetaData(m_pRecordSet,this);
1002 pMetaData->setProcedureColumnsMap();
1003 m_xMetaData = pMetaData;
1005 // -------------------------------------------------------------------------
1006 void ODatabaseMetaDataResultSet::setPrimaryKeysMap()
1009 sal_Int32 i=1;
1010 for(;i<5;i++)
1011 m_aColMapping.push_back(i);
1012 m_aColMapping.push_back(7);
1013 m_aColMapping.push_back(8);
1015 ODatabaseMetaDataResultSetMetaData* pMetaData = new ODatabaseMetaDataResultSetMetaData(m_pRecordSet,this);
1016 pMetaData->setProcedureColumnsMap();
1017 m_xMetaData = pMetaData;
1019 // -------------------------------------------------------------------------
1020 void ODatabaseMetaDataResultSet::setIndexInfoMap()
1023 sal_Int32 i=1;
1024 for(;i<4;i++)
1025 m_aColMapping.push_back(i);
1026 m_aColMapping.push_back(8);
1027 m_aColMapping.push_back(4);
1028 m_aColMapping.push_back(6);
1029 m_aColMapping.push_back(10);
1030 m_aColMapping.push_back(17);
1031 m_aColMapping.push_back(18);
1032 m_aColMapping.push_back(21);
1033 m_aColMapping.push_back(22);
1034 m_aColMapping.push_back(23);
1035 m_aColMapping.push_back(24);
1037 TInt2IntMap aMap;
1038 aMap[DBPROPVAL_IT_HASH] = IndexType::HASHED;
1039 aMap[DBPROPVAL_IT_CONTENT] = IndexType::OTHER;
1040 aMap[DBPROPVAL_IT_OTHER] = IndexType::OTHER;
1041 aMap[DBPROPVAL_IT_BTREE] = IndexType::OTHER;
1043 m_aValueRange[10] = aMap;
1045 TInt2IntMap aMap2;
1046 aMap[0] = 1;
1047 aMap[1] = 0;
1048 m_aValueRange[8] = aMap2;
1050 ::std::map< sal_Int32,::rtl::OUString> aMap3;
1051 aMap3[0] = ::rtl::OUString();
1052 aMap3[DB_COLLATION_ASC] = ::rtl::OUString::createFromAscii("A");
1053 aMap3[DB_COLLATION_DESC] = ::rtl::OUString::createFromAscii("D");
1055 m_aIntValueRange[21] = aMap3;
1057 ODatabaseMetaDataResultSetMetaData* pMetaData = new ODatabaseMetaDataResultSetMetaData(m_pRecordSet,this);
1058 pMetaData->setIndexInfoMap();
1059 m_xMetaData = pMetaData;
1061 // -------------------------------------------------------------------------
1062 void ODatabaseMetaDataResultSet::setTablePrivilegesMap()
1065 sal_Int32 i=3;
1066 for(;i<6;i++)
1067 m_aColMapping.push_back(i);
1068 m_aColMapping.push_back(1);
1069 m_aColMapping.push_back(2);
1070 m_aColMapping.push_back(6);
1071 m_aColMapping.push_back(7);
1073 ::std::map< sal_Int32,::rtl::OUString> aMap;
1074 aMap[0] = ::rtl::OUString::createFromAscii("YES");
1075 aMap[1] = ::rtl::OUString::createFromAscii("NO");
1076 m_aIntValueRange[7] = aMap;
1079 ODatabaseMetaDataResultSetMetaData* pMetaData = new ODatabaseMetaDataResultSetMetaData(m_pRecordSet,this);
1080 pMetaData->setTablePrivilegesMap();
1081 m_xMetaData = pMetaData;
1083 // -------------------------------------------------------------------------
1084 void ODatabaseMetaDataResultSet::setCrossReferenceMap()
1087 sal_Int32 i=1;
1088 for(;i<5;i++)
1089 m_aColMapping.push_back(i);
1090 for(i=7;i<11;i++)
1091 m_aColMapping.push_back(i);
1093 m_aColMapping.push_back(13);
1094 m_aColMapping.push_back(14);
1095 m_aColMapping.push_back(15);
1096 m_aColMapping.push_back(17);
1097 m_aColMapping.push_back(16);
1098 m_aColMapping.push_back(18);
1100 ::std::map< ::rtl::OUString,sal_Int32> aMap;
1101 aMap[ ::rtl::OUString::createFromAscii("CASCADE")] = KeyRule::CASCADE;
1102 aMap[ ::rtl::OUString::createFromAscii("RESTRICT")] = KeyRule::RESTRICT;
1103 aMap[ ::rtl::OUString::createFromAscii("SET NULL")] = KeyRule::SET_NULL;
1104 aMap[ ::rtl::OUString::createFromAscii("SET DEFAULT")] = KeyRule::SET_DEFAULT;
1105 aMap[ ::rtl::OUString::createFromAscii("NO ACTION")] = KeyRule::NO_ACTION;
1107 m_aStrValueRange[14] = aMap;
1108 m_aStrValueRange[15] = aMap;
1110 ODatabaseMetaDataResultSetMetaData* pMetaData = new ODatabaseMetaDataResultSetMetaData(m_pRecordSet,this);
1111 pMetaData->setCrossReferenceMap();
1112 m_xMetaData = pMetaData;
1114 // -------------------------------------------------------------------------
1115 void ODatabaseMetaDataResultSet::setTypeInfoMap(sal_Bool _bJetEngine)
1117 sal_Int32 i=1;
1118 for(;i<19;i++)
1119 m_aColMapping.push_back(i);
1121 ::std::map< ::rtl::OUString,sal_Int32> aMap1;
1122 aMap1[ ::rtl::OUString()] = 10;
1124 m_aStrValueRange[18] = aMap1;
1126 TInt2IntMap aMap;
1127 aMap[adEmpty] = ADOS::MapADOType2Jdbc(adEmpty);
1128 aMap[adTinyInt] = ADOS::MapADOType2Jdbc(adTinyInt);
1129 aMap[adSmallInt] = ADOS::MapADOType2Jdbc(adSmallInt);
1130 aMap[adInteger] = ADOS::MapADOType2Jdbc(adInteger);
1131 aMap[adBigInt] = ADOS::MapADOType2Jdbc(adBigInt);
1132 aMap[adUnsignedTinyInt] = ADOS::MapADOType2Jdbc(adUnsignedTinyInt);
1133 aMap[adUnsignedSmallInt]= ADOS::MapADOType2Jdbc(adUnsignedSmallInt);
1134 aMap[adUnsignedInt] = ADOS::MapADOType2Jdbc(adUnsignedInt);
1135 aMap[adUnsignedBigInt] = ADOS::MapADOType2Jdbc(adUnsignedBigInt);
1136 aMap[adSingle] = ADOS::MapADOType2Jdbc(adSingle);
1137 aMap[adDouble] = ADOS::MapADOType2Jdbc(adDouble);
1138 aMap[adCurrency] = ADOS::MapADOType2Jdbc(adCurrency);
1139 aMap[adDecimal] = ADOS::MapADOType2Jdbc(adDecimal);
1140 aMap[adNumeric] = ADOS::MapADOType2Jdbc(adNumeric);
1141 aMap[adBoolean] = ADOS::MapADOType2Jdbc(adBoolean);
1142 aMap[adError] = ADOS::MapADOType2Jdbc(adError);
1143 aMap[adUserDefined] = ADOS::MapADOType2Jdbc(adUserDefined);
1144 aMap[adVariant] = ADOS::MapADOType2Jdbc(adVariant);
1145 aMap[adIDispatch] = ADOS::MapADOType2Jdbc(adIDispatch);
1146 aMap[adIUnknown] = ADOS::MapADOType2Jdbc(adIUnknown);
1147 aMap[adGUID] = ADOS::MapADOType2Jdbc(adGUID);
1148 aMap[adDate] = _bJetEngine ? ADOS::MapADOType2Jdbc(adDBTimeStamp) : ADOS::MapADOType2Jdbc(adDate);
1149 aMap[adDBDate] = ADOS::MapADOType2Jdbc(adDBDate);
1150 aMap[adDBTime] = ADOS::MapADOType2Jdbc(adDBTime);
1151 aMap[adDBTimeStamp] = ADOS::MapADOType2Jdbc(adDBTimeStamp);
1152 aMap[adBSTR] = ADOS::MapADOType2Jdbc(adBSTR);
1153 aMap[adChar] = ADOS::MapADOType2Jdbc(adChar);
1154 aMap[adVarChar] = ADOS::MapADOType2Jdbc(adVarChar);
1155 aMap[adLongVarChar] = ADOS::MapADOType2Jdbc(adLongVarChar);
1156 aMap[adWChar] = ADOS::MapADOType2Jdbc(adWChar);
1157 aMap[adVarWChar] = ADOS::MapADOType2Jdbc(adVarWChar);
1158 aMap[adLongVarWChar] = ADOS::MapADOType2Jdbc(adLongVarWChar);
1159 aMap[adBinary] = ADOS::MapADOType2Jdbc(adBinary);
1160 aMap[adVarBinary] = ADOS::MapADOType2Jdbc(adVarBinary);
1161 aMap[adLongVarBinary] = ADOS::MapADOType2Jdbc(adLongVarBinary);
1162 aMap[adChapter] = ADOS::MapADOType2Jdbc(adChapter);
1163 aMap[adFileTime] = ADOS::MapADOType2Jdbc(adFileTime);
1164 aMap[adPropVariant] = ADOS::MapADOType2Jdbc(adPropVariant);
1165 aMap[adVarNumeric] = ADOS::MapADOType2Jdbc(adVarNumeric);
1166 // aMap[adArray] = ADOS::MapADOType2Jdbc(adArray);
1168 m_aValueRange[2] = aMap;
1170 TInt2IntMap aColumnValueMapping;
1171 aColumnValueMapping[VARIANT_FALSE] = ColumnValue::NO_NULLS;
1172 aColumnValueMapping[VARIANT_TRUE] = ColumnValue::NULLABLE;
1173 m_aValueRange[7] = aColumnValueMapping;
1175 // now adjust the column mapping
1176 // OJ 24.01.2002 96860
1177 TInt2IntMap aSerachMapping;
1178 aSerachMapping[DB_UNSEARCHABLE] = ColumnSearch::NONE;
1179 aSerachMapping[DB_LIKE_ONLY] = ColumnSearch::CHAR;
1180 aSerachMapping[DB_ALL_EXCEPT_LIKE] = ColumnSearch::BASIC;
1181 aSerachMapping[DB_SEARCHABLE] = ColumnSearch::FULL;
1183 m_aValueRange[9] = aSerachMapping;
1185 TInt2IntMap aCurrencyMapping;
1186 m_aValueRange[11] = aCurrencyMapping;
1188 ODatabaseMetaDataResultSetMetaData* pMetaData = new ODatabaseMetaDataResultSetMetaData(m_pRecordSet,this);
1189 pMetaData->setTypeInfoMap();
1190 m_xMetaData = pMetaData;
1192 // -----------------------------------------------------------------------------
1193 void SAL_CALL ODatabaseMetaDataResultSet::acquire() throw()
1195 ODatabaseMetaDataResultSet_BASE::acquire();
1197 // -----------------------------------------------------------------------------
1198 void SAL_CALL ODatabaseMetaDataResultSet::release() throw()
1200 ODatabaseMetaDataResultSet_BASE::release();
1202 // -----------------------------------------------------------------------------
1203 ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL ODatabaseMetaDataResultSet::getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException)
1205 return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper());
1207 // -----------------------------------------------------------------------------
1208 OLEVariant ODatabaseMetaDataResultSet::getValue(sal_Int32 columnIndex ) throw(SQLException, RuntimeException)
1210 ::osl::MutexGuard aGuard( m_aMutex );
1211 checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed);
1213 checkRecordSet();
1215 WpADOField aField = ADOS::getField(m_pRecordSet,columnIndex);
1216 aField.get_Value(m_aValue);
1217 return m_aValue;
1219 // -----------------------------------------------------------------------------