To comment on the following update, log in, then open the issue: http://www.openoffice.org/issues/show_bug.cgi?id=102791
------- Additional comments from [email protected] Thu Oct 29 14:58:17 +0000 2009 ------- OK. Here it goes (not a real diff): connectivity/source/drivers/odbcbase/OTools.cxx @ 134 case SQL_CHAR: case SQL_VARCHAR: + case SQL_DECIMAL: if(_bUseWChar) { *pLen = SQL_NTS; connectivity/source/drivers/odbcbase/OTools.cxx @ 160 break; case SQL_NUMERIC: - case SQL_DECIMAL: if(_bUseWChar) { ::rtl::OUString aString = rtl::OUString::valueOf(*(double*)_pValue); connectivity/source/drivers/odbcbase/OPreparedStatement.cxx @ 276 setParameter(parameterIndex,DataType::CHAR,aString.getLength(),(void*)&x); } +// ------------------------------------------------------------------------- + +void SAL_CALL OPreparedStatement::setDecimal( sal_Int32 parameterIndex, const ::rtl::OUString& x ) throw(SQLException, RuntimeException) +{ + ::rtl::OString aString(::rtl::OUStringToOString(x,getOwnConnection()->getTextEncoding())); + setParameter(parameterIndex,DataType::DECIMAL,aString.getLength(),(void*)&x); +} // ------------------------------------------------------------------------- Reference< XConnection > SAL_CALL OPreparedStatement::getConnection( ) throw(SQLException, RuntimeException) { connectivity/source/drivers/odbcbase/OPreparedStatement.cxx @ 530 setNull(parameterIndex,sqlType); break; case DataType::DECIMAL: + { + ORowSetValue aValue; + aValue.fill(x); + setDecimal(parameterIndex,aValue); + } + break; case DataType::NUMERIC: { ORowSetValue aValue; connectivity/source/inc/odbc/OPreparedStatement.hxx @ 146 virtual void SAL_CALL setString( sal_Int32 parameterIndex, const ::rtl::OUString& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setDecimal( sal_Int32 parameterIndex, const ::rtl::OUString& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); virtual void SAL_CALL setBytes( sal_Int32 parameterIndex, const ::com::sun::star::uno::Sequence< sal_Int8 >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); These changes only affect DECIMAL and solves my issue with DB2. The binding of DECIMAL is now identical to MSAccess. Therefor I would suspect MySQL ODBC to be compatible with this change. Regarding NUMERIC and DB2, although SQLGetTypeInfo reports NUMERIC as a supported type for the IBM DB2 ODBC driver, I have never seen a NUMERIC type in a reply to SQLColumns. All SQL NUMBER/DECIMAL fields are reported as DECIMAL. The driver we have developped doesn't use NUMERIC at all for DB2. If this patch works also with the other databases then NUMERIC can stay as it is. --------------------------------------------------------------------- Please do not reply to this automatically generated notification from Issue Tracker. Please log onto the website and enter your comments. http://qa.openoffice.org/issue_handling/project_issues.html#notification --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
