diff options
Diffstat (limited to 'connectivity/source/commontools')
-rw-r--r-- | connectivity/source/commontools/FValue.cxx | 145 |
1 files changed, 58 insertions, 87 deletions
diff --git a/connectivity/source/commontools/FValue.cxx b/connectivity/source/commontools/FValue.cxx index 0634d041a6..fc212b1568 100644 --- a/connectivity/source/commontools/FValue.cxx +++ b/connectivity/source/commontools/FValue.cxx @@ -36,7 +36,6 @@ #include "connectivity/CommonTools.hxx" #include <connectivity/dbconversion.hxx> #include <com/sun/star/io/XInputStream.hpp> -#include <rtl/logfile.hxx> using namespace connectivity; using namespace dbtools; @@ -48,12 +47,10 @@ using namespace ::com::sun::star::io; namespace { static sal_Bool isStorageCompatible(sal_Int32 _eType1, sal_Int32 _eType2) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbtools", "Ocke.Janssen@sun.com", "ORowSetValue::isStorageCompatible" ); sal_Bool bIsCompatible = sal_True; if (_eType1 != _eType2) { - RTL_LOGFILE_CONTEXT_TRACE( aLogger, "ORowSetValue::isStorageCompatible _eType1 != _eType2" ); switch (_eType1) { case DataType::CHAR: @@ -199,65 +196,65 @@ namespace tracing // ----------------------------------------------------------------------------- void ORowSetValue::setTypeKind(sal_Int32 _eType) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbtools", "Ocke.Janssen@sun.com", "ORowSetValue::setTypeKind" ); - if ( !m_bNull && !isStorageCompatible(_eType, m_eTypeKind) ) - { - switch(_eType) + if (!m_bNull) + if (!isStorageCompatible(_eType, m_eTypeKind)) { - case DataType::VARCHAR: - case DataType::CHAR: - case DataType::DECIMAL: - case DataType::NUMERIC: - case DataType::LONGVARCHAR: - (*this) = getString(); - break; - case DataType::BIGINT: - (*this) = getLong(); - break; + switch(_eType) + { + case DataType::VARCHAR: + case DataType::CHAR: + case DataType::DECIMAL: + case DataType::NUMERIC: + case DataType::LONGVARCHAR: + (*this) = getString(); + break; + case DataType::BIGINT: + (*this) = getLong(); + break; - case DataType::FLOAT: - (*this) = getFloat(); - break; - case DataType::DOUBLE: - case DataType::REAL: - (*this) = getDouble(); - break; - case DataType::TINYINT: - (*this) = getInt8(); - break; - case DataType::SMALLINT: - (*this) = getInt16(); - break; - case DataType::INTEGER: - (*this) = getInt32(); - break; - case DataType::BIT: - case DataType::BOOLEAN: - (*this) = getBool(); - break; - case DataType::DATE: - (*this) = getDate(); - break; - case DataType::TIME: - (*this) = getTime(); - break; - case DataType::TIMESTAMP: - (*this) = getDateTime(); - break; - case DataType::BINARY: - case DataType::VARBINARY: - case DataType::LONGVARBINARY: - (*this) = getSequence(); - break; - case DataType::BLOB: - case DataType::CLOB: - case DataType::OBJECT: - (*this) = getAny(); - break; - default: - OSL_ENSURE(0,"ORowSetValue:operator==(): UNSPUPPORTED TYPE!"); + case DataType::FLOAT: + (*this) = getFloat(); + break; + case DataType::DOUBLE: + case DataType::REAL: + (*this) = getDouble(); + break; + case DataType::TINYINT: + (*this) = getInt8(); + break; + case DataType::SMALLINT: + (*this) = getInt16(); + break; + case DataType::INTEGER: + (*this) = getInt32(); + break; + case DataType::BIT: + case DataType::BOOLEAN: + (*this) = getBool(); + break; + case DataType::DATE: + (*this) = getDate(); + break; + case DataType::TIME: + (*this) = getTime(); + break; + case DataType::TIMESTAMP: + (*this) = getDateTime(); + break; + case DataType::BINARY: + case DataType::VARBINARY: + case DataType::LONGVARBINARY: + (*this) = getSequence(); + break; + case DataType::BLOB: + case DataType::CLOB: + case DataType::OBJECT: + (*this) = getAny(); + break; + default: + OSL_ENSURE(0,"ORowSetValue:operator==(): UNSPUPPORTED TYPE!"); + } } - } m_eTypeKind = _eType; } @@ -265,7 +262,6 @@ void ORowSetValue::setTypeKind(sal_Int32 _eType) // ----------------------------------------------------------------------------- void ORowSetValue::free() { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbtools", "Ocke.Janssen@sun.com", "ORowSetValue::free" ); if(!m_bNull) { switch(m_eTypeKind) @@ -352,7 +348,7 @@ ORowSetValue& ORowSetValue::operator=(const ORowSetValue& _rRH) if(&_rRH == this) return *this; - if ( m_eTypeKind != _rRH.m_eTypeKind || (_rRH.m_bNull && !m_bNull) || m_bSigned != _rRH.m_bSigned) + if ( m_eTypeKind != _rRH.m_eTypeKind || _rRH.m_bNull || m_bSigned != _rRH.m_bSigned) free(); m_bBound = _rRH.m_bBound; @@ -852,7 +848,6 @@ bool ORowSetValue::operator==(const ORowSetValue& _rRH) const // ------------------------------------------------------------------------- Any ORowSetValue::makeAny() const { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbtools", "Ocke.Janssen@sun.com", "ORowSetValue::makeAny" ); Any rValue; if(isBound() && !isNull()) { @@ -944,7 +939,6 @@ Any ORowSetValue::makeAny() const // ------------------------------------------------------------------------- ::rtl::OUString ORowSetValue::getString( ) const { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbtools", "Ocke.Janssen@sun.com", "ORowSetValue::getString" ); ::rtl::OUString aRet; if(!m_bNull) { @@ -1020,7 +1014,6 @@ Any ORowSetValue::makeAny() const // ------------------------------------------------------------------------- sal_Bool ORowSetValue::getBool() const { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbtools", "Ocke.Janssen@sun.com", "ORowSetValue::getBool" ); sal_Bool bRet = sal_False; if(!m_bNull) { @@ -1091,7 +1084,6 @@ sal_Bool ORowSetValue::getBool() const // ------------------------------------------------------------------------- sal_Int8 ORowSetValue::getInt8() const { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbtools", "Ocke.Janssen@sun.com", "ORowSetValue::getInt8" ); sal_Int8 nRet = 0; @@ -1156,7 +1148,6 @@ sal_Int8 ORowSetValue::getInt8() const // ------------------------------------------------------------------------- sal_Int16 ORowSetValue::getInt16() const { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbtools", "Ocke.Janssen@sun.com", "ORowSetValue::getInt16" ); sal_Int16 nRet = 0; @@ -1221,7 +1212,6 @@ sal_Int16 ORowSetValue::getInt16() const // ------------------------------------------------------------------------- sal_Int32 ORowSetValue::getInt32() const { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbtools", "Ocke.Janssen@sun.com", "ORowSetValue::getInt32" ); sal_Int32 nRet = 0; if(!m_bNull) { @@ -1286,7 +1276,6 @@ sal_Int32 ORowSetValue::getInt32() const // ------------------------------------------------------------------------- sal_Int64 ORowSetValue::getLong() const { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbtools", "Ocke.Janssen@sun.com", "ORowSetValue::getLong" ); sal_Int64 nRet = 0; if(!m_bNull) { @@ -1351,7 +1340,6 @@ sal_Int64 ORowSetValue::getLong() const // ------------------------------------------------------------------------- float ORowSetValue::getFloat() const { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbtools", "Ocke.Janssen@sun.com", "ORowSetValue::getFloat" ); float nRet = 0; if(!m_bNull) { @@ -1420,7 +1408,6 @@ float ORowSetValue::getFloat() const // ------------------------------------------------------------------------- double ORowSetValue::getDouble() const { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbtools", "Ocke.Janssen@sun.com", "ORowSetValue::getDouble" ); double nRet = 0; @@ -1491,7 +1478,6 @@ double ORowSetValue::getDouble() const // ------------------------------------------------------------------------- void ORowSetValue::setFromDouble(const double& _rVal,sal_Int32 _nDatatype) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbtools", "Ocke.Janssen@sun.com", "ORowSetValue::setFromDouble" ); free(); m_bNull = sal_False; @@ -1578,7 +1564,6 @@ void ORowSetValue::setFromDouble(const double& _rVal,sal_Int32 _nDatatype) // ----------------------------------------------------------------------------- Sequence<sal_Int8> ORowSetValue::getSequence() const { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbtools", "Ocke.Janssen@sun.com", "ORowSetValue::getSequence" ); Sequence<sal_Int8> aSeq; if (!m_bNull) { @@ -1620,7 +1605,6 @@ Sequence<sal_Int8> ORowSetValue::getSequence() const // ----------------------------------------------------------------------------- ::com::sun::star::util::Date ORowSetValue::getDate() const { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbtools", "Ocke.Janssen@sun.com", "ORowSetValue::getDate" ); ::com::sun::star::util::Date aValue; if(!m_bNull) { @@ -1659,7 +1643,6 @@ Sequence<sal_Int8> ORowSetValue::getSequence() const // ----------------------------------------------------------------------------- ::com::sun::star::util::Time ORowSetValue::getTime() const { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbtools", "Ocke.Janssen@sun.com", "ORowSetValue::getTime" ); ::com::sun::star::util::Time aValue; if(!m_bNull) { @@ -1697,7 +1680,6 @@ Sequence<sal_Int8> ORowSetValue::getSequence() const // ----------------------------------------------------------------------------- ::com::sun::star::util::DateTime ORowSetValue::getDateTime() const { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbtools", "Ocke.Janssen@sun.com", "ORowSetValue::getDateTime" ); ::com::sun::star::util::DateTime aValue; if(!m_bNull) { @@ -1744,7 +1726,6 @@ Sequence<sal_Int8> ORowSetValue::getSequence() const // ----------------------------------------------------------------------------- void ORowSetValue::setSigned(sal_Bool _bMod) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbtools", "Ocke.Janssen@sun.com", "ORowSetValue::setSigned" ); if ( m_bSigned != _bMod ) { m_bSigned = _bMod; @@ -1811,15 +1792,6 @@ void ORowSetValue::fill(sal_Int32 _nPos, sal_Int32 _nType, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRow>& _xRow) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbtools", "Ocke.Janssen@sun.com", "ORowSetValue::fill" ); - fill(_nPos,_nType,sal_True,_xRow); -} -void ORowSetValue::fill(sal_Int32 _nPos, - sal_Int32 _nType, - sal_Bool _bNullable, - const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRow>& _xRow) -{ - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbtools", "Ocke.Janssen@sun.com", "ORowSetValue::fill" ); sal_Bool bReadData = sal_True; switch(_nType) { @@ -1891,14 +1863,13 @@ void ORowSetValue::fill(sal_Int32 _nPos, bReadData = sal_False; break; } - if ( bReadData && _bNullable && _xRow->wasNull() ) + if ( bReadData && _xRow->wasNull() ) setNull(); setTypeKind(_nType); } // ----------------------------------------------------------------------------- void ORowSetValue::fill(const Any& _rValue) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbtools", "Ocke.Janssen@sun.com", "ORowSetValue::fill" ); switch (_rValue.getValueType().getTypeClass()) { case TypeClass_VOID: |