cid#1636677 Uninitialized scalar field
[LibreOffice.git] / connectivity / source / drivers / firebird / Blob.hxx
blob990108934bf262a737643f10158eac864bc1c4d6
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
2 /*
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/.
8 */
10 #pragma once
12 #include <ibase.h>
14 #include <cppuhelper/compbase.hxx>
16 #include <com/sun/star/io/XInputStream.hpp>
17 #include <com/sun/star/sdbc/XBlob.hpp>
19 #include <vector>
21 namespace connectivity::firebird
23 typedef ::cppu::WeakComponentImplHelper< css::sdbc::XBlob,
24 css::io::XInputStream >
25 Blob_BASE;
27 class Blob :
28 public Blob_BASE
30 protected:
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
37 // in firebird.
38 ISC_QUAD m_blobID;
39 isc_blob_handle m_blobHandle;
41 bool m_bBlobOpened;
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();
50 /**
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
56 void closeBlob();
57 sal_uInt16 getMaximumSegmentSize();
59 public:
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
68 length() override;
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;
87 virtual void SAL_CALL
88 skipBytes(sal_Int32 nBytes) override;
89 virtual sal_Int32 SAL_CALL
90 available() override;
91 virtual void 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: */