Tag: cws_src680_reportdesign02 User: oj Date: 2007-10-26 12:02:56+0000 Modified: dba/connectivity/source/drivers/odbc/OResultSet.cxx dba/connectivity/source/drivers/odbc/OResultSetMetaData.cxx dba/connectivity/source/inc/odbc/OResultSetMetaData.hxx
Log: #i61881# use odbc type instead of jdbc type File Changes: Directory: /dba/connectivity/source/drivers/odbc/ ================================================= File [changed]: OResultSet.cxx Url: http://dba.openoffice.org/source/browse/dba/connectivity/source/drivers/odbc/OResultSet.cxx?r1=1.64&r2=1.64.150.1 Delta lines: +16 -8 -------------------- --- OResultSet.cxx 2006-09-17 03:07:12+0000 1.64 +++ OResultSet.cxx 2007-10-26 12:02:53+0000 1.64.150.1 @@ -4,9 +4,9 @@ * * $RCSfile: OResultSet.cxx,v $ * - * $Revision: 1.64 $ + * $Revision: 1.64.150.1 $ * - * last change: $Author: obo $ $Date: 2006/09/17 03:07:12 $ + * last change: $Author: oj $ $Date: 2007/10/26 12:02:53 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -517,15 +517,21 @@ return nRet; } - sal_Int32 nType = getMetaData()->getColumnType(columnIndex); + SWORD nType = OResultSetMetaData::getColumnODBCType(m_pStatement->getOwnConnection(),m_aStatementHandle,*this,columnIndex); switch(nType) { - case DataType::VARCHAR: - case DataType::LONGVARCHAR: + case SQL_WVARCHAR: + case SQL_WCHAR: + case SQL_WLONGVARCHAR: + case SQL_VARCHAR: + case SQL_CHAR: + case SQL_LONGVARCHAR: { - ::rtl::OUString aRet = OTools::getStringValue(m_pStatement->getOwnConnection(),m_aStatementHandle,columnIndex,(SWORD)nType,m_bWasNull,**this,m_nTextEncoding); + ::rtl::OUString aRet = OTools::getStringValue(m_pStatement->getOwnConnection(),m_aStatementHandle,columnIndex,nType,m_bWasNull,**this,m_nTextEncoding); return Sequence<sal_Int8>(reinterpret_cast<const sal_Int8*>(aRet.getStr()),sizeof(sal_Unicode)*aRet.getLength()); } + default: + ; } return OTools::getBytesValue(m_pStatement->getOwnConnection(),m_aStatementHandle,columnIndex,SQL_C_BINARY,m_bWasNull,**this); } @@ -664,7 +670,9 @@ if(m_bFetchData) nRet = getValue(columnIndex,0,NULL,0); else - nRet = OTools::getStringValue(m_pStatement->getOwnConnection(),m_aStatementHandle,columnIndex,(SWORD)getMetaData()->getColumnType(columnIndex),m_bWasNull,**this,m_nTextEncoding); + { + nRet = OTools::getStringValue(m_pStatement->getOwnConnection(),m_aStatementHandle,columnIndex,OResultSetMetaData::getColumnODBCType(m_pStatement->getOwnConnection(),m_aStatementHandle,*this,columnIndex),m_bWasNull,**this,m_nTextEncoding); + } return nRet; } // ------------------------------------------------------------------------- File [changed]: OResultSetMetaData.cxx Url: http://dba.openoffice.org/source/browse/dba/connectivity/source/drivers/odbc/OResultSetMetaData.cxx?r1=1.19&r2=1.19.150.1 Delta lines: +41 -13 --------------------- --- OResultSetMetaData.cxx 2006-09-17 03:07:27+0000 1.19 +++ OResultSetMetaData.cxx 2007-10-26 12:02:53+0000 1.19.150.1 @@ -4,9 +4,9 @@ * * $RCSfile: OResultSetMetaData.cxx,v $ * - * $Revision: 1.19 $ + * $Revision: 1.19.150.1 $ * - * last change: $Author: obo $ $Date: 2006/09/17 03:07:27 $ + * last change: $Author: oj $ $Date: 2007/10/26 12:02:53 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -95,21 +95,30 @@ return sValue; } // ------------------------------------------------------------------------- +SWORD OResultSetMetaData::getNumColAttrib(OConnection* _pConnection + ,SQLHANDLE _aStatementHandle + ,const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xInterface + ,sal_Int32 _column + ,sal_Int32 _ident) throw(SQLException, RuntimeException) +{ + SWORD nValue=0; + OTools::ThrowException(_pConnection,(*(T3SQLColAttribute)_pConnection->getOdbcFunction(ODBC3SQLColAttribute))(_aStatementHandle, + (SQLUSMALLINT)_column, + (SQLUSMALLINT)_ident, + NULL, + 0, + NULL, + &nValue),_aStatementHandle,SQL_HANDLE_STMT,_xInterface); + return nValue; +} +// ------------------------------------------------------------------------- sal_Int32 OResultSetMetaData::getNumColAttrib(sal_Int32 _column,sal_Int32 ident) throw(SQLException, RuntimeException) { sal_Int32 column = _column; if(_column < (sal_Int32)m_vMapping.size()) // use mapping column = m_vMapping[_column]; - sal_Int32 nValue=0; - OTools::ThrowException(m_pConnection,N3SQLColAttribute(m_aStatementHandle, - (SQLUSMALLINT)column, - (SQLUSMALLINT)ident, - NULL, - 0, - NULL, - &nValue),m_aStatementHandle,SQL_HANDLE_STMT,*this); - return nValue; + return getNumColAttrib(m_pConnection,m_aStatementHandle,*this,column,ident); } // ------------------------------------------------------------------------- sal_Int32 SAL_CALL OResultSetMetaData::getColumnDisplaySize( sal_Int32 column ) throw(SQLException, RuntimeException) @@ -117,7 +126,26 @@ return getNumColAttrib(column,SQL_DESC_DISPLAY_SIZE); } // ------------------------------------------------------------------------- - +SWORD OResultSetMetaData::getColumnODBCType(OConnection* _pConnection + ,SQLHANDLE _aStatementHandle + ,const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xInterface + ,sal_Int32 column) + throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) +{ + SWORD nType = 0; + try + { + nType = getNumColAttrib(_pConnection,_aStatementHandle,_xInterface,column,SQL_DESC_CONCISE_TYPE); + if(nType == SQL_UNKNOWN_TYPE) + nType = getNumColAttrib(_pConnection,_aStatementHandle,_xInterface,column, SQL_DESC_TYPE); + } + catch(SQLException& ) // in this case we have an odbc 2.0 driver + { + nType = getNumColAttrib(_pConnection,_aStatementHandle,_xInterface,column,SQL_DESC_CONCISE_TYPE ); + } + return nType; +} +// ----------------------------------------------------------------------------- sal_Int32 SAL_CALL OResultSetMetaData::getColumnType( sal_Int32 column ) throw(SQLException, RuntimeException) { sal_Int32 nType = 0; Directory: /dba/connectivity/source/inc/odbc/ ============================================= File [changed]: OResultSetMetaData.hxx Url: http://dba.openoffice.org/source/browse/dba/connectivity/source/inc/odbc/OResultSetMetaData.hxx?r1=1.7&r2=1.7.210.1 Delta lines: +15 -3 -------------------- --- OResultSetMetaData.hxx 2006-06-20 02:06:30+0000 1.7 +++ OResultSetMetaData.hxx 2007-10-26 12:02:54+0000 1.7.210.1 @@ -4,9 +4,9 @@ * * $RCSfile: OResultSetMetaData.hxx,v $ * - * $Revision: 1.7 $ + * $Revision: 1.7.210.1 $ * - * last change: $Author: hr $ $Date: 2006/06/20 02:06:30 $ + * last change: $Author: oj $ $Date: 2007/10/26 12:02:54 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -91,6 +91,18 @@ virtual ~OResultSetMetaData(); + static SWORD getNumColAttrib(OConnection* _pConnection + ,SQLHANDLE _aStatementHandle + ,const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xInterface + ,sal_Int32 _column + ,sal_Int32 ident) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + + static SWORD getColumnODBCType(OConnection* _pConnection + ,SQLHANDLE _aStatementHandle + ,const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xInterface + ,sal_Int32 column) + throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + inline oslGenericFunction getOdbcFunction(sal_Int32 _nIndex) const { return m_pConnection->getOdbcFunction(_nIndex); --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
