2
* The contents of this file are subject to the Initial
3
* Developer's Public License Version 1.0 (the "License");
4
* you may not use this file except in compliance with the
5
* License. You may obtain a copy of the License at
6
* http://www.ibphoenix.com/main.nfs?a=ibphoenix&page=ibp_idpl.
8
* Software distributed under the License is distributed AS IS,
9
* WITHOUT WARRANTY OF ANY KIND, either express or implied.
10
* See the License for the specific language governing rights
11
* and limitations under the License.
13
* The Original Code was created by Claudio Valderrama on 16-Mar-2007
14
* for the Firebird Open Source RDBMS project.
16
* Copyright (c) 2007 Claudio Valderrama
17
* and all contributors signed below.
19
* All Rights Reserved.
20
* Contributor(s): ______________________________________.
24
#ifndef FB_USER_BLOB_H
25
#define FB_USER_BLOB_H
33
explicit UserBlob(ISC_STATUS* status);
35
bool open(FB_API_HANDLE& db, FB_API_HANDLE& trans, ISC_QUAD& blobid);
36
bool open(FB_API_HANDLE& db, FB_API_HANDLE& trans, ISC_QUAD& blobid,
37
USHORT bpb_len, const UCHAR* bpb);
38
bool create(FB_API_HANDLE& db, FB_API_HANDLE& trans, ISC_QUAD& blobid);
39
bool create(FB_API_HANDLE& db, FB_API_HANDLE& trans, ISC_QUAD& blobid,
40
USHORT bpb_len, const UCHAR* bpb);
41
bool close(bool force_internal_SV = false);
42
bool getSegment(size_t len, void* buffer, size_t& real_len);
43
bool getData(size_t len, void* buffer, size_t& real_len, bool use_sep, const UCHAR separator);
44
bool putSegment(size_t len, const void* buffer);
45
bool putSegment(size_t len, const void* buffer, size_t& real_len);
46
bool putData(size_t len, const void* buffer, size_t& real_len);
48
ISC_STATUS getCode() const;
49
// FB_API_HANDLE& getHandle();
50
bool getInfo(size_t items_size, const UCHAR* blr_items, size_t info_size, UCHAR* blob_info) const;
51
static bool blobIsNull(const ISC_QUAD& blobid);
59
ISC_STATUS* const m_status;
61
b_direction m_direction;
62
ISC_STATUS_ARRAY m_default_status;
66
inline UserBlob::UserBlob(ISC_STATUS* status)
67
: m_status(status ? status : m_default_status), m_blob(0), m_direction(dir_none)
69
memset(m_default_status, 0, sizeof(m_default_status));
72
inline UserBlob::~UserBlob()
77
inline bool UserBlob::isOpen() const
79
return m_blob != 0 && m_direction != dir_none;
82
// Do not call it after close(true) unless you did open() or create() again!!!
83
inline ISC_STATUS UserBlob::getCode() const
88
//inline FB_API_HANDLE& UserBlob::getHandle()
93
inline bool UserBlob::blobIsNull(const ISC_QUAD& blobid)
95
return blobid.gds_quad_high == 0 && blobid.gds_quad_low == 0;
99
bool getBlobSize( const UserBlob& b,
105
#endif // FB_USER_BLOB_H