diff options
author | Ocke Janssen [oj] <Ocke.Janssen@sun.com> | 2009-11-13 13:30:51 +0100 |
---|---|---|
committer | Ocke Janssen [oj] <Ocke.Janssen@sun.com> | 2009-11-13 13:30:51 +0100 |
commit | fff9375fe7296dd390c6dbca0486aa60f95bd058 (patch) | |
tree | 83b5079d5d5e4f819a14b9ee426c8915038f8129 /connectivity/source/commontools/FValue.cxx | |
parent | 8421bb9bf5894fb7043747876172a89c6e5a4820 (diff) |
#i105086# fix blob handling, map to bytes when possible
Diffstat (limited to 'connectivity/source/commontools/FValue.cxx')
-rw-r--r-- | connectivity/source/commontools/FValue.cxx | 37 |
1 files changed, 34 insertions, 3 deletions
diff --git a/connectivity/source/commontools/FValue.cxx b/connectivity/source/commontools/FValue.cxx index 7a85cca57738..253c07bebdeb 100644 --- a/connectivity/source/commontools/FValue.cxx +++ b/connectivity/source/commontools/FValue.cxx @@ -1643,12 +1643,39 @@ Sequence<sal_Int8> ORowSetValue::getSequence() const case DataType::BLOB: { Reference<XInputStream> xStream; - Any aValue = getAny(); + const Any aValue = makeAny(); if(aValue.hasValue()) { - aValue >>= xStream; + Reference<XBlob> xBlob(aValue,UNO_QUERY); + if ( xBlob.is() ) + xStream = xBlob->getBinaryStream(); + else + { + Reference<XClob> xClob(aValue,UNO_QUERY); + if ( xClob.is() ) + xStream = xClob->getCharacterStream(); + } if(xStream.is()) - xStream->readBytes(aSeq,xStream->available()); + { + const sal_uInt32 nBytesToRead = 65535; + sal_uInt32 nRead; + + do + { + ::com::sun::star::uno::Sequence< sal_Int8 > aReadSeq; + + nRead = xStream->readSomeBytes( aReadSeq, nBytesToRead ); + + if( nRead ) + { + const sal_uInt32 nOldLength = aSeq.getLength(); + aSeq.realloc( nOldLength + nRead ); + rtl_copyMemory( aSeq.getArray() + nOldLength, aReadSeq.getConstArray(), aReadSeq.getLength() ); + } + } + while( nBytesToRead == nRead ); + xStream->closeInput(); + } } } break; @@ -2117,6 +2144,10 @@ void ORowSetValue::fill(const Any& _rValue) (*this) = _rValue; setTypeKind(DataType::BLOB); } + else + { + (*this) = _rValue; + } } } break; |