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>
19 namespace connectivity::firebird
21 typedef ::cppu::WeakComponentImplHelper
< css::sdbc::XBlob
,
22 css::io::XInputStream
>
29 ::osl::Mutex m_aMutex
;
31 isc_db_handle
* m_pDatabaseHandle
;
32 isc_tr_handle
* m_pTransactionHandle
;
33 // We store our own copy of the blob id as typically the statement
34 // manages its own blob id, and blobs are independent of a statement
37 isc_blob_handle m_blobHandle
;
40 sal_Int64 m_nBlobLength
;
41 sal_uInt16 m_nMaxSegmentSize
;
42 sal_Int64 m_nBlobPosition
;
44 ISC_STATUS_ARRAY m_statusVector
;
46 /// @throws css::sdbc::SQLException
47 void ensureBlobIsOpened();
49 * Closes the blob and cleans up resources -- can be used to reset
50 * the blob if we e.g. want to read from the beginning again.
52 * @throws css::sdbc::SQLException
55 sal_uInt16
getMaximumSegmentSize();
58 Blob(isc_db_handle
* pDatabaseHandle
,
59 isc_tr_handle
* pTransactionHandle
,
60 ISC_QUAD
const & aBlobID
);
62 bool readOneSegment(css::uno::Sequence
< sal_Int8
>& rDataOut
);
64 // ---- XBlob ----------------------------------------------------
65 virtual sal_Int64 SAL_CALL
67 virtual css::uno::Sequence
< sal_Int8
> SAL_CALL
68 getBytes(sal_Int64 aPosition
, sal_Int32 aLength
) override
;
69 virtual css::uno::Reference
< css::io::XInputStream
> SAL_CALL
70 getBinaryStream() override
;
71 virtual sal_Int64 SAL_CALL
72 position(const css::uno::Sequence
< sal_Int8
>& rPattern
,
73 sal_Int64 aStart
) override
;
74 virtual sal_Int64 SAL_CALL
75 positionOfBlob(const css::uno::Reference
< css::sdbc::XBlob
>& rPattern
,
76 sal_Int64 aStart
) override
;
78 // ---- XInputStream ----------------------------------------------
79 virtual sal_Int32 SAL_CALL
80 readBytes(css::uno::Sequence
< sal_Int8
>& rDataOut
,
81 sal_Int32 nBytes
) override
;
82 virtual sal_Int32 SAL_CALL
83 readSomeBytes(css::uno::Sequence
< sal_Int8
>& rDataOut
,
84 sal_Int32 nMaximumBytes
) override
;
86 skipBytes(sal_Int32 nBytes
) override
;
87 virtual sal_Int32 SAL_CALL
90 closeInput() override
;
92 // ---- OComponentHelper ------------------------------------------
93 virtual void SAL_CALL
disposing() override
;
98 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */