LibreOffice Module connectivity (master) 1
drivers/firebird/Blob.hxx
Go to the documentation of this file.
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.
4 *
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 */
9
10#pragma once
11
12#include <ibase.h>
13
15
16#include <com/sun/star/io/XInputStream.hpp>
17#include <com/sun/star/sdbc/XBlob.hpp>
18
19#include <vector>
20
22 {
23 typedef ::cppu::WeakComponentImplHelper< css::sdbc::XBlob,
24 css::io::XInputStream >
26
27 class Blob :
28 public Blob_BASE
29 {
30 protected:
31 ::osl::Mutex m_aMutex;
32
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;
40
42 sal_Int64 m_nBlobLength;
44 sal_Int64 m_nBlobPosition;
45
46 ISC_STATUS_ARRAY m_statusVector;
47
49 void ensureBlobIsOpened();
56 void closeBlob();
57 sal_uInt16 getMaximumSegmentSize();
58
59 public:
60 Blob(isc_db_handle* pDatabaseHandle,
61 isc_tr_handle* pTransactionHandle,
62 ISC_QUAD const & aBlobID);
63
64 bool readOneSegment(std::vector<char>& rDataOut);
65
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;
79
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;
93
94 // ---- OComponentHelper ------------------------------------------
95 virtual void SAL_CALL disposing() override;
96 };
97
98}
99
100/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
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.
virtual css::uno::Reference< css::io::XInputStream > SAL_CALL getBinaryStream() override
bool readOneSegment(std::vector< char > &rDataOut)
virtual sal_Int32 SAL_CALL readSomeBytes(css::uno::Sequence< sal_Int8 > &rDataOut, sal_Int32 nMaximumBytes) override
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
virtual void SAL_CALL skipBytes(sal_Int32 nBytes) override
Blob(isc_db_handle *pDatabaseHandle, isc_tr_handle *pTransactionHandle, ISC_QUAD const &aBlobID)
virtual sal_Int64 SAL_CALL length() override
::cppu::WeakComponentImplHelper< css::sdbc::XBlob, css::io::XInputStream > Blob_BASE