1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
14 #include <cppuhelper/compbase.hxx>
16 #include <com/sun/star/io/XInputStream.hpp>
17 #include <com/sun/star/sdbc/XBlob.hpp>
21 namespace connectivity::firebird
23 typedef ::cppu::WeakComponentImplHelper
< css::sdbc::XBlob
,
24 css::io::XInputStream
>
31 ::osl::Mutex m_aMutex
;
33 isc_db_handle
* m_pDatabaseHandle
;
34 isc_tr_handle
* m_pTransactionHandle
;
35 // We store our own copy of the blob id as typically the statement
36 // manages its own blob id, and blobs are independent of a statement
39 isc_blob_handle m_blobHandle
;
42 sal_Int64 m_nBlobLength
;
43 sal_uInt16 m_nMaxSegmentSize
;
44 sal_Int64 m_nBlobPosition
;
46 ISC_STATUS_ARRAY m_statusVector
;
48 /// @throws css::sdbc::SQLException
49 void ensureBlobIsOpened();
51 * Closes the blob and cleans up resources -- can be used to reset
52 * the blob if we e.g. want to read from the beginning again.
54 * @throws css::sdbc::SQLException
57 sal_uInt16
getMaximumSegmentSize();
60 Blob(isc_db_handle
* pDatabaseHandle
,
61 isc_tr_handle
* pTransactionHandle
,
62 ISC_QUAD
const & aBlobID
);
64 bool readOneSegment(std::vector
<char>& rDataOut
);
66 // ---- XBlob ----------------------------------------------------
67 virtual sal_Int64 SAL_CALL
69 virtual css::uno::Sequence
< sal_Int8
> SAL_CALL
70 getBytes(sal_Int64 aPosition
, sal_Int32 aLength
) override
;
71 virtual css::uno::Reference
< css::io::XInputStream
> SAL_CALL
72 getBinaryStream() override
;
73 virtual sal_Int64 SAL_CALL
74 position(const css::uno::Sequence
< sal_Int8
>& rPattern
,
75 sal_Int64 aStart
) override
;
76 virtual sal_Int64 SAL_CALL
77 positionOfBlob(const css::uno::Reference
< css::sdbc::XBlob
>& rPattern
,
78 sal_Int64 aStart
) override
;
80 // ---- XInputStream ----------------------------------------------
81 virtual sal_Int32 SAL_CALL
82 readBytes(css::uno::Sequence
< sal_Int8
>& rDataOut
,
83 sal_Int32 nBytes
) override
;
84 virtual sal_Int32 SAL_CALL
85 readSomeBytes(css::uno::Sequence
< sal_Int8
>& rDataOut
,
86 sal_Int32 nMaximumBytes
) override
;
88 skipBytes(sal_Int32 nBytes
) override
;
89 virtual sal_Int32 SAL_CALL
92 closeInput() override
;
94 // ---- OComponentHelper ------------------------------------------
95 virtual void SAL_CALL
disposing() override
;
100 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */