diff options
author | Ocke Janssen <oj@openoffice.org> | 2001-05-28 08:09:29 +0000 |
---|---|---|
committer | Ocke Janssen <oj@openoffice.org> | 2001-05-28 08:09:29 +0000 |
commit | c68bdab70038b62dd8d751ee129de51885d85f76 (patch) | |
tree | 4e2ef69240b2b1bdc2494f784c9d930041194415 /connectivity/source | |
parent | 32c8936a338226dd4c37ee05d019adaa7980a674 (diff) |
#86723# wrong type for binary types
Diffstat (limited to 'connectivity/source')
-rw-r--r-- | connectivity/source/drivers/odbc/OPreparedStatement.cxx | 13 | ||||
-rw-r--r-- | connectivity/source/drivers/odbc/OResultSet.cxx | 28 |
2 files changed, 20 insertions, 21 deletions
diff --git a/connectivity/source/drivers/odbc/OPreparedStatement.cxx b/connectivity/source/drivers/odbc/OPreparedStatement.cxx index 7563af6d57a7..c7d78911795b 100644 --- a/connectivity/source/drivers/odbc/OPreparedStatement.cxx +++ b/connectivity/source/drivers/odbc/OPreparedStatement.cxx @@ -2,9 +2,9 @@ * * $RCSfile: OPreparedStatement.cxx,v $ * - * $Revision: 1.19 $ + * $Revision: 1.20 $ * - * last change: $Author: oj $ $Date: 2001-05-21 14:30:18 $ + * last change: $Author: oj $ $Date: 2001-05-28 09:09:10 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -775,14 +775,7 @@ void SAL_CALL OPreparedStatement::setBytes( sal_Int32 parameterIndex, const Sequ if(!isPrepared()) prepareStatement(); - if ( x.getLength() > 2000 ) - { - // setBinaryStream (parameterIndex, new java.io.ByteArrayInputStream(x), x.length); - } - else - { - setBinary (parameterIndex, DataType::BINARY, x); - } + setBinary (parameterIndex, DataType::BINARY, x); } // ------------------------------------------------------------------------- diff --git a/connectivity/source/drivers/odbc/OResultSet.cxx b/connectivity/source/drivers/odbc/OResultSet.cxx index eb0ebf15e82a..96cfdc235ab7 100644 --- a/connectivity/source/drivers/odbc/OResultSet.cxx +++ b/connectivity/source/drivers/odbc/OResultSet.cxx @@ -2,9 +2,9 @@ * * $RCSfile: OResultSet.cxx,v $ * - * $Revision: 1.25 $ + * $Revision: 1.26 $ * - * last change: $Author: oj $ $Date: 2001-05-28 06:45:17 $ + * last change: $Author: oj $ $Date: 2001-05-28 09:09:09 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -472,15 +472,20 @@ Sequence< sal_Int8 > SAL_CALL OResultSet::getBytes( sal_Int32 columnIndex ) thro if(columnIndex > m_nLastColumnPos) fillRow(columnIndex); Sequence< sal_Int8 > nRet; - if(m_aRow[columnIndex].getTypeKind() != DataType::BINARY && m_aRow[columnIndex].getTypeKind() != DataType::VARBINARY) - { // something went wrong so we have another type here - // OSL_ENSURE(TypeClass_STRING == m_aRow[columnIndex].getValueTypeClass(),"ONLY string types supported!"); - ::rtl::OUString sRet; - sRet = m_aRow[columnIndex].getString(); - nRet = Sequence<sal_Int8>(reinterpret_cast<const sal_Int8*>(sRet.getStr()),sizeof(sal_Unicode)*sRet.getLength()); + switch(m_aRow[columnIndex].getTypeKind()) + { + case DataType::BINARY: + case DataType::VARBINARY: + case DataType::LONGVARBINARY: + nRet = m_aRow[columnIndex]; + break; + default: + { + ::rtl::OUString sRet; + sRet = m_aRow[columnIndex].getString(); + nRet = Sequence<sal_Int8>(reinterpret_cast<const sal_Int8*>(sRet.getStr()),sizeof(sal_Unicode)*sRet.getLength()); + } } - else - nRet = m_aRow[columnIndex]; return nRet; } @@ -1662,7 +1667,8 @@ void OResultSet::fillRow(sal_Int32 _nToColumn) Reference< XResultSetMetaData > xMeta = getMetaData(); for(sal_Int32 i=m_nLastColumnPos+1;i <= _nToColumn; ++i) { - switch (xMeta->getColumnType(i)) + m_aRow[_nToColumn].setTypeKind(xMeta->getColumnType(i)); + switch (m_aRow[_nToColumn].getTypeKind()) { case DataType::CHAR: case DataType::VARCHAR: |