build fix
[LibreOffice.git] / connectivity / source / drivers / firebird / Blob.hxx
blob89daeac839ff888c0e1f09e43048a8f8b544ac58
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 #ifndef INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_FIREBIRD_BLOB_HXX
11 #define INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_FIREBIRD_BLOB_HXX
13 #include <ibase.h>
15 #include <cppuhelper/compbase.hxx>
17 #include <com/sun/star/io/XInputStream.hpp>
18 #include <com/sun/star/sdbc/XBlob.hpp>
20 namespace connectivity
22 namespace firebird
24 typedef ::cppu::WeakComponentImplHelper< css::sdbc::XBlob,
25 css::io::XInputStream >
26 Blob_BASE;
28 class Blob :
29 public Blob_BASE
31 protected:
32 ::osl::Mutex m_aMutex;
34 isc_db_handle* m_pDatabaseHandle;
35 isc_tr_handle* m_pTransactionHandle;
36 // We store our own copy of the blob id as typically the statement
37 // manages its own blob id, and blobs are independent of a statement
38 // in firebird.
39 ISC_QUAD m_blobID;
40 isc_blob_handle m_blobHandle;
42 bool m_bBlobOpened;
43 sal_Int64 m_nBlobLength;
44 sal_Int64 m_nBlobPosition;
46 ISC_STATUS_ARRAY m_statusVector;
48 void ensureBlobIsOpened()
49 throw(css::sdbc::SQLException);
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 void closeBlob()
55 throw(css::sdbc::SQLException);
57 public:
58 Blob(isc_db_handle* pDatabaseHandle,
59 isc_tr_handle* pTransactionHandle,
60 ISC_QUAD& aBlobID);
62 // ---- XBlob ----------------------------------------------------
63 virtual sal_Int64 SAL_CALL
64 length()
65 throw(css::sdbc::SQLException,
66 css::uno::RuntimeException, std::exception) override;
67 virtual css::uno::Sequence< sal_Int8 > SAL_CALL
68 getBytes(sal_Int64 aPosition, sal_Int32 aLength)
69 throw(css::sdbc::SQLException,
70 css::uno::RuntimeException, std::exception) override;
71 virtual css::uno::Reference< css::io::XInputStream > SAL_CALL
72 getBinaryStream()
73 throw(css::sdbc::SQLException,
74 css::uno::RuntimeException, std::exception) override;
75 virtual sal_Int64 SAL_CALL
76 position(const css::uno::Sequence< sal_Int8 >& rPattern,
77 sal_Int64 aStart)
78 throw(css::sdbc::SQLException,
79 css::uno::RuntimeException, std::exception) override;
80 virtual sal_Int64 SAL_CALL
81 positionOfBlob(const css::uno::Reference< css::sdbc::XBlob >& rPattern,
82 sal_Int64 aStart)
83 throw(css::sdbc::SQLException,
84 css::uno::RuntimeException, std::exception) override;
86 // ---- XInputStream ----------------------------------------------
87 virtual sal_Int32 SAL_CALL
88 readBytes(css::uno::Sequence< sal_Int8 >& rDataOut,
89 sal_Int32 nBytes)
90 throw(css::io::NotConnectedException,
91 css::io::BufferSizeExceededException,
92 css::io::IOException,
93 css::uno::RuntimeException, std::exception) override;
94 virtual sal_Int32 SAL_CALL
95 readSomeBytes(css::uno::Sequence< sal_Int8 >& rDataOut,
96 sal_Int32 nMaximumBytes)
97 throw(css::io::NotConnectedException,
98 css::io::BufferSizeExceededException,
99 css::io::IOException,
100 css::uno::RuntimeException, std::exception) override;
101 virtual void SAL_CALL
102 skipBytes(sal_Int32 nBytes)
103 throw(css::io::NotConnectedException,
104 css::io::BufferSizeExceededException,
105 css::io::IOException,
106 css::uno::RuntimeException, std::exception) override;
107 virtual sal_Int32 SAL_CALL
108 available()
109 throw(css::io::NotConnectedException,
110 css::io::IOException,
111 css::uno::RuntimeException, std::exception) override;
112 virtual void SAL_CALL
113 closeInput()
114 throw(css::io::NotConnectedException,
115 css::io::IOException,
116 css::uno::RuntimeException, std::exception) override;
118 // ---- OComponentHelper ------------------------------------------
119 virtual void SAL_CALL disposing() override;
125 #endif // INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_FIREBIRD_BLOB_HXX
126 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */