summaryrefslogtreecommitdiff
path: root/connectivity/source/commontools/FValue.cxx
diff options
context:
space:
mode:
authorOcke Janssen [oj] <Ocke.Janssen@sun.com>2009-11-13 13:30:51 +0100
committerOcke Janssen [oj] <Ocke.Janssen@sun.com>2009-11-13 13:30:51 +0100
commitfff9375fe7296dd390c6dbca0486aa60f95bd058 (patch)
tree83b5079d5d5e4f819a14b9ee426c8915038f8129 /connectivity/source/commontools/FValue.cxx
parent8421bb9bf5894fb7043747876172a89c6e5a4820 (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.cxx37
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;