Index: source/inc/odbc/ODatabaseMetaDataResultSet.hxx =================================================================== --- source/inc/odbc/ODatabaseMetaDataResultSet.hxx (revision 277850) +++ source/inc/odbc/ODatabaseMetaDataResultSet.hxx (working copy) @@ -100,6 +100,7 @@ sal_Int32 getFetchDirection() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); sal_Int32 getFetchSize() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); ::rtl::OUString getCursorName() const throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + SWORD impl_getColumnType_nothrow(sal_Int32 column); sal_Int32 mapColumn (sal_Int32 column); Index: source/drivers/odbcbase/ODatabaseMetaDataResultSet.cxx =================================================================== --- source/drivers/odbcbase/ODatabaseMetaDataResultSet.cxx (revision 277850) +++ source/drivers/odbcbase/ODatabaseMetaDataResultSet.cxx (working copy) @@ -283,7 +283,7 @@ aDate.day = 0; aDate.month = 0; aDate.year = 0; - OTools::getValue(m_pConnection,m_aStatementHandle,columnIndex,SQL_C_DATE,m_bWasNull,**this,&aDate,sizeof aDate); + OTools::getValue(m_pConnection,m_aStatementHandle,columnIndex,m_pConnection->useOldDateFormat() ? SQL_C_DATE : SQL_C_TYPE_DATE,m_bWasNull,**this,&aDate,sizeof aDate); return Date(aDate.day,aDate.month,aDate.year); } else @@ -434,7 +434,7 @@ columnIndex = mapColumn(columnIndex); ::rtl::OUString aVal; if(columnIndex <= m_nDriverColumnCount) - aVal = OTools::getStringValue(m_pConnection,m_aStatementHandle,columnIndex,(SWORD)SQL_C_WCHAR,m_bWasNull,**this,m_nTextEncoding); + aVal = OTools::getStringValue(m_pConnection,m_aStatementHandle,columnIndex,impl_getColumnType_nothrow(columnIndex),m_bWasNull,**this,m_nTextEncoding); else m_bWasNull = sal_True; @@ -454,7 +454,7 @@ columnIndex = mapColumn(columnIndex); TIME_STRUCT aTime={0,0,0}; if(columnIndex <= m_nDriverColumnCount) - OTools::getValue(m_pConnection,m_aStatementHandle,columnIndex,SQL_C_TIME,m_bWasNull,**this,&aTime,sizeof aTime); + OTools::getValue(m_pConnection,m_aStatementHandle,columnIndex,m_pConnection->useOldDateFormat() ? SQL_C_TIME : SQL_C_TYPE_TIME,m_bWasNull,**this,&aTime,sizeof aTime); else m_bWasNull = sal_True; return Time(0,aTime.second,aTime.minute,aTime.hour); @@ -472,7 +472,7 @@ columnIndex = mapColumn(columnIndex); TIMESTAMP_STRUCT aTime={0,0,0,0,0,0,0}; if(columnIndex <= m_nDriverColumnCount) - OTools::getValue(m_pConnection,m_aStatementHandle,columnIndex,SQL_C_TIMESTAMP,m_bWasNull,**this,&aTime,sizeof aTime); + OTools::getValue(m_pConnection,m_aStatementHandle,columnIndex,m_pConnection->useOldDateFormat() ? SQL_C_TIMESTAMP : SQL_C_TYPE_TIMESTAMP,m_bWasNull,**this,&aTime,sizeof aTime); else m_bWasNull = sal_True; return DateTime((sal_uInt16)aTime.fraction*1000,aTime.second,aTime.minute,aTime.hour,aTime.day,aTime.month,aTime.year); @@ -1316,5 +1316,11 @@ } // ----------------------------------------------------------------------------- +SWORD ODatabaseMetaDataResultSet::impl_getColumnType_nothrow(sal_Int32 columnIndex) +{ + ::std::map::iterator aFind = m_aODBCColumnTypes.find(columnIndex); + if ( aFind == m_aODBCColumnTypes.end() ) + aFind = m_aODBCColumnTypes.insert(::std::map::value_type(columnIndex,OResultSetMetaData::getColumnODBCType(m_pConnection,m_aStatementHandle,*this,columnIndex))).first; + return aFind->second; +} -