Version 4.3.0.0.beta1, tag libreoffice-4.3.0.0.beta1
[LibreOffice.git] / connectivity / source / drivers / firebird / Blob.hxx
blobbf8c2cfedf40524e5b34a0110624553df0ffdecc
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/compbase2.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::WeakComponentImplHelper2< ::com::sun::star::sdbc::XBlob,
25 ::com::sun::star::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 it's 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(::com::sun::star::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(::com::sun::star::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(::com::sun::star::sdbc::SQLException,
66 ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
67 virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL
68 getBytes(sal_Int64 aPosition, sal_Int32 aLength)
69 throw(::com::sun::star::sdbc::SQLException,
70 ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
71 virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL
72 getBinaryStream()
73 throw(::com::sun::star::sdbc::SQLException,
74 ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
75 virtual sal_Int64 SAL_CALL
76 position(const ::com::sun::star::uno::Sequence< sal_Int8 >& rPattern,
77 sal_Int64 aStart)
78 throw(::com::sun::star::sdbc::SQLException,
79 ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
80 virtual sal_Int64 SAL_CALL
81 positionOfBlob(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XBlob >& rPattern,
82 sal_Int64 aStart)
83 throw(::com::sun::star::sdbc::SQLException,
84 ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
86 // ---- XInputStream ----------------------------------------------
87 virtual sal_Int32 SAL_CALL
88 readBytes(::com::sun::star::uno::Sequence< sal_Int8 >& rDataOut,
89 sal_Int32 nBytes)
90 throw(::com::sun::star::io::NotConnectedException,
91 ::com::sun::star::io::BufferSizeExceededException,
92 ::com::sun::star::io::IOException,
93 ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
94 virtual sal_Int32 SAL_CALL
95 readSomeBytes(::com::sun::star::uno::Sequence< sal_Int8 >& rDataOut,
96 sal_Int32 nMaximumBytes)
97 throw(::com::sun::star::io::NotConnectedException,
98 ::com::sun::star::io::BufferSizeExceededException,
99 ::com::sun::star::io::IOException,
100 ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
101 virtual void SAL_CALL
102 skipBytes(sal_Int32 nBytes)
103 throw(::com::sun::star::io::NotConnectedException,
104 ::com::sun::star::io::BufferSizeExceededException,
105 ::com::sun::star::io::IOException,
106 ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
107 virtual sal_Int32 SAL_CALL
108 available()
109 throw(::com::sun::star::io::NotConnectedException,
110 ::com::sun::star::io::IOException,
111 ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
112 virtual void SAL_CALL
113 closeInput()
114 throw(::com::sun::star::io::NotConnectedException,
115 ::com::sun::star::io::IOException,
116 ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
118 // ---- OComponentHelper ------------------------------------------
119 virtual void SAL_CALL disposing() SAL_OVERRIDE;
125 #endif // INCLUDED_CONNECTIVITY_SOURCE_DRIVERS_FIREBIRD_BLOB_HXX
126 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */