13#include <com/sun/star/io/BufferSizeExceededException.hpp>
14#include <com/sun/star/io/NotConnectedException.hpp>
15#include <com/sun/star/io/IOException.hpp>
16#include <com/sun/star/lang/IllegalArgumentException.hpp>
17#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
18#include <com/sun/star/sdbc/SQLException.hpp>
26using namespace ::
cppu;
34Blob::Blob(isc_db_handle* pDatabaseHandle,
35 isc_tr_handle* pTransactionHandle,
36 ISC_QUAD
const & aBlobID):
38 m_pDatabaseHandle(pDatabaseHandle),
39 m_pTransactionHandle(pTransactionHandle),
41#
if SAL_TYPES_SIZEOFPOINTER == 8
44 m_blobHandle(nullptr),
76 isc_info_blob_total_length,
77 isc_info_blob_max_segment
83 char aResultBuffer[11 + 11];
89 sizeof(aResultBuffer),
95 char* pIt = aResultBuffer;
96 while( *pIt != isc_info_end )
99 short aResultLength =
static_cast<short>(isc_vax_integer(pIt, 2));
104 case isc_info_blob_total_length:
107 case isc_info_blob_max_segment:
114 pIt += aResultLength;
132 if(rDataOut.size() < nMaxSize)
133 rDataOut.resize(nMaxSize);
135 sal_uInt16 nActualSize = 0;
148 if (rDataOut.size() > nActualSize)
149 rDataOut.resize(nActualSize);
151 return aRet == isc_segstr_eof;
169#if SAL_TYPES_SIZEOFPOINTER == 8
182 catch (
const SQLException &)
188 Blob_BASE::disposing();
208 throw lang::IllegalArgumentException(
"nPosition out of range", *
this, 0);
224 uno::Sequence< sal_Int8 > aBytes;
260 catch (
const NotConnectedException&)
264 catch (
const BufferSizeExceededException&)
279 throw css::lang::WrappedTargetRuntimeException(
280 "wrapped Exception " + e.Message,
281 css::uno::Reference<css::uno::XInterface>(),
a);
286 const sal_Int32 nBytesToRead = std::min<sal_Int64>(nBytes, nBytesAvailable);
288 if (rDataOut.getLength() < nBytesToRead)
289 rDataOut.realloc(nBytesToRead);
291 sal_Int32 nTotalBytesRead = 0;
293 while (nTotalBytesRead < nBytesToRead)
295 sal_uInt16 nBytesRead = 0;
296 sal_uInt64 nDataRemaining = nBytesToRead - nTotalBytesRead;
297 sal_uInt16 nReadSize = std::min<sal_uInt64>(nDataRemaining,
SAL_MAX_UINT16);
302 reinterpret_cast<char*
>(rDataOut.getArray()) + nTotalBytesRead);
308 nTotalBytesRead += nBytesRead;
312 return nTotalBytesRead;
316 sal_Int32 nMaximumBytes)
321 return readBytes(rDataOut, nMaximumBytes);
328 uno::Sequence< sal_Int8 > aBytes;
341 catch (
const NotConnectedException&)
356 throw css::lang::WrappedTargetRuntimeException(
357 "wrapped Exception " + e.Message,
358 css::uno::Reference<css::uno::XInterface>(),
a);
370 catch (
const NotConnectedException&)
385 throw css::lang::WrappedTargetRuntimeException(
386 "wrapped Exception " + e.Message,
387 css::uno::Reference<css::uno::XInterface>(),
a);
virtual void SAL_CALL closeInput() override
void closeBlob()
Closes the blob and cleans up resources – can be used to reset the blob if we e.g.
sal_uInt16 m_nMaxSegmentSize
sal_Int64 m_nBlobPosition
virtual css::uno::Reference< css::io::XInputStream > SAL_CALL getBinaryStream() override
isc_db_handle * m_pDatabaseHandle
bool readOneSegment(std::vector< char > &rDataOut)
virtual sal_Int32 SAL_CALL readSomeBytes(css::uno::Sequence< sal_Int8 > &rDataOut, sal_Int32 nMaximumBytes) override
sal_uInt16 getMaximumSegmentSize()
isc_tr_handle * m_pTransactionHandle
virtual sal_Int32 SAL_CALL readBytes(css::uno::Sequence< sal_Int8 > &rDataOut, sal_Int32 nBytes) override
virtual sal_Int64 SAL_CALL position(const css::uno::Sequence< sal_Int8 > &rPattern, sal_Int64 aStart) override
virtual sal_Int64 SAL_CALL positionOfBlob(const css::uno::Reference< css::sdbc::XBlob > &rPattern, sal_Int64 aStart) override
virtual sal_Int32 SAL_CALL available() override
virtual void SAL_CALL disposing() override
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getBytes(sal_Int64 aPosition, sal_Int32 aLength) override
void ensureBlobIsOpened()
isc_blob_handle m_blobHandle
virtual void SAL_CALL skipBytes(sal_Int32 nBytes) override
virtual sal_Int64 SAL_CALL length() override
ISC_STATUS_ARRAY m_statusVector
#define TOOLS_WARN_EXCEPTION(area, stream)
if(aStr !=aBuf) UpdateName_Impl(m_xFollowLb.get()
bool IndicatesError(const ISC_STATUS_ARRAY &rStatusVector)
::cppu::WeakComponentImplHelper< css::sdbc::XBlob, css::io::XInputStream > Blob_BASE
void checkDisposed(bool _bThrow)
OUString StatusVectorToString(const ISC_STATUS_ARRAY &rStatusVector, std::u16string_view rCause)
void evaluateStatusVector(const ISC_STATUS_ARRAY &rStatusVector, std::u16string_view aCause, const css::uno::Reference< css::uno::XInterface > &_rxContext)
Evaluate a firebird status vector and throw exceptions as necessary.
Any SAL_CALL getCaughtException()