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 <comphelper/sequence.hxx> 27cdf0e10cSrcweir #include "ado/ADatabaseMetaDataResultSet.hxx" 28cdf0e10cSrcweir #include "ado/ADatabaseMetaDataResultSetMetaData.hxx" 29cdf0e10cSrcweir #include <com/sun/star/sdbc/DataType.hpp> 30cdf0e10cSrcweir #include <com/sun/star/sdbc/ColumnValue.hpp> 31cdf0e10cSrcweir #include <com/sun/star/sdbc/KeyRule.hpp> 32cdf0e10cSrcweir #include <com/sun/star/sdbc/ProcedureResult.hpp> 33cdf0e10cSrcweir #include <com/sun/star/sdbc/IndexType.hpp> 34cdf0e10cSrcweir #include <comphelper/property.hxx> 35cdf0e10cSrcweir #include <com/sun/star/lang/DisposedException.hpp> 36cdf0e10cSrcweir #include <com/sun/star/sdbc/ResultSetConcurrency.hpp> 37cdf0e10cSrcweir #include <com/sun/star/sdbc/ResultSetType.hpp> 38cdf0e10cSrcweir #include <com/sun/star/sdbc/FetchDirection.hpp> 39cdf0e10cSrcweir #include <cppuhelper/typeprovider.hxx> 40cdf0e10cSrcweir #include <comphelper/seqstream.hxx> 41cdf0e10cSrcweir #include "connectivity/dbexception.hxx" 42cdf0e10cSrcweir 43cdf0e10cSrcweir 44cdf0e10cSrcweir #include <oledb.h> 45cdf0e10cSrcweir 46cdf0e10cSrcweir using namespace dbtools; 47cdf0e10cSrcweir using namespace connectivity::ado; 48cdf0e10cSrcweir using namespace cppu; 49cdf0e10cSrcweir using namespace ::comphelper; 50cdf0e10cSrcweir //------------------------------------------------------------------------------ 51cdf0e10cSrcweir using namespace ::com::sun::star::lang; 52cdf0e10cSrcweir using namespace com::sun::star::uno; 53cdf0e10cSrcweir using namespace com::sun::star::lang; 54cdf0e10cSrcweir using namespace com::sun::star::beans; 55cdf0e10cSrcweir using namespace com::sun::star::sdbc; 56cdf0e10cSrcweir 57cdf0e10cSrcweir // ------------------------------------------------------------------------- 58cdf0e10cSrcweir ODatabaseMetaDataResultSet::ODatabaseMetaDataResultSet(ADORecordset* _pRecordSet) 59cdf0e10cSrcweir :ODatabaseMetaDataResultSet_BASE(m_aMutex) 60cdf0e10cSrcweir ,OPropertySetHelper(ODatabaseMetaDataResultSet_BASE::rBHelper) 61cdf0e10cSrcweir ,m_aStatement(NULL) 62cdf0e10cSrcweir ,m_xMetaData(NULL) 63cdf0e10cSrcweir ,m_pRecordSet(_pRecordSet) 64cdf0e10cSrcweir ,m_bEOF(sal_False) 65cdf0e10cSrcweir { 66cdf0e10cSrcweir osl_incrementInterlockedCount( &m_refCount ); 67cdf0e10cSrcweir m_aColMapping.push_back(-1); 68cdf0e10cSrcweir if(_pRecordSet) 69cdf0e10cSrcweir { 70cdf0e10cSrcweir m_pRecordSet->AddRef(); 71cdf0e10cSrcweir VARIANT_BOOL bIsAtBOF; 72cdf0e10cSrcweir m_pRecordSet->get_BOF(&bIsAtBOF); 73cdf0e10cSrcweir m_bOnFirstAfterOpen = bIsAtBOF != VARIANT_TRUE; 74cdf0e10cSrcweir } 75cdf0e10cSrcweir else 76cdf0e10cSrcweir m_bOnFirstAfterOpen = sal_False; 77cdf0e10cSrcweir osl_decrementInterlockedCount( &m_refCount ); 78cdf0e10cSrcweir // allocBuffer(); 79cdf0e10cSrcweir } 80cdf0e10cSrcweir 81cdf0e10cSrcweir // ------------------------------------------------------------------------- 82cdf0e10cSrcweir ODatabaseMetaDataResultSet::~ODatabaseMetaDataResultSet() 83cdf0e10cSrcweir { 84cdf0e10cSrcweir if(m_pRecordSet) 85cdf0e10cSrcweir m_pRecordSet->Release(); 86cdf0e10cSrcweir } 87cdf0e10cSrcweir // ------------------------------------------------------------------------- 88cdf0e10cSrcweir void ODatabaseMetaDataResultSet::disposing(void) 89cdf0e10cSrcweir { 90cdf0e10cSrcweir OPropertySetHelper::disposing(); 91cdf0e10cSrcweir 92cdf0e10cSrcweir ::osl::MutexGuard aGuard(m_aMutex); 93cdf0e10cSrcweir if(m_pRecordSet) 94cdf0e10cSrcweir m_pRecordSet->Close(); 95cdf0e10cSrcweir m_aStatement = NULL; 96cdf0e10cSrcweir m_xMetaData.clear(); 97cdf0e10cSrcweir } 98cdf0e10cSrcweir // ------------------------------------------------------------------------- 99cdf0e10cSrcweir Any SAL_CALL ODatabaseMetaDataResultSet::queryInterface( const Type & rType ) throw(RuntimeException) 100cdf0e10cSrcweir { 101cdf0e10cSrcweir Any aRet = OPropertySetHelper::queryInterface(rType); 102cdf0e10cSrcweir return aRet.hasValue() ? aRet : ODatabaseMetaDataResultSet_BASE::queryInterface(rType); 103cdf0e10cSrcweir } 104cdf0e10cSrcweir // ------------------------------------------------------------------------- 105cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL ODatabaseMetaDataResultSet::getTypes( ) throw(::com::sun::star::uno::RuntimeException) 106cdf0e10cSrcweir { 107cdf0e10cSrcweir ::cppu::OTypeCollection aTypes( ::getCppuType( (const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XMultiPropertySet > *)0 ), 108cdf0e10cSrcweir ::getCppuType( (const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XFastPropertySet > *)0 ), 109cdf0e10cSrcweir ::getCppuType( (const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > *)0 )); 110cdf0e10cSrcweir 111cdf0e10cSrcweir return ::comphelper::concatSequences(aTypes.getTypes(),ODatabaseMetaDataResultSet_BASE::getTypes()); 112cdf0e10cSrcweir } 113cdf0e10cSrcweir // ----------------------------------------------------------------------------- 114cdf0e10cSrcweir void ODatabaseMetaDataResultSet::checkRecordSet() throw(SQLException) 115cdf0e10cSrcweir { 116cdf0e10cSrcweir if(!m_pRecordSet) 117cdf0e10cSrcweir throwFunctionSequenceException(*this); 118cdf0e10cSrcweir } 119cdf0e10cSrcweir // ------------------------------------------------------------------------- 120cdf0e10cSrcweir 121cdf0e10cSrcweir sal_Int32 SAL_CALL ODatabaseMetaDataResultSet::findColumn( const ::rtl::OUString& columnName ) throw(SQLException, RuntimeException) 122cdf0e10cSrcweir { 123cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 124cdf0e10cSrcweir checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed ); 125cdf0e10cSrcweir 126cdf0e10cSrcweir 127cdf0e10cSrcweir Reference< XResultSetMetaData > xMeta = getMetaData(); 128cdf0e10cSrcweir sal_Int32 nLen = xMeta->getColumnCount(); 129cdf0e10cSrcweir sal_Int32 i = 1; 130cdf0e10cSrcweir for(;i<=nLen;++i) 131cdf0e10cSrcweir if(xMeta->isCaseSensitive(i) ? columnName == xMeta->getColumnName(i) : 132cdf0e10cSrcweir columnName.equalsIgnoreAsciiCase(xMeta->getColumnName(i))) 133cdf0e10cSrcweir break; 134cdf0e10cSrcweir return i; 135cdf0e10cSrcweir } 136cdf0e10cSrcweir #define BLOCK_SIZE 256 137cdf0e10cSrcweir // ------------------------------------------------------------------------- 138cdf0e10cSrcweir Reference< ::com::sun::star::io::XInputStream > SAL_CALL ODatabaseMetaDataResultSet::getBinaryStream( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) 139cdf0e10cSrcweir { 140cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 141cdf0e10cSrcweir checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed); 142cdf0e10cSrcweir 143cdf0e10cSrcweir checkRecordSet(); 144cdf0e10cSrcweir 145cdf0e10cSrcweir 146cdf0e10cSrcweir columnIndex = mapColumn(columnIndex); 147cdf0e10cSrcweir WpADOField aField = ADOS::getField(m_pRecordSet,columnIndex); 148cdf0e10cSrcweir if((aField.GetAttributes() & adFldLong) == adFldLong) 149cdf0e10cSrcweir { 150cdf0e10cSrcweir //Copy the data only upto the Actual Size of Field. 151cdf0e10cSrcweir sal_Int32 nSize = aField.GetActualSize(); 152cdf0e10cSrcweir Sequence<sal_Int8> aData(nSize); 153cdf0e10cSrcweir long index = 0; 154cdf0e10cSrcweir while(index < nSize) 155cdf0e10cSrcweir { 156cdf0e10cSrcweir m_aValue = aField.GetChunk(BLOCK_SIZE); 157cdf0e10cSrcweir if(m_aValue.isNull()) 158cdf0e10cSrcweir break; 159cdf0e10cSrcweir UCHAR chData; 160cdf0e10cSrcweir for(long index2 = 0;index2 < BLOCK_SIZE;++index2) 161cdf0e10cSrcweir { 162cdf0e10cSrcweir HRESULT hr = ::SafeArrayGetElement(m_aValue.parray,&index2,&chData); 163cdf0e10cSrcweir if(SUCCEEDED(hr)) 164cdf0e10cSrcweir { 165cdf0e10cSrcweir //Take BYTE by BYTE and advance Memory Location 166cdf0e10cSrcweir aData.getArray()[index++] = chData; 167cdf0e10cSrcweir } 168cdf0e10cSrcweir else 169cdf0e10cSrcweir break; 170cdf0e10cSrcweir } 171cdf0e10cSrcweir } 172cdf0e10cSrcweir return index ? Reference< ::com::sun::star::io::XInputStream >(new SequenceInputStream(aData)) : Reference< ::com::sun::star::io::XInputStream >(); 173cdf0e10cSrcweir } 174cdf0e10cSrcweir // else we ask for a bytesequence 175cdf0e10cSrcweir aField.get_Value(m_aValue); 176cdf0e10cSrcweir if(m_aValue.isNull()) 177cdf0e10cSrcweir return NULL; 178cdf0e10cSrcweir return new SequenceInputStream(m_aValue); 179cdf0e10cSrcweir } 180cdf0e10cSrcweir // ------------------------------------------------------------------------- 181cdf0e10cSrcweir Reference< ::com::sun::star::io::XInputStream > SAL_CALL ODatabaseMetaDataResultSet::getCharacterStream( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException) 182cdf0e10cSrcweir { 183cdf0e10cSrcweir ::dbtools::throwFeatureNotImplementedException( "XRow::getCharacterStream", *this ); 184cdf0e10cSrcweir return NULL; 185cdf0e10cSrcweir } 186cdf0e10cSrcweir 187cdf0e10cSrcweir // ------------------------------------------------------------------------- 188cdf0e10cSrcweir sal_Bool SAL_CALL ODatabaseMetaDataResultSet::getBoolean( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) 189cdf0e10cSrcweir { 190cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 191cdf0e10cSrcweir 192cdf0e10cSrcweir if ( !m_aValueRange.empty() && columnIndex == 11 && (m_aValueRangeIter = m_aValueRange.find(columnIndex)) != m_aValueRange.end() ) 193cdf0e10cSrcweir { 194cdf0e10cSrcweir getValue(2); 195cdf0e10cSrcweir if ( static_cast<sal_Int16>(m_aValue) != adCurrency ) 196cdf0e10cSrcweir return sal_False; 197cdf0e10cSrcweir } 198cdf0e10cSrcweir return getValue(columnIndex); 199cdf0e10cSrcweir } 200cdf0e10cSrcweir // ------------------------------------------------------------------------- 201cdf0e10cSrcweir 202cdf0e10cSrcweir sal_Int8 SAL_CALL ODatabaseMetaDataResultSet::getByte( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) 203cdf0e10cSrcweir { 204cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 205cdf0e10cSrcweir 206cdf0e10cSrcweir getValue(columnIndex); 207cdf0e10cSrcweir 208cdf0e10cSrcweir columnIndex = mapColumn(columnIndex); 209cdf0e10cSrcweir 210cdf0e10cSrcweir if(m_aValue.isNull()) 211cdf0e10cSrcweir return 0; 212cdf0e10cSrcweir if ( !m_aValueRange.empty() && (m_aValueRangeIter = m_aValueRange.find(columnIndex)) != m_aValueRange.end()) 213cdf0e10cSrcweir return (sal_Int8)(*m_aValueRangeIter).second[(sal_Int32)m_aValue]; 214cdf0e10cSrcweir else if(m_aStrValueRange.size() && (m_aStrValueRangeIter = m_aStrValueRange.find(columnIndex)) != m_aStrValueRange.end()) 215cdf0e10cSrcweir return (sal_Int8)(*m_aStrValueRangeIter).second[m_aValue]; 216cdf0e10cSrcweir 217cdf0e10cSrcweir return m_aValue; 218cdf0e10cSrcweir } 219cdf0e10cSrcweir // ------------------------------------------------------------------------- 220cdf0e10cSrcweir 221cdf0e10cSrcweir Sequence< sal_Int8 > SAL_CALL ODatabaseMetaDataResultSet::getBytes( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) 222cdf0e10cSrcweir { 223cdf0e10cSrcweir return getValue(columnIndex); 224cdf0e10cSrcweir } 225cdf0e10cSrcweir // ------------------------------------------------------------------------- 226cdf0e10cSrcweir 227cdf0e10cSrcweir ::com::sun::star::util::Date SAL_CALL ODatabaseMetaDataResultSet::getDate( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) 228cdf0e10cSrcweir { 229cdf0e10cSrcweir return getValue(columnIndex); 230cdf0e10cSrcweir } 231cdf0e10cSrcweir // ------------------------------------------------------------------------- 232cdf0e10cSrcweir 233cdf0e10cSrcweir double SAL_CALL ODatabaseMetaDataResultSet::getDouble( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) 234cdf0e10cSrcweir { 235cdf0e10cSrcweir return getValue(columnIndex); 236cdf0e10cSrcweir } 237cdf0e10cSrcweir // ------------------------------------------------------------------------- 238cdf0e10cSrcweir 239cdf0e10cSrcweir float SAL_CALL ODatabaseMetaDataResultSet::getFloat( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) 240cdf0e10cSrcweir { 241cdf0e10cSrcweir return getValue(columnIndex); 242cdf0e10cSrcweir } 243cdf0e10cSrcweir // ------------------------------------------------------------------------- 244cdf0e10cSrcweir 245cdf0e10cSrcweir sal_Int32 SAL_CALL ODatabaseMetaDataResultSet::getInt( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) 246cdf0e10cSrcweir { 247cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 248cdf0e10cSrcweir 249cdf0e10cSrcweir 250cdf0e10cSrcweir getValue(columnIndex); 251cdf0e10cSrcweir 252cdf0e10cSrcweir columnIndex = mapColumn(columnIndex); 253cdf0e10cSrcweir if(m_aValue.isNull()) 254cdf0e10cSrcweir return 0; 255cdf0e10cSrcweir 256cdf0e10cSrcweir if(m_aValueRange.size() && (m_aValueRangeIter = m_aValueRange.find(columnIndex)) != m_aValueRange.end()) 257cdf0e10cSrcweir return (*m_aValueRangeIter).second[(sal_Int32)m_aValue]; 258cdf0e10cSrcweir else if(m_aStrValueRange.size() && (m_aStrValueRangeIter = m_aStrValueRange.find(columnIndex)) != m_aStrValueRange.end()) 259cdf0e10cSrcweir return (*m_aStrValueRangeIter).second[m_aValue]; 260cdf0e10cSrcweir 261cdf0e10cSrcweir return m_aValue; 262cdf0e10cSrcweir } 263cdf0e10cSrcweir // ------------------------------------------------------------------------- 264cdf0e10cSrcweir 265cdf0e10cSrcweir sal_Int32 SAL_CALL ODatabaseMetaDataResultSet::getRow( ) throw(SQLException, RuntimeException) 266cdf0e10cSrcweir { 267cdf0e10cSrcweir ::dbtools::throwFeatureNotImplementedException( "XResultSet::getRow", *this ); 268cdf0e10cSrcweir return 0; 269cdf0e10cSrcweir } 270cdf0e10cSrcweir // ------------------------------------------------------------------------- 271cdf0e10cSrcweir 272cdf0e10cSrcweir sal_Int64 SAL_CALL ODatabaseMetaDataResultSet::getLong( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException) 273cdf0e10cSrcweir { 274cdf0e10cSrcweir ::dbtools::throwFeatureNotImplementedException( "XRow::getLong", *this ); 275cdf0e10cSrcweir return sal_Int64(0); 276cdf0e10cSrcweir } 277cdf0e10cSrcweir // ------------------------------------------------------------------------- 278cdf0e10cSrcweir 279cdf0e10cSrcweir Reference< XResultSetMetaData > SAL_CALL ODatabaseMetaDataResultSet::getMetaData( ) throw(SQLException, RuntimeException) 280cdf0e10cSrcweir { 281cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 282cdf0e10cSrcweir checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed); 283cdf0e10cSrcweir 284cdf0e10cSrcweir checkRecordSet(); 285cdf0e10cSrcweir 286cdf0e10cSrcweir 287cdf0e10cSrcweir if(!m_xMetaData.is()) 288cdf0e10cSrcweir m_xMetaData = new ODatabaseMetaDataResultSetMetaData(m_pRecordSet,this); 289cdf0e10cSrcweir 290cdf0e10cSrcweir return m_xMetaData; 291cdf0e10cSrcweir } 292cdf0e10cSrcweir // ------------------------------------------------------------------------- 293cdf0e10cSrcweir Reference< XArray > SAL_CALL ODatabaseMetaDataResultSet::getArray( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException) 294cdf0e10cSrcweir { 295cdf0e10cSrcweir ::dbtools::throwFeatureNotImplementedException( "XRow::getRow", *this ); 296cdf0e10cSrcweir return NULL; 297cdf0e10cSrcweir } 298cdf0e10cSrcweir 299cdf0e10cSrcweir // ------------------------------------------------------------------------- 300cdf0e10cSrcweir 301cdf0e10cSrcweir Reference< XClob > SAL_CALL ODatabaseMetaDataResultSet::getClob( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException) 302cdf0e10cSrcweir { 303cdf0e10cSrcweir ::dbtools::throwFeatureNotImplementedException( "XRow::getRow", *this ); 304cdf0e10cSrcweir return NULL; 305cdf0e10cSrcweir } 306cdf0e10cSrcweir // ------------------------------------------------------------------------- 307cdf0e10cSrcweir Reference< XBlob > SAL_CALL ODatabaseMetaDataResultSet::getBlob( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException) 308cdf0e10cSrcweir { 309cdf0e10cSrcweir ::dbtools::throwFeatureNotImplementedException( "XRow::getRow", *this ); 310cdf0e10cSrcweir return NULL; 311cdf0e10cSrcweir } 312cdf0e10cSrcweir // ------------------------------------------------------------------------- 313cdf0e10cSrcweir 314cdf0e10cSrcweir Reference< XRef > SAL_CALL ODatabaseMetaDataResultSet::getRef( sal_Int32 /*columnIndex*/ ) throw(SQLException, RuntimeException) 315cdf0e10cSrcweir { 316cdf0e10cSrcweir ::dbtools::throwFeatureNotImplementedException( "XRow::getRow", *this ); 317cdf0e10cSrcweir return NULL; 318cdf0e10cSrcweir } 319cdf0e10cSrcweir // ------------------------------------------------------------------------- 320cdf0e10cSrcweir 321cdf0e10cSrcweir Any SAL_CALL ODatabaseMetaDataResultSet::getObject( sal_Int32 columnIndex, const Reference< ::com::sun::star::container::XNameAccess >& /*typeMap*/ ) throw(SQLException, RuntimeException) 322cdf0e10cSrcweir { 323cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 324cdf0e10cSrcweir checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed); 325cdf0e10cSrcweir 326cdf0e10cSrcweir checkRecordSet(); 327cdf0e10cSrcweir 328cdf0e10cSrcweir 329cdf0e10cSrcweir columnIndex = mapColumn(columnIndex); 330cdf0e10cSrcweir return Any(); 331cdf0e10cSrcweir } 332cdf0e10cSrcweir // ------------------------------------------------------------------------- 333cdf0e10cSrcweir 334cdf0e10cSrcweir sal_Int16 SAL_CALL ODatabaseMetaDataResultSet::getShort( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) 335cdf0e10cSrcweir { 336cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 337cdf0e10cSrcweir 338cdf0e10cSrcweir getValue(columnIndex); 339cdf0e10cSrcweir 340cdf0e10cSrcweir columnIndex = mapColumn(columnIndex); 341cdf0e10cSrcweir if(m_aValue.isNull()) 342cdf0e10cSrcweir return 0; 343cdf0e10cSrcweir 344cdf0e10cSrcweir if(m_aValueRange.size() && (m_aValueRangeIter = m_aValueRange.find(columnIndex)) != m_aValueRange.end()) 345cdf0e10cSrcweir return (sal_Int16)(*m_aValueRangeIter).second[(sal_Int32)m_aValue]; 346cdf0e10cSrcweir else if(m_aStrValueRange.size() && (m_aStrValueRangeIter = m_aStrValueRange.find(columnIndex)) != m_aStrValueRange.end()) 347cdf0e10cSrcweir return (sal_Int16)(*m_aStrValueRangeIter).second[m_aValue]; 348cdf0e10cSrcweir 349cdf0e10cSrcweir return m_aValue; 350cdf0e10cSrcweir } 351cdf0e10cSrcweir // ------------------------------------------------------------------------- 352cdf0e10cSrcweir 353cdf0e10cSrcweir ::rtl::OUString SAL_CALL ODatabaseMetaDataResultSet::getString( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) 354cdf0e10cSrcweir { 355cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 356cdf0e10cSrcweir 357cdf0e10cSrcweir getValue(columnIndex); 358cdf0e10cSrcweir 359cdf0e10cSrcweir 360cdf0e10cSrcweir columnIndex = mapColumn(columnIndex); 361cdf0e10cSrcweir if(m_aValue.isNull()) 362cdf0e10cSrcweir return ::rtl::OUString(); 363cdf0e10cSrcweir if(m_aIntValueRange.size() && (m_aIntValueRangeIter = m_aIntValueRange.find(columnIndex)) != m_aIntValueRange.end()) 364cdf0e10cSrcweir return (*m_aIntValueRangeIter).second[m_aValue]; 365cdf0e10cSrcweir 366cdf0e10cSrcweir return m_aValue; 367cdf0e10cSrcweir } 368cdf0e10cSrcweir 369cdf0e10cSrcweir // ------------------------------------------------------------------------- 370cdf0e10cSrcweir 371cdf0e10cSrcweir 372cdf0e10cSrcweir ::com::sun::star::util::Time SAL_CALL ODatabaseMetaDataResultSet::getTime( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) 373cdf0e10cSrcweir { 374cdf0e10cSrcweir return getValue(columnIndex); 375cdf0e10cSrcweir } 376cdf0e10cSrcweir // ------------------------------------------------------------------------- 377cdf0e10cSrcweir 378cdf0e10cSrcweir 379cdf0e10cSrcweir ::com::sun::star::util::DateTime SAL_CALL ODatabaseMetaDataResultSet::getTimestamp( sal_Int32 columnIndex ) throw(SQLException, RuntimeException) 380cdf0e10cSrcweir { 381cdf0e10cSrcweir return getValue(columnIndex); 382cdf0e10cSrcweir } 383cdf0e10cSrcweir // ------------------------------------------------------------------------- 384cdf0e10cSrcweir 385cdf0e10cSrcweir sal_Bool SAL_CALL ODatabaseMetaDataResultSet::isAfterLast( ) throw(SQLException, RuntimeException) 386cdf0e10cSrcweir { 387cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 388cdf0e10cSrcweir checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed); 389cdf0e10cSrcweir 390cdf0e10cSrcweir checkRecordSet(); 391cdf0e10cSrcweir 392cdf0e10cSrcweir 393cdf0e10cSrcweir VARIANT_BOOL bIsAtEOF; 394cdf0e10cSrcweir m_pRecordSet->get_EOF(&bIsAtEOF); 395cdf0e10cSrcweir return bIsAtEOF == VARIANT_TRUE; 396cdf0e10cSrcweir } 397cdf0e10cSrcweir // ------------------------------------------------------------------------- 398cdf0e10cSrcweir sal_Bool SAL_CALL ODatabaseMetaDataResultSet::isFirst( ) throw(SQLException, RuntimeException) 399cdf0e10cSrcweir { 400cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 401cdf0e10cSrcweir checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed); 402cdf0e10cSrcweir 403cdf0e10cSrcweir checkRecordSet(); 404cdf0e10cSrcweir 405cdf0e10cSrcweir 406cdf0e10cSrcweir return m_nRowPos == 1; 407cdf0e10cSrcweir } 408cdf0e10cSrcweir // ------------------------------------------------------------------------- 409cdf0e10cSrcweir sal_Bool SAL_CALL ODatabaseMetaDataResultSet::isLast( ) throw(SQLException, RuntimeException) 410cdf0e10cSrcweir { 411cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 412cdf0e10cSrcweir checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed); 413cdf0e10cSrcweir 414cdf0e10cSrcweir checkRecordSet(); 415cdf0e10cSrcweir 416cdf0e10cSrcweir 417cdf0e10cSrcweir return sal_True; 418cdf0e10cSrcweir } 419cdf0e10cSrcweir // ------------------------------------------------------------------------- 420cdf0e10cSrcweir void SAL_CALL ODatabaseMetaDataResultSet::beforeFirst( ) throw(SQLException, RuntimeException) 421cdf0e10cSrcweir { 422cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 423cdf0e10cSrcweir checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed); 424cdf0e10cSrcweir 425cdf0e10cSrcweir checkRecordSet(); 426cdf0e10cSrcweir 427cdf0e10cSrcweir 428cdf0e10cSrcweir if(first()) 429cdf0e10cSrcweir previous(); 430cdf0e10cSrcweir } 431cdf0e10cSrcweir // ------------------------------------------------------------------------- 432cdf0e10cSrcweir void SAL_CALL ODatabaseMetaDataResultSet::afterLast( ) throw(SQLException, RuntimeException) 433cdf0e10cSrcweir { 434cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 435cdf0e10cSrcweir checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed); 436cdf0e10cSrcweir 437cdf0e10cSrcweir checkRecordSet(); 438cdf0e10cSrcweir 439cdf0e10cSrcweir 440cdf0e10cSrcweir if(last()) 441cdf0e10cSrcweir next(); 442cdf0e10cSrcweir m_bEOF = sal_True; 443cdf0e10cSrcweir } 444cdf0e10cSrcweir // ------------------------------------------------------------------------- 445cdf0e10cSrcweir 446cdf0e10cSrcweir void SAL_CALL ODatabaseMetaDataResultSet::close( ) throw(SQLException, RuntimeException) 447cdf0e10cSrcweir { 448cdf0e10cSrcweir { 449cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 450cdf0e10cSrcweir checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed); 451cdf0e10cSrcweir 452cdf0e10cSrcweir } 453cdf0e10cSrcweir dispose(); 454cdf0e10cSrcweir } 455cdf0e10cSrcweir // ------------------------------------------------------------------------- 456cdf0e10cSrcweir 457cdf0e10cSrcweir sal_Bool SAL_CALL ODatabaseMetaDataResultSet::first( ) throw(SQLException, RuntimeException) 458cdf0e10cSrcweir { 459cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 460cdf0e10cSrcweir checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed); 461cdf0e10cSrcweir 462cdf0e10cSrcweir 463cdf0e10cSrcweir if(!m_pRecordSet) 464cdf0e10cSrcweir return sal_False; 465cdf0e10cSrcweir 466cdf0e10cSrcweir sal_Bool bRet = SUCCEEDED(m_pRecordSet->MoveFirst()); 467cdf0e10cSrcweir if ( bRet ) 468cdf0e10cSrcweir m_nRowPos = 1; 469cdf0e10cSrcweir return bRet; 470cdf0e10cSrcweir } 471cdf0e10cSrcweir // ------------------------------------------------------------------------- 472cdf0e10cSrcweir 473cdf0e10cSrcweir sal_Bool SAL_CALL ODatabaseMetaDataResultSet::last( ) throw(SQLException, RuntimeException) 474cdf0e10cSrcweir { 475cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 476cdf0e10cSrcweir checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed ); 477cdf0e10cSrcweir 478cdf0e10cSrcweir 479cdf0e10cSrcweir return m_pRecordSet && SUCCEEDED(m_pRecordSet->MoveLast()) ? sal_True : sal_False; 480cdf0e10cSrcweir } 481cdf0e10cSrcweir // ------------------------------------------------------------------------- 482cdf0e10cSrcweir sal_Bool SAL_CALL ODatabaseMetaDataResultSet::absolute( sal_Int32 row ) throw(SQLException, RuntimeException) 483cdf0e10cSrcweir { 484cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 485cdf0e10cSrcweir checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed); 486cdf0e10cSrcweir 487cdf0e10cSrcweir 488cdf0e10cSrcweir if(first()) 489cdf0e10cSrcweir { 490cdf0e10cSrcweir OLEVariant aEmpty; 491cdf0e10cSrcweir aEmpty.setNoArg(); 492cdf0e10cSrcweir sal_Bool bRet = SUCCEEDED(m_pRecordSet->Move(row,aEmpty)); 493cdf0e10cSrcweir if(bRet) 494cdf0e10cSrcweir m_nRowPos = row; 495cdf0e10cSrcweir return bRet; 496cdf0e10cSrcweir } 497cdf0e10cSrcweir return sal_False; 498cdf0e10cSrcweir } 499cdf0e10cSrcweir // ------------------------------------------------------------------------- 500cdf0e10cSrcweir sal_Bool SAL_CALL ODatabaseMetaDataResultSet::relative( sal_Int32 row ) throw(SQLException, RuntimeException) 501cdf0e10cSrcweir { 502cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 503cdf0e10cSrcweir checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed); 504cdf0e10cSrcweir 505cdf0e10cSrcweir 506cdf0e10cSrcweir if(!m_pRecordSet) 507cdf0e10cSrcweir return sal_False; 508cdf0e10cSrcweir 509cdf0e10cSrcweir OLEVariant aEmpty; 510cdf0e10cSrcweir aEmpty.setNoArg(); 511cdf0e10cSrcweir sal_Bool bRet = SUCCEEDED(m_pRecordSet->Move(row,aEmpty)); 512cdf0e10cSrcweir if(bRet) 513cdf0e10cSrcweir m_nRowPos += row; 514cdf0e10cSrcweir return bRet; 515cdf0e10cSrcweir } 516cdf0e10cSrcweir // ------------------------------------------------------------------------- 517cdf0e10cSrcweir sal_Bool SAL_CALL ODatabaseMetaDataResultSet::previous( ) throw(SQLException, RuntimeException) 518cdf0e10cSrcweir { 519cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 520cdf0e10cSrcweir checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed); 521cdf0e10cSrcweir 522cdf0e10cSrcweir 523cdf0e10cSrcweir if(!m_pRecordSet) 524cdf0e10cSrcweir return sal_False; 525cdf0e10cSrcweir 526cdf0e10cSrcweir sal_Bool bRet = SUCCEEDED(m_pRecordSet->MovePrevious()); 527cdf0e10cSrcweir if(bRet) 528cdf0e10cSrcweir --m_nRowPos; 529cdf0e10cSrcweir return bRet; 530cdf0e10cSrcweir } 531cdf0e10cSrcweir // ------------------------------------------------------------------------- 532cdf0e10cSrcweir Reference< XInterface > SAL_CALL ODatabaseMetaDataResultSet::getStatement( ) throw(SQLException, RuntimeException) 533cdf0e10cSrcweir { 534cdf0e10cSrcweir return m_aStatement.get(); 535cdf0e10cSrcweir } 536cdf0e10cSrcweir // ------------------------------------------------------------------------- 537cdf0e10cSrcweir 538cdf0e10cSrcweir sal_Bool SAL_CALL ODatabaseMetaDataResultSet::rowDeleted( ) throw(SQLException, RuntimeException) 539cdf0e10cSrcweir { 540cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 541cdf0e10cSrcweir checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed); 542cdf0e10cSrcweir 543cdf0e10cSrcweir checkRecordSet(); 544cdf0e10cSrcweir 545cdf0e10cSrcweir 546cdf0e10cSrcweir RecordStatusEnum eRec; 547cdf0e10cSrcweir m_pRecordSet->get_Status((sal_Int32*)&eRec); 548cdf0e10cSrcweir return (eRec & adRecDeleted) == adRecDeleted; 549cdf0e10cSrcweir } 550cdf0e10cSrcweir // ------------------------------------------------------------------------- 551cdf0e10cSrcweir sal_Bool SAL_CALL ODatabaseMetaDataResultSet::rowInserted( ) throw(SQLException, RuntimeException) 552cdf0e10cSrcweir { ::osl::MutexGuard aGuard( m_aMutex ); 553cdf0e10cSrcweir checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed); 554cdf0e10cSrcweir 555cdf0e10cSrcweir checkRecordSet(); 556cdf0e10cSrcweir 557cdf0e10cSrcweir 558cdf0e10cSrcweir RecordStatusEnum eRec; 559cdf0e10cSrcweir m_pRecordSet->get_Status((sal_Int32*)&eRec); 560cdf0e10cSrcweir return (eRec & adRecNew) == adRecNew; 561cdf0e10cSrcweir } 562cdf0e10cSrcweir // ------------------------------------------------------------------------- 563cdf0e10cSrcweir sal_Bool SAL_CALL ODatabaseMetaDataResultSet::rowUpdated( ) throw(SQLException, RuntimeException) 564cdf0e10cSrcweir { 565cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 566cdf0e10cSrcweir checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed); 567cdf0e10cSrcweir 568cdf0e10cSrcweir checkRecordSet(); 569cdf0e10cSrcweir 570cdf0e10cSrcweir 571cdf0e10cSrcweir RecordStatusEnum eRec; 572cdf0e10cSrcweir m_pRecordSet->get_Status((sal_Int32*)&eRec); 573cdf0e10cSrcweir return (eRec & adRecModified) == adRecModified; 574cdf0e10cSrcweir } 575cdf0e10cSrcweir // ------------------------------------------------------------------------- 576cdf0e10cSrcweir 577cdf0e10cSrcweir sal_Bool SAL_CALL ODatabaseMetaDataResultSet::isBeforeFirst( ) throw(SQLException, RuntimeException) 578cdf0e10cSrcweir { 579cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 580cdf0e10cSrcweir checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed); 581cdf0e10cSrcweir 582cdf0e10cSrcweir 583cdf0e10cSrcweir if(!m_pRecordSet) 584cdf0e10cSrcweir return sal_True; 585cdf0e10cSrcweir 586cdf0e10cSrcweir VARIANT_BOOL bIsAtBOF; 587cdf0e10cSrcweir m_pRecordSet->get_BOF(&bIsAtBOF); 588cdf0e10cSrcweir return bIsAtBOF == VARIANT_TRUE; 589cdf0e10cSrcweir } 590cdf0e10cSrcweir // ------------------------------------------------------------------------- 591cdf0e10cSrcweir 592cdf0e10cSrcweir sal_Bool SAL_CALL ODatabaseMetaDataResultSet::next( ) throw(SQLException, RuntimeException) 593cdf0e10cSrcweir { 594cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 595cdf0e10cSrcweir checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed); 596cdf0e10cSrcweir 597cdf0e10cSrcweir 598cdf0e10cSrcweir if(!m_pRecordSet) 599cdf0e10cSrcweir return sal_False; 600cdf0e10cSrcweir 601cdf0e10cSrcweir if(m_bOnFirstAfterOpen) 602cdf0e10cSrcweir { 603cdf0e10cSrcweir m_bOnFirstAfterOpen = sal_False; 604cdf0e10cSrcweir return sal_True; 605cdf0e10cSrcweir } 606cdf0e10cSrcweir else 607cdf0e10cSrcweir return SUCCEEDED(m_pRecordSet->MoveNext()); 608cdf0e10cSrcweir } 609cdf0e10cSrcweir // ------------------------------------------------------------------------- 610cdf0e10cSrcweir 611cdf0e10cSrcweir sal_Bool SAL_CALL ODatabaseMetaDataResultSet::wasNull( ) throw(SQLException, RuntimeException) 612cdf0e10cSrcweir { 613cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 614cdf0e10cSrcweir checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed); 615cdf0e10cSrcweir 616cdf0e10cSrcweir checkRecordSet(); 617cdf0e10cSrcweir 618cdf0e10cSrcweir 619cdf0e10cSrcweir return m_aValue.isNull(); 620cdf0e10cSrcweir } 621cdf0e10cSrcweir // ------------------------------------------------------------------------- 622cdf0e10cSrcweir void SAL_CALL ODatabaseMetaDataResultSet::refreshRow( ) throw(SQLException, RuntimeException) 623cdf0e10cSrcweir { 624cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 625cdf0e10cSrcweir checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed); 626cdf0e10cSrcweir 627cdf0e10cSrcweir checkRecordSet(); 628cdf0e10cSrcweir 629cdf0e10cSrcweir 630cdf0e10cSrcweir m_pRecordSet->Resync(adAffectCurrent,adResyncAllValues); 631cdf0e10cSrcweir } 632cdf0e10cSrcweir // ------------------------------------------------------------------------- 633cdf0e10cSrcweir 634cdf0e10cSrcweir void SAL_CALL ODatabaseMetaDataResultSet::cancel( ) throw(RuntimeException) 635cdf0e10cSrcweir { 636cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 637cdf0e10cSrcweir checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed); 638cdf0e10cSrcweir 639cdf0e10cSrcweir checkRecordSet(); 640cdf0e10cSrcweir 641cdf0e10cSrcweir 642cdf0e10cSrcweir m_pRecordSet->Cancel(); 643cdf0e10cSrcweir } 644cdf0e10cSrcweir // ------------------------------------------------------------------------- 645cdf0e10cSrcweir void SAL_CALL ODatabaseMetaDataResultSet::clearWarnings( ) throw(SQLException, RuntimeException) 646cdf0e10cSrcweir { 647cdf0e10cSrcweir } 648cdf0e10cSrcweir // ------------------------------------------------------------------------- 649cdf0e10cSrcweir Any SAL_CALL ODatabaseMetaDataResultSet::getWarnings( ) throw(SQLException, RuntimeException) 650cdf0e10cSrcweir { 651cdf0e10cSrcweir return Any(); 652cdf0e10cSrcweir } 653cdf0e10cSrcweir //------------------------------------------------------------------------------ 654cdf0e10cSrcweir sal_Int32 ODatabaseMetaDataResultSet::getResultSetConcurrency() const 655cdf0e10cSrcweir throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) 656cdf0e10cSrcweir { 657cdf0e10cSrcweir return ResultSetConcurrency::READ_ONLY; 658cdf0e10cSrcweir } 659cdf0e10cSrcweir //------------------------------------------------------------------------------ 660cdf0e10cSrcweir sal_Int32 ODatabaseMetaDataResultSet::getResultSetType() const 661cdf0e10cSrcweir throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) 662cdf0e10cSrcweir { 663cdf0e10cSrcweir return ResultSetType::FORWARD_ONLY; 664cdf0e10cSrcweir } 665cdf0e10cSrcweir //------------------------------------------------------------------------------ 666cdf0e10cSrcweir sal_Int32 ODatabaseMetaDataResultSet::getFetchDirection() const 667cdf0e10cSrcweir throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) 668cdf0e10cSrcweir { 669cdf0e10cSrcweir return FetchDirection::FORWARD; 670cdf0e10cSrcweir } 671cdf0e10cSrcweir //------------------------------------------------------------------------------ 672cdf0e10cSrcweir sal_Int32 ODatabaseMetaDataResultSet::getFetchSize() const 673cdf0e10cSrcweir throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) 674cdf0e10cSrcweir { 675cdf0e10cSrcweir sal_Int32 nValue=-1; 676cdf0e10cSrcweir if(m_pRecordSet) 677cdf0e10cSrcweir m_pRecordSet->get_CacheSize(&nValue); 678cdf0e10cSrcweir return nValue; 679cdf0e10cSrcweir } 680cdf0e10cSrcweir //------------------------------------------------------------------------------ 681cdf0e10cSrcweir ::rtl::OUString ODatabaseMetaDataResultSet::getCursorName() const 682cdf0e10cSrcweir throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) 683cdf0e10cSrcweir { 684cdf0e10cSrcweir return ::rtl::OUString(); 685cdf0e10cSrcweir } 686cdf0e10cSrcweir 687cdf0e10cSrcweir //------------------------------------------------------------------------------ 688cdf0e10cSrcweir void ODatabaseMetaDataResultSet::setFetchDirection(sal_Int32 /*_par0*/) 689cdf0e10cSrcweir throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) 690cdf0e10cSrcweir { 691cdf0e10cSrcweir ::dbtools::throwFeatureNotImplementedException( "ResultSet::FetchDirection", *this ); 692cdf0e10cSrcweir } 693cdf0e10cSrcweir //------------------------------------------------------------------------------ 694cdf0e10cSrcweir void ODatabaseMetaDataResultSet::setFetchSize(sal_Int32 _par0) 695cdf0e10cSrcweir throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) 696cdf0e10cSrcweir { 697cdf0e10cSrcweir if(m_pRecordSet) 698cdf0e10cSrcweir m_pRecordSet->put_CacheSize(_par0); 699cdf0e10cSrcweir } 700cdf0e10cSrcweir // ------------------------------------------------------------------------- 701cdf0e10cSrcweir ::cppu::IPropertyArrayHelper* ODatabaseMetaDataResultSet::createArrayHelper( ) const 702cdf0e10cSrcweir { 703cdf0e10cSrcweir 704cdf0e10cSrcweir Sequence< com::sun::star::beans::Property > aProps(5); 705cdf0e10cSrcweir com::sun::star::beans::Property* pProperties = aProps.getArray(); 706cdf0e10cSrcweir sal_Int32 nPos = 0; 707cdf0e10cSrcweir DECL_PROP0(CURSORNAME, ::rtl::OUString); 708cdf0e10cSrcweir DECL_PROP0(FETCHDIRECTION, sal_Int32); 709cdf0e10cSrcweir DECL_PROP0(FETCHSIZE, sal_Int32); 710cdf0e10cSrcweir DECL_PROP0(RESULTSETCONCURRENCY,sal_Int32); 711cdf0e10cSrcweir DECL_PROP0(RESULTSETTYPE, sal_Int32); 712cdf0e10cSrcweir 713cdf0e10cSrcweir return new ::cppu::OPropertyArrayHelper(aProps); 714cdf0e10cSrcweir } 715cdf0e10cSrcweir // ------------------------------------------------------------------------- 716cdf0e10cSrcweir ::cppu::IPropertyArrayHelper & ODatabaseMetaDataResultSet::getInfoHelper() 717cdf0e10cSrcweir { 718cdf0e10cSrcweir return *const_cast<ODatabaseMetaDataResultSet*>(this)->getArrayHelper(); 719cdf0e10cSrcweir } 720cdf0e10cSrcweir // ------------------------------------------------------------------------- 721cdf0e10cSrcweir sal_Bool ODatabaseMetaDataResultSet::convertFastPropertyValue( 722cdf0e10cSrcweir Any & rConvertedValue, 723cdf0e10cSrcweir Any & rOldValue, 724cdf0e10cSrcweir sal_Int32 nHandle, 725cdf0e10cSrcweir const Any& rValue ) 726cdf0e10cSrcweir throw (::com::sun::star::lang::IllegalArgumentException) 727cdf0e10cSrcweir { 728cdf0e10cSrcweir switch(nHandle) 729cdf0e10cSrcweir { 730cdf0e10cSrcweir case PROPERTY_ID_CURSORNAME: 731cdf0e10cSrcweir case PROPERTY_ID_RESULTSETCONCURRENCY: 732cdf0e10cSrcweir case PROPERTY_ID_RESULTSETTYPE: 733cdf0e10cSrcweir throw ::com::sun::star::lang::IllegalArgumentException(); 734cdf0e10cSrcweir break; 735cdf0e10cSrcweir case PROPERTY_ID_FETCHDIRECTION: 736cdf0e10cSrcweir return ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, getFetchDirection()); 737cdf0e10cSrcweir case PROPERTY_ID_FETCHSIZE: 738cdf0e10cSrcweir return ::comphelper::tryPropertyValue(rConvertedValue, rOldValue, rValue, getFetchSize()); 739cdf0e10cSrcweir default: 740cdf0e10cSrcweir ; 741cdf0e10cSrcweir } 742cdf0e10cSrcweir return sal_False; 743cdf0e10cSrcweir } 744cdf0e10cSrcweir // ------------------------------------------------------------------------- 745cdf0e10cSrcweir void ODatabaseMetaDataResultSet::setFastPropertyValue_NoBroadcast( 746cdf0e10cSrcweir sal_Int32 nHandle, 747cdf0e10cSrcweir const Any& /*rValue*/ 748cdf0e10cSrcweir ) 749cdf0e10cSrcweir throw (Exception) 750cdf0e10cSrcweir { 751cdf0e10cSrcweir switch(nHandle) 752cdf0e10cSrcweir { 753cdf0e10cSrcweir case PROPERTY_ID_CURSORNAME: 754cdf0e10cSrcweir case PROPERTY_ID_RESULTSETCONCURRENCY: 755cdf0e10cSrcweir case PROPERTY_ID_RESULTSETTYPE: 756cdf0e10cSrcweir case PROPERTY_ID_FETCHDIRECTION: 757cdf0e10cSrcweir case PROPERTY_ID_FETCHSIZE: 758cdf0e10cSrcweir throw Exception(); 759cdf0e10cSrcweir break; 760cdf0e10cSrcweir default: 761cdf0e10cSrcweir OSL_ENSURE(0,"setFastPropertyValue_NoBroadcast: Illegal handle value!"); 762cdf0e10cSrcweir } 763cdf0e10cSrcweir } 764cdf0e10cSrcweir // ------------------------------------------------------------------------- 765cdf0e10cSrcweir void ODatabaseMetaDataResultSet::getFastPropertyValue( 766cdf0e10cSrcweir Any& rValue, 767cdf0e10cSrcweir sal_Int32 nHandle 768cdf0e10cSrcweir ) const 769cdf0e10cSrcweir { 770cdf0e10cSrcweir switch(nHandle) 771cdf0e10cSrcweir { 772cdf0e10cSrcweir case PROPERTY_ID_CURSORNAME: 773cdf0e10cSrcweir rValue <<= getCursorName(); 774cdf0e10cSrcweir break; 775cdf0e10cSrcweir case PROPERTY_ID_RESULTSETCONCURRENCY: 776cdf0e10cSrcweir rValue <<= getResultSetConcurrency(); 777cdf0e10cSrcweir break; 778cdf0e10cSrcweir case PROPERTY_ID_RESULTSETTYPE: 779cdf0e10cSrcweir rValue <<= getResultSetType(); 780cdf0e10cSrcweir break; 781cdf0e10cSrcweir case PROPERTY_ID_FETCHDIRECTION: 782cdf0e10cSrcweir rValue <<= getFetchDirection(); 783cdf0e10cSrcweir break; 784cdf0e10cSrcweir case PROPERTY_ID_FETCHSIZE: 785cdf0e10cSrcweir rValue <<= getFetchSize(); 786cdf0e10cSrcweir break; 787cdf0e10cSrcweir } 788cdf0e10cSrcweir } 789cdf0e10cSrcweir // ------------------------------------------------------------------------- 790cdf0e10cSrcweir void ODatabaseMetaDataResultSet::setProceduresMap() 791cdf0e10cSrcweir { 792cdf0e10cSrcweir 793cdf0e10cSrcweir for(sal_Int32 i=1;i<4;i++) 794cdf0e10cSrcweir m_aColMapping.push_back(i); 795cdf0e10cSrcweir m_aColMapping.push_back(5); 796cdf0e10cSrcweir m_aColMapping.push_back(7); 797cdf0e10cSrcweir m_aColMapping.push_back(8); 798cdf0e10cSrcweir m_aColMapping.push_back(6); 799cdf0e10cSrcweir m_aColMapping.push_back(4); 800cdf0e10cSrcweir 801cdf0e10cSrcweir TInt2IntMap aMap; 802cdf0e10cSrcweir aMap[DB_PT_UNKNOWN] = ProcedureResult::UNKNOWN; 803cdf0e10cSrcweir aMap[DB_PT_PROCEDURE] = ProcedureResult::NONE; 804cdf0e10cSrcweir aMap[DB_PT_FUNCTION] = ProcedureResult::RETURN; 805cdf0e10cSrcweir m_aValueRange[4] = aMap; 806cdf0e10cSrcweir 807cdf0e10cSrcweir ODatabaseMetaDataResultSetMetaData* pMetaData = new ODatabaseMetaDataResultSetMetaData(m_pRecordSet,this); 808cdf0e10cSrcweir pMetaData->setProceduresMap(); 809cdf0e10cSrcweir m_xMetaData = pMetaData; 810cdf0e10cSrcweir } 811cdf0e10cSrcweir // ------------------------------------------------------------------------- 812cdf0e10cSrcweir void ODatabaseMetaDataResultSet::setCatalogsMap() 813cdf0e10cSrcweir { 814cdf0e10cSrcweir m_aColMapping.push_back(1); 815cdf0e10cSrcweir 816cdf0e10cSrcweir m_xMetaData = new ODatabaseMetaDataResultSetMetaData(m_pRecordSet,this); 817cdf0e10cSrcweir } 818cdf0e10cSrcweir // ------------------------------------------------------------------------- 819cdf0e10cSrcweir void ODatabaseMetaDataResultSet::setSchemasMap() 820cdf0e10cSrcweir { 821cdf0e10cSrcweir m_aColMapping.push_back(2); 822cdf0e10cSrcweir 823cdf0e10cSrcweir m_xMetaData = new ODatabaseMetaDataResultSetMetaData(m_pRecordSet,this); 824cdf0e10cSrcweir } 825cdf0e10cSrcweir // ------------------------------------------------------------------------- 826cdf0e10cSrcweir void ODatabaseMetaDataResultSet::setColumnPrivilegesMap() 827cdf0e10cSrcweir { 828cdf0e10cSrcweir 829cdf0e10cSrcweir m_aColMapping.push_back(3); 830cdf0e10cSrcweir m_aColMapping.push_back(4); 831cdf0e10cSrcweir m_aColMapping.push_back(5); 832cdf0e10cSrcweir m_aColMapping.push_back(6); 833cdf0e10cSrcweir m_aColMapping.push_back(2); 834cdf0e10cSrcweir m_aColMapping.push_back(9); 835cdf0e10cSrcweir m_aColMapping.push_back(10); 836cdf0e10cSrcweir 837cdf0e10cSrcweir ODatabaseMetaDataResultSetMetaData* pMetaData = new ODatabaseMetaDataResultSetMetaData(m_pRecordSet,this); 838cdf0e10cSrcweir pMetaData->setColumnPrivilegesMap(); 839cdf0e10cSrcweir m_xMetaData = pMetaData; 840cdf0e10cSrcweir } 841cdf0e10cSrcweir // ------------------------------------------------------------------------- 842cdf0e10cSrcweir void ODatabaseMetaDataResultSet::setColumnsMap() 843cdf0e10cSrcweir { 844cdf0e10cSrcweir 845cdf0e10cSrcweir for(sal_Int32 i=1;i<5;++i) 846cdf0e10cSrcweir m_aColMapping.push_back(i); 847cdf0e10cSrcweir 848cdf0e10cSrcweir m_aColMapping.push_back(12); 849cdf0e10cSrcweir m_aColMapping.push_back(12); // is used as TYPE_NAME 850cdf0e10cSrcweir 851cdf0e10cSrcweir m_aColMapping.push_back(14); 852cdf0e10cSrcweir m_aColMapping.push_back(6); 853cdf0e10cSrcweir m_aColMapping.push_back(17); 854cdf0e10cSrcweir m_aColMapping.push_back(18); 855cdf0e10cSrcweir 856cdf0e10cSrcweir m_aColMapping.push_back(11); 857cdf0e10cSrcweir m_aColMapping.push_back(29); 858cdf0e10cSrcweir m_aColMapping.push_back(9); 859cdf0e10cSrcweir m_aColMapping.push_back(18); 860cdf0e10cSrcweir m_aColMapping.push_back(18); 861cdf0e10cSrcweir 862cdf0e10cSrcweir m_aColMapping.push_back(15); 863cdf0e10cSrcweir m_aColMapping.push_back(7); 864cdf0e10cSrcweir m_aColMapping.push_back(11); 865cdf0e10cSrcweir 866cdf0e10cSrcweir TInt2IntMap aMap; 867cdf0e10cSrcweir aMap[adEmpty] = ADOS::MapADOType2Jdbc(adEmpty); 868cdf0e10cSrcweir aMap[adTinyInt] = ADOS::MapADOType2Jdbc(adTinyInt); 869cdf0e10cSrcweir aMap[adSmallInt] = ADOS::MapADOType2Jdbc(adSmallInt); 870cdf0e10cSrcweir aMap[adInteger] = ADOS::MapADOType2Jdbc(adInteger); 871cdf0e10cSrcweir aMap[adBigInt] = ADOS::MapADOType2Jdbc(adBigInt); 872cdf0e10cSrcweir aMap[adUnsignedTinyInt] = ADOS::MapADOType2Jdbc(adUnsignedTinyInt); 873cdf0e10cSrcweir aMap[adUnsignedSmallInt]= ADOS::MapADOType2Jdbc(adUnsignedSmallInt); 874cdf0e10cSrcweir aMap[adUnsignedInt] = ADOS::MapADOType2Jdbc(adUnsignedInt); 875cdf0e10cSrcweir aMap[adUnsignedBigInt] = ADOS::MapADOType2Jdbc(adUnsignedBigInt); 876cdf0e10cSrcweir aMap[adSingle] = ADOS::MapADOType2Jdbc(adSingle); 877cdf0e10cSrcweir aMap[adDouble] = ADOS::MapADOType2Jdbc(adDouble); 878cdf0e10cSrcweir aMap[adCurrency] = ADOS::MapADOType2Jdbc(adCurrency); 879cdf0e10cSrcweir aMap[adDecimal] = ADOS::MapADOType2Jdbc(adDecimal); 880cdf0e10cSrcweir aMap[adNumeric] = ADOS::MapADOType2Jdbc(adNumeric); 881cdf0e10cSrcweir aMap[adBoolean] = ADOS::MapADOType2Jdbc(adBoolean); 882cdf0e10cSrcweir aMap[adError] = ADOS::MapADOType2Jdbc(adError); 883cdf0e10cSrcweir aMap[adUserDefined] = ADOS::MapADOType2Jdbc(adUserDefined); 884cdf0e10cSrcweir aMap[adVariant] = ADOS::MapADOType2Jdbc(adVariant); 885cdf0e10cSrcweir aMap[adIDispatch] = ADOS::MapADOType2Jdbc(adIDispatch); 886cdf0e10cSrcweir aMap[adIUnknown] = ADOS::MapADOType2Jdbc(adIUnknown); 887cdf0e10cSrcweir aMap[adGUID] = ADOS::MapADOType2Jdbc(adGUID); 888cdf0e10cSrcweir aMap[adDate] = ADOS::MapADOType2Jdbc(adDate); 889cdf0e10cSrcweir aMap[adDBDate] = ADOS::MapADOType2Jdbc(adDBDate); 890cdf0e10cSrcweir aMap[adDBTime] = ADOS::MapADOType2Jdbc(adDBTime); 891cdf0e10cSrcweir aMap[adDBTimeStamp] = ADOS::MapADOType2Jdbc(adDBTimeStamp); 892cdf0e10cSrcweir aMap[adBSTR] = ADOS::MapADOType2Jdbc(adBSTR); 893cdf0e10cSrcweir aMap[adChar] = ADOS::MapADOType2Jdbc(adChar); 894cdf0e10cSrcweir aMap[adVarChar] = ADOS::MapADOType2Jdbc(adVarChar); 895cdf0e10cSrcweir aMap[adLongVarChar] = ADOS::MapADOType2Jdbc(adLongVarChar); 896cdf0e10cSrcweir aMap[adWChar] = ADOS::MapADOType2Jdbc(adWChar); 897cdf0e10cSrcweir aMap[adVarWChar] = ADOS::MapADOType2Jdbc(adVarWChar); 898cdf0e10cSrcweir aMap[adLongVarWChar] = ADOS::MapADOType2Jdbc(adLongVarWChar); 899cdf0e10cSrcweir aMap[adBinary] = ADOS::MapADOType2Jdbc(adBinary); 900cdf0e10cSrcweir aMap[adVarBinary] = ADOS::MapADOType2Jdbc(adVarBinary); 901cdf0e10cSrcweir aMap[adLongVarBinary] = ADOS::MapADOType2Jdbc(adLongVarBinary); 902cdf0e10cSrcweir aMap[adChapter] = ADOS::MapADOType2Jdbc(adChapter); 903cdf0e10cSrcweir aMap[adFileTime] = ADOS::MapADOType2Jdbc(adFileTime); 904cdf0e10cSrcweir aMap[adPropVariant] = ADOS::MapADOType2Jdbc(adPropVariant); 905cdf0e10cSrcweir aMap[adVarNumeric] = ADOS::MapADOType2Jdbc(adVarNumeric); 906cdf0e10cSrcweir // aMap[adArray] = ADOS::MapADOType2Jdbc(adArray); 907cdf0e10cSrcweir 908cdf0e10cSrcweir m_aValueRange[12] = aMap; 909cdf0e10cSrcweir 910cdf0e10cSrcweir ::std::map< sal_Int32,::rtl::OUString> aMap2; 911cdf0e10cSrcweir aMap2[0] = ::rtl::OUString::createFromAscii("YES"); 912cdf0e10cSrcweir aMap2[1] = ::rtl::OUString::createFromAscii("NO"); 913cdf0e10cSrcweir m_aIntValueRange[18] = aMap2; 914cdf0e10cSrcweir 915cdf0e10cSrcweir ODatabaseMetaDataResultSetMetaData* pMetaData = new ODatabaseMetaDataResultSetMetaData(m_pRecordSet,this); 916cdf0e10cSrcweir pMetaData->setColumnsMap(); 917cdf0e10cSrcweir m_xMetaData = pMetaData; 918cdf0e10cSrcweir } 919cdf0e10cSrcweir // ------------------------------------------------------------------------- 920cdf0e10cSrcweir void ODatabaseMetaDataResultSet::setTablesMap() 921cdf0e10cSrcweir { 922cdf0e10cSrcweir 923cdf0e10cSrcweir for(sal_Int32 i=1;i<5;i++) 924cdf0e10cSrcweir m_aColMapping.push_back(i); 925cdf0e10cSrcweir m_aColMapping.push_back(6); 926cdf0e10cSrcweir 927cdf0e10cSrcweir ODatabaseMetaDataResultSetMetaData* pMetaData = new ODatabaseMetaDataResultSetMetaData(m_pRecordSet,this); 928cdf0e10cSrcweir pMetaData->setTablesMap(); 929cdf0e10cSrcweir m_xMetaData = pMetaData; 930cdf0e10cSrcweir } 931cdf0e10cSrcweir // ------------------------------------------------------------------------- 932cdf0e10cSrcweir void ODatabaseMetaDataResultSet::setProcedureColumnsMap() 933cdf0e10cSrcweir { 934cdf0e10cSrcweir 935cdf0e10cSrcweir for(sal_Int32 i=1;i<5;i++) 936cdf0e10cSrcweir m_aColMapping.push_back(i); 937cdf0e10cSrcweir m_aColMapping.push_back(6); 938cdf0e10cSrcweir m_aColMapping.push_back(10); 939cdf0e10cSrcweir m_aColMapping.push_back(16); 940cdf0e10cSrcweir m_aColMapping.push_back(13); 941cdf0e10cSrcweir m_aColMapping.push_back(11); 942cdf0e10cSrcweir m_aColMapping.push_back(12); 943cdf0e10cSrcweir 944cdf0e10cSrcweir m_aColMapping.push_back(9); 945cdf0e10cSrcweir m_aColMapping.push_back(14); 946cdf0e10cSrcweir 947cdf0e10cSrcweir TInt2IntMap aMap; 948cdf0e10cSrcweir aMap[DBTYPE_EMPTY] = DataType::SQLNULL; 949cdf0e10cSrcweir aMap[DBTYPE_NULL] = DataType::SQLNULL; 950cdf0e10cSrcweir aMap[DBTYPE_I2] = DataType::SMALLINT; 951cdf0e10cSrcweir aMap[DBTYPE_I4] = DataType::INTEGER; 952cdf0e10cSrcweir aMap[DBTYPE_R4] = DataType::FLOAT; 953cdf0e10cSrcweir aMap[DBTYPE_R8] = DataType::DOUBLE; 954cdf0e10cSrcweir aMap[DBTYPE_CY] = DataType::BIGINT; 955cdf0e10cSrcweir aMap[DBTYPE_DATE] = DataType::DATE; 956cdf0e10cSrcweir aMap[DBTYPE_BSTR] = DataType::VARCHAR; 957cdf0e10cSrcweir aMap[DBTYPE_IDISPATCH] = DataType::OBJECT; 958cdf0e10cSrcweir aMap[DBTYPE_ERROR] = DataType::OTHER; 959cdf0e10cSrcweir aMap[DBTYPE_BOOL] = DataType::BIT; 960cdf0e10cSrcweir aMap[DBTYPE_VARIANT] = DataType::STRUCT; 961cdf0e10cSrcweir aMap[DBTYPE_IUNKNOWN] = DataType::OTHER; 962cdf0e10cSrcweir aMap[DBTYPE_DECIMAL] = DataType::DECIMAL; 963cdf0e10cSrcweir aMap[DBTYPE_UI1] = DataType::TINYINT; 964cdf0e10cSrcweir aMap[DBTYPE_ARRAY] = DataType::ARRAY; 965cdf0e10cSrcweir aMap[DBTYPE_BYREF] = DataType::REF; 966cdf0e10cSrcweir aMap[DBTYPE_I1] = DataType::CHAR; 967cdf0e10cSrcweir aMap[DBTYPE_UI2] = DataType::SMALLINT; 968cdf0e10cSrcweir aMap[DBTYPE_UI4] = DataType::INTEGER; 969cdf0e10cSrcweir 970cdf0e10cSrcweir // aMap[The] = ; 971cdf0e10cSrcweir // aMap[in] = ; 972cdf0e10cSrcweir aMap[DBTYPE_I8] = DataType::BIGINT; 973cdf0e10cSrcweir aMap[DBTYPE_UI8] = DataType::BIGINT; 974cdf0e10cSrcweir aMap[DBTYPE_GUID] = DataType::OTHER; 975cdf0e10cSrcweir aMap[DBTYPE_VECTOR] = DataType::OTHER; 976cdf0e10cSrcweir aMap[DBTYPE_FILETIME] = DataType::OTHER; 977cdf0e10cSrcweir aMap[DBTYPE_RESERVED] = DataType::OTHER; 978cdf0e10cSrcweir 979cdf0e10cSrcweir // aMap[The] = ; 980cdf0e10cSrcweir aMap[DBTYPE_BYTES] = DataType::VARBINARY; 981cdf0e10cSrcweir aMap[DBTYPE_STR] = DataType::LONGVARCHAR; 982cdf0e10cSrcweir aMap[DBTYPE_WSTR] = DataType::LONGVARCHAR; 983cdf0e10cSrcweir aMap[DBTYPE_NUMERIC] = DataType::NUMERIC; 984cdf0e10cSrcweir aMap[DBTYPE_UDT] = DataType::OTHER; 985cdf0e10cSrcweir aMap[DBTYPE_DBDATE] = DataType::DATE; 986cdf0e10cSrcweir aMap[DBTYPE_DBTIME] = DataType::TIME; 987cdf0e10cSrcweir aMap[DBTYPE_DBTIMESTAMP] = DataType::TIMESTAMP; 988cdf0e10cSrcweir aMap[DBTYPE_HCHAPTER] = DataType::OTHER; 989cdf0e10cSrcweir aMap[DBTYPE_PROPVARIANT] = DataType::OTHER; 990cdf0e10cSrcweir aMap[DBTYPE_VARNUMERIC] = DataType::NUMERIC; 991cdf0e10cSrcweir 992cdf0e10cSrcweir m_aValueRange[10] = aMap; 993cdf0e10cSrcweir 994cdf0e10cSrcweir ODatabaseMetaDataResultSetMetaData* pMetaData = new ODatabaseMetaDataResultSetMetaData(m_pRecordSet,this); 995cdf0e10cSrcweir pMetaData->setProcedureColumnsMap(); 996cdf0e10cSrcweir m_xMetaData = pMetaData; 997cdf0e10cSrcweir } 998cdf0e10cSrcweir // ------------------------------------------------------------------------- 999cdf0e10cSrcweir void ODatabaseMetaDataResultSet::setPrimaryKeysMap() 1000cdf0e10cSrcweir { 1001cdf0e10cSrcweir 1002cdf0e10cSrcweir sal_Int32 i=1; 1003cdf0e10cSrcweir for(;i<5;i++) 1004cdf0e10cSrcweir m_aColMapping.push_back(i); 1005cdf0e10cSrcweir m_aColMapping.push_back(7); 1006cdf0e10cSrcweir m_aColMapping.push_back(8); 1007cdf0e10cSrcweir 1008cdf0e10cSrcweir ODatabaseMetaDataResultSetMetaData* pMetaData = new ODatabaseMetaDataResultSetMetaData(m_pRecordSet,this); 1009cdf0e10cSrcweir pMetaData->setProcedureColumnsMap(); 1010cdf0e10cSrcweir m_xMetaData = pMetaData; 1011cdf0e10cSrcweir } 1012cdf0e10cSrcweir // ------------------------------------------------------------------------- 1013cdf0e10cSrcweir void ODatabaseMetaDataResultSet::setIndexInfoMap() 1014cdf0e10cSrcweir { 1015cdf0e10cSrcweir 1016cdf0e10cSrcweir sal_Int32 i=1; 1017cdf0e10cSrcweir for(;i<4;i++) 1018cdf0e10cSrcweir m_aColMapping.push_back(i); 1019cdf0e10cSrcweir m_aColMapping.push_back(8); 1020cdf0e10cSrcweir m_aColMapping.push_back(4); 1021cdf0e10cSrcweir m_aColMapping.push_back(6); 1022cdf0e10cSrcweir m_aColMapping.push_back(10); 1023cdf0e10cSrcweir m_aColMapping.push_back(17); 1024cdf0e10cSrcweir m_aColMapping.push_back(18); 1025cdf0e10cSrcweir m_aColMapping.push_back(21); 1026cdf0e10cSrcweir m_aColMapping.push_back(22); 1027cdf0e10cSrcweir m_aColMapping.push_back(23); 1028cdf0e10cSrcweir m_aColMapping.push_back(24); 1029cdf0e10cSrcweir 1030cdf0e10cSrcweir TInt2IntMap aMap; 1031cdf0e10cSrcweir aMap[DBPROPVAL_IT_HASH] = IndexType::HASHED; 1032cdf0e10cSrcweir aMap[DBPROPVAL_IT_CONTENT] = IndexType::OTHER; 1033cdf0e10cSrcweir aMap[DBPROPVAL_IT_OTHER] = IndexType::OTHER; 1034cdf0e10cSrcweir aMap[DBPROPVAL_IT_BTREE] = IndexType::OTHER; 1035cdf0e10cSrcweir 1036cdf0e10cSrcweir m_aValueRange[10] = aMap; 1037cdf0e10cSrcweir 1038cdf0e10cSrcweir TInt2IntMap aMap2; 1039cdf0e10cSrcweir aMap[0] = 1; 1040cdf0e10cSrcweir aMap[1] = 0; 1041cdf0e10cSrcweir m_aValueRange[8] = aMap2; 1042cdf0e10cSrcweir 1043cdf0e10cSrcweir ::std::map< sal_Int32,::rtl::OUString> aMap3; 1044cdf0e10cSrcweir aMap3[0] = ::rtl::OUString(); 1045cdf0e10cSrcweir aMap3[DB_COLLATION_ASC] = ::rtl::OUString::createFromAscii("A"); 1046cdf0e10cSrcweir aMap3[DB_COLLATION_DESC] = ::rtl::OUString::createFromAscii("D"); 1047cdf0e10cSrcweir 1048cdf0e10cSrcweir m_aIntValueRange[21] = aMap3; 1049cdf0e10cSrcweir 1050cdf0e10cSrcweir ODatabaseMetaDataResultSetMetaData* pMetaData = new ODatabaseMetaDataResultSetMetaData(m_pRecordSet,this); 1051cdf0e10cSrcweir pMetaData->setIndexInfoMap(); 1052cdf0e10cSrcweir m_xMetaData = pMetaData; 1053cdf0e10cSrcweir } 1054cdf0e10cSrcweir // ------------------------------------------------------------------------- 1055cdf0e10cSrcweir void ODatabaseMetaDataResultSet::setTablePrivilegesMap() 1056cdf0e10cSrcweir { 1057cdf0e10cSrcweir 1058cdf0e10cSrcweir sal_Int32 i=3; 1059cdf0e10cSrcweir for(;i<6;i++) 1060cdf0e10cSrcweir m_aColMapping.push_back(i); 1061cdf0e10cSrcweir m_aColMapping.push_back(1); 1062cdf0e10cSrcweir m_aColMapping.push_back(2); 1063cdf0e10cSrcweir m_aColMapping.push_back(6); 1064cdf0e10cSrcweir m_aColMapping.push_back(7); 1065cdf0e10cSrcweir 1066cdf0e10cSrcweir ::std::map< sal_Int32,::rtl::OUString> aMap; 1067cdf0e10cSrcweir aMap[0] = ::rtl::OUString::createFromAscii("YES"); 1068cdf0e10cSrcweir aMap[1] = ::rtl::OUString::createFromAscii("NO"); 1069cdf0e10cSrcweir m_aIntValueRange[7] = aMap; 1070cdf0e10cSrcweir 1071cdf0e10cSrcweir 1072cdf0e10cSrcweir ODatabaseMetaDataResultSetMetaData* pMetaData = new ODatabaseMetaDataResultSetMetaData(m_pRecordSet,this); 1073cdf0e10cSrcweir pMetaData->setTablePrivilegesMap(); 1074cdf0e10cSrcweir m_xMetaData = pMetaData; 1075cdf0e10cSrcweir } 1076cdf0e10cSrcweir // ------------------------------------------------------------------------- 1077cdf0e10cSrcweir void ODatabaseMetaDataResultSet::setCrossReferenceMap() 1078cdf0e10cSrcweir { 1079cdf0e10cSrcweir 1080cdf0e10cSrcweir sal_Int32 i=1; 1081cdf0e10cSrcweir for(;i<5;i++) 1082cdf0e10cSrcweir m_aColMapping.push_back(i); 1083cdf0e10cSrcweir for(i=7;i<11;i++) 1084cdf0e10cSrcweir m_aColMapping.push_back(i); 1085cdf0e10cSrcweir 1086cdf0e10cSrcweir m_aColMapping.push_back(13); 1087cdf0e10cSrcweir m_aColMapping.push_back(14); 1088cdf0e10cSrcweir m_aColMapping.push_back(15); 1089cdf0e10cSrcweir m_aColMapping.push_back(17); 1090cdf0e10cSrcweir m_aColMapping.push_back(16); 1091cdf0e10cSrcweir m_aColMapping.push_back(18); 1092cdf0e10cSrcweir 1093cdf0e10cSrcweir ::std::map< ::rtl::OUString,sal_Int32> aMap; 1094cdf0e10cSrcweir aMap[ ::rtl::OUString::createFromAscii("CASCADE")] = KeyRule::CASCADE; 1095cdf0e10cSrcweir aMap[ ::rtl::OUString::createFromAscii("RESTRICT")] = KeyRule::RESTRICT; 1096cdf0e10cSrcweir aMap[ ::rtl::OUString::createFromAscii("SET NULL")] = KeyRule::SET_NULL; 1097cdf0e10cSrcweir aMap[ ::rtl::OUString::createFromAscii("SET DEFAULT")] = KeyRule::SET_DEFAULT; 1098cdf0e10cSrcweir aMap[ ::rtl::OUString::createFromAscii("NO ACTION")] = KeyRule::NO_ACTION; 1099cdf0e10cSrcweir 1100cdf0e10cSrcweir m_aStrValueRange[14] = aMap; 1101cdf0e10cSrcweir m_aStrValueRange[15] = aMap; 1102cdf0e10cSrcweir 1103cdf0e10cSrcweir ODatabaseMetaDataResultSetMetaData* pMetaData = new ODatabaseMetaDataResultSetMetaData(m_pRecordSet,this); 1104cdf0e10cSrcweir pMetaData->setCrossReferenceMap(); 1105cdf0e10cSrcweir m_xMetaData = pMetaData; 1106cdf0e10cSrcweir } 1107cdf0e10cSrcweir // ------------------------------------------------------------------------- 1108cdf0e10cSrcweir void ODatabaseMetaDataResultSet::setTypeInfoMap(sal_Bool _bJetEngine) 1109cdf0e10cSrcweir { 1110cdf0e10cSrcweir sal_Int32 i=1; 1111cdf0e10cSrcweir for(;i<19;i++) 1112cdf0e10cSrcweir m_aColMapping.push_back(i); 1113cdf0e10cSrcweir 1114cdf0e10cSrcweir ::std::map< ::rtl::OUString,sal_Int32> aMap1; 1115cdf0e10cSrcweir aMap1[ ::rtl::OUString()] = 10; 1116cdf0e10cSrcweir 1117cdf0e10cSrcweir m_aStrValueRange[18] = aMap1; 1118cdf0e10cSrcweir 1119cdf0e10cSrcweir TInt2IntMap aMap; 1120cdf0e10cSrcweir aMap[adEmpty] = ADOS::MapADOType2Jdbc(adEmpty); 1121cdf0e10cSrcweir aMap[adTinyInt] = ADOS::MapADOType2Jdbc(adTinyInt); 1122cdf0e10cSrcweir aMap[adSmallInt] = ADOS::MapADOType2Jdbc(adSmallInt); 1123cdf0e10cSrcweir aMap[adInteger] = ADOS::MapADOType2Jdbc(adInteger); 1124cdf0e10cSrcweir aMap[adBigInt] = ADOS::MapADOType2Jdbc(adBigInt); 1125cdf0e10cSrcweir aMap[adUnsignedTinyInt] = ADOS::MapADOType2Jdbc(adUnsignedTinyInt); 1126cdf0e10cSrcweir aMap[adUnsignedSmallInt]= ADOS::MapADOType2Jdbc(adUnsignedSmallInt); 1127cdf0e10cSrcweir aMap[adUnsignedInt] = ADOS::MapADOType2Jdbc(adUnsignedInt); 1128cdf0e10cSrcweir aMap[adUnsignedBigInt] = ADOS::MapADOType2Jdbc(adUnsignedBigInt); 1129cdf0e10cSrcweir aMap[adSingle] = ADOS::MapADOType2Jdbc(adSingle); 1130cdf0e10cSrcweir aMap[adDouble] = ADOS::MapADOType2Jdbc(adDouble); 1131cdf0e10cSrcweir aMap[adCurrency] = ADOS::MapADOType2Jdbc(adCurrency); 1132cdf0e10cSrcweir aMap[adDecimal] = ADOS::MapADOType2Jdbc(adDecimal); 1133cdf0e10cSrcweir aMap[adNumeric] = ADOS::MapADOType2Jdbc(adNumeric); 1134cdf0e10cSrcweir aMap[adBoolean] = ADOS::MapADOType2Jdbc(adBoolean); 1135cdf0e10cSrcweir aMap[adError] = ADOS::MapADOType2Jdbc(adError); 1136cdf0e10cSrcweir aMap[adUserDefined] = ADOS::MapADOType2Jdbc(adUserDefined); 1137cdf0e10cSrcweir aMap[adVariant] = ADOS::MapADOType2Jdbc(adVariant); 1138cdf0e10cSrcweir aMap[adIDispatch] = ADOS::MapADOType2Jdbc(adIDispatch); 1139cdf0e10cSrcweir aMap[adIUnknown] = ADOS::MapADOType2Jdbc(adIUnknown); 1140cdf0e10cSrcweir aMap[adGUID] = ADOS::MapADOType2Jdbc(adGUID); 1141cdf0e10cSrcweir aMap[adDate] = _bJetEngine ? ADOS::MapADOType2Jdbc(adDBTimeStamp) : ADOS::MapADOType2Jdbc(adDate); 1142cdf0e10cSrcweir aMap[adDBDate] = ADOS::MapADOType2Jdbc(adDBDate); 1143cdf0e10cSrcweir aMap[adDBTime] = ADOS::MapADOType2Jdbc(adDBTime); 1144cdf0e10cSrcweir aMap[adDBTimeStamp] = ADOS::MapADOType2Jdbc(adDBTimeStamp); 1145cdf0e10cSrcweir aMap[adBSTR] = ADOS::MapADOType2Jdbc(adBSTR); 1146cdf0e10cSrcweir aMap[adChar] = ADOS::MapADOType2Jdbc(adChar); 1147cdf0e10cSrcweir aMap[adVarChar] = ADOS::MapADOType2Jdbc(adVarChar); 1148cdf0e10cSrcweir aMap[adLongVarChar] = ADOS::MapADOType2Jdbc(adLongVarChar); 1149cdf0e10cSrcweir aMap[adWChar] = ADOS::MapADOType2Jdbc(adWChar); 1150cdf0e10cSrcweir aMap[adVarWChar] = ADOS::MapADOType2Jdbc(adVarWChar); 1151cdf0e10cSrcweir aMap[adLongVarWChar] = ADOS::MapADOType2Jdbc(adLongVarWChar); 1152cdf0e10cSrcweir aMap[adBinary] = ADOS::MapADOType2Jdbc(adBinary); 1153cdf0e10cSrcweir aMap[adVarBinary] = ADOS::MapADOType2Jdbc(adVarBinary); 1154cdf0e10cSrcweir aMap[adLongVarBinary] = ADOS::MapADOType2Jdbc(adLongVarBinary); 1155cdf0e10cSrcweir aMap[adChapter] = ADOS::MapADOType2Jdbc(adChapter); 1156cdf0e10cSrcweir aMap[adFileTime] = ADOS::MapADOType2Jdbc(adFileTime); 1157cdf0e10cSrcweir aMap[adPropVariant] = ADOS::MapADOType2Jdbc(adPropVariant); 1158cdf0e10cSrcweir aMap[adVarNumeric] = ADOS::MapADOType2Jdbc(adVarNumeric); 1159cdf0e10cSrcweir // aMap[adArray] = ADOS::MapADOType2Jdbc(adArray); 1160cdf0e10cSrcweir 1161cdf0e10cSrcweir m_aValueRange[2] = aMap; 1162cdf0e10cSrcweir 1163cdf0e10cSrcweir TInt2IntMap aColumnValueMapping; 1164cdf0e10cSrcweir aColumnValueMapping[VARIANT_FALSE] = ColumnValue::NO_NULLS; 1165cdf0e10cSrcweir aColumnValueMapping[VARIANT_TRUE] = ColumnValue::NULLABLE; 1166cdf0e10cSrcweir m_aValueRange[7] = aColumnValueMapping; 1167cdf0e10cSrcweir 1168cdf0e10cSrcweir // now adjust the column mapping 1169cdf0e10cSrcweir // OJ 24.01.2002 96860 1170cdf0e10cSrcweir TInt2IntMap aSerachMapping; 1171cdf0e10cSrcweir aSerachMapping[DB_UNSEARCHABLE] = ColumnSearch::NONE; 1172cdf0e10cSrcweir aSerachMapping[DB_LIKE_ONLY] = ColumnSearch::CHAR; 1173cdf0e10cSrcweir aSerachMapping[DB_ALL_EXCEPT_LIKE] = ColumnSearch::BASIC; 1174cdf0e10cSrcweir aSerachMapping[DB_SEARCHABLE] = ColumnSearch::FULL; 1175cdf0e10cSrcweir 1176cdf0e10cSrcweir m_aValueRange[9] = aSerachMapping; 1177cdf0e10cSrcweir 1178cdf0e10cSrcweir TInt2IntMap aCurrencyMapping; 1179cdf0e10cSrcweir m_aValueRange[11] = aCurrencyMapping; 1180cdf0e10cSrcweir 1181cdf0e10cSrcweir ODatabaseMetaDataResultSetMetaData* pMetaData = new ODatabaseMetaDataResultSetMetaData(m_pRecordSet,this); 1182cdf0e10cSrcweir pMetaData->setTypeInfoMap(); 1183cdf0e10cSrcweir m_xMetaData = pMetaData; 1184cdf0e10cSrcweir } 1185cdf0e10cSrcweir // ----------------------------------------------------------------------------- 1186cdf0e10cSrcweir void SAL_CALL ODatabaseMetaDataResultSet::acquire() throw() 1187cdf0e10cSrcweir { 1188cdf0e10cSrcweir ODatabaseMetaDataResultSet_BASE::acquire(); 1189cdf0e10cSrcweir } 1190cdf0e10cSrcweir // ----------------------------------------------------------------------------- 1191cdf0e10cSrcweir void SAL_CALL ODatabaseMetaDataResultSet::release() throw() 1192cdf0e10cSrcweir { 1193cdf0e10cSrcweir ODatabaseMetaDataResultSet_BASE::release(); 1194cdf0e10cSrcweir } 1195cdf0e10cSrcweir // ----------------------------------------------------------------------------- 1196cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL ODatabaseMetaDataResultSet::getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException) 1197cdf0e10cSrcweir { 1198cdf0e10cSrcweir return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper()); 1199cdf0e10cSrcweir } 1200cdf0e10cSrcweir // ----------------------------------------------------------------------------- 1201cdf0e10cSrcweir OLEVariant ODatabaseMetaDataResultSet::getValue(sal_Int32 columnIndex ) throw(SQLException, RuntimeException) 1202cdf0e10cSrcweir { 1203cdf0e10cSrcweir ::osl::MutexGuard aGuard( m_aMutex ); 1204cdf0e10cSrcweir checkDisposed(ODatabaseMetaDataResultSet_BASE::rBHelper.bDisposed); 1205cdf0e10cSrcweir 1206cdf0e10cSrcweir checkRecordSet(); 1207cdf0e10cSrcweir 1208cdf0e10cSrcweir WpADOField aField = ADOS::getField(m_pRecordSet,columnIndex); 1209cdf0e10cSrcweir aField.get_Value(m_aValue); 1210cdf0e10cSrcweir return m_aValue; 1211cdf0e10cSrcweir } 1212cdf0e10cSrcweir // ----------------------------------------------------------------------------- 1213cdf0e10cSrcweir 1214cdf0e10cSrcweir 1215