57 return id.gds_quad_high == 0 &&
id.gds_quad_low == 0;
72 MAIN = isc_bpb_storage_main,
73 TEMPORARY = isc_bpb_storage_temp
81 SEGMENTED = isc_bpb_type_segmented,
82 STREAM = isc_bpb_type_stream
94 const std::vector<std::uint8_t>&
getBpb() const noexcept
113 bpb = std::move(value);
173 return sourceCharSet;
181 sourceCharSet = value;
190 return targetCharSet;
198 targetCharSet = value;
220 std::vector<std::uint8_t> bpb;
221 std::optional<BlobType> type;
222 std::optional<BlobType> sourceType;
223 std::optional<BlobType> targetType;
224 std::optional<std::int16_t> sourceCharSet;
225 std::optional<std::int16_t> targetCharSet;
226 std::optional<BlobStorage> storage;
235 FROM_CURRENT = blb_seek_relative,
236 FROM_END = blb_seek_from_tail
259 : attachment{o.attachment},
260 transaction{o.transaction},
262 status{std::move(o.status)},
263 statusWrapper{std::move(o.statusWrapper)},
264 handle{std::move(o.handle)}
307 return handle !=
nullptr;
334 unsigned read(std::span<std::byte> buffer);
339 unsigned read(std::span<char> buffer)
341 return read(std::as_writable_bytes(buffer));
354 return readSegment(std::as_writable_bytes(buffer));
360 void write(std::span<const std::byte> buffer);
365 void write(std::span<const char> buffer)
367 write(std::as_bytes(buffer));
399 std::vector<std::uint8_t> prepareBpb(
const BlobOptions& options);
405 FbUniquePtr<fb::IStatus> status;
406 impl::StatusWrapper statusWrapper;
Represents a connection to a Firebird database.
Represents a Firebird blob identifier.
bool isEmpty() const noexcept
Returns whether this blob identifier is empty.
Additional options used when creating or opening blobs.
BlobOptions & setBpb(const std::vector< std::uint8_t > &value)
Sets the blob parameter block (BPB) using a copy of the provided value.
const std::optional< BlobType > getSourceType() const
Retrieves the source blob subtype.
const std::optional< BlobType > getType() const
Retrieves the blob type to be used for blob operations.
const std::optional< BlobType > getTargetType() const
Retrieves the target blob subtype.
BlobOptions & setType(BlobType value)
Sets the blob type to be used for blob operations.
BlobOptions & setTargetCharSet(std::int16_t value)
Sets the target character set identifier.
BlobOptions & setStorage(BlobStorage value)
Sets the blob storage mode.
const std::optional< BlobStorage > getStorage() const
Retrieves the blob storage mode.
BlobOptions & setTargetType(BlobType value)
Sets the target blob subtype.
const std::vector< std::uint8_t > & getBpb() const noexcept
Retrieves the blob parameter block (BPB) used during blob operations.
BlobOptions & setBpb(std::vector< std::uint8_t > &&value)
Sets the blob parameter block (BPB) by moving the provided value.
const std::optional< std::int16_t > getTargetCharSet() const
Retrieves the target character set identifier.
BlobOptions & setSourceCharSet(std::int16_t value)
Sets the source character set identifier.
const std::optional< std::int16_t > getSourceCharSet() const
Retrieves the source character set identifier.
BlobOptions & setSourceType(BlobType value)
Sets the source blob subtype.
Provides read and write access to Firebird blobs.
bool isValid() const noexcept
Returns whether the blob handle is valid.
Blob(const Blob &)=delete
Copy construction is not supported.
unsigned read(std::span< char > buffer)
Reads data from the blob into the provided buffer.
Blob(Blob &&o) noexcept
Transfers blob ownership from another instance.
unsigned read(std::span< std::byte > buffer)
Reads data from the blob into the provided buffer.
unsigned readSegment(std::span< char > buffer)
Reads a single segment from the blob into the provided buffer.
unsigned getLength()
Retrieves the length of the blob in bytes.
void write(std::span< const char > buffer)
Writes data from the buffer into the blob.
void cancel()
Cancels any changes performed on the blob and releases the handle.
~Blob() noexcept
Automatically closes the blob if still open.
Blob & operator=(Blob &&)=delete
Move assignment is not supported.
void writeSegment(std::span< const char > buffer)
Writes a single segment from the buffer into the blob.
const BlobId & getId() const noexcept
Provides access to the current blob identifier.
void write(std::span< const std::byte > buffer)
Writes data from the buffer into the blob.
int seek(BlobSeekMode mode, int offset)
Repositions the blob read/write cursor.
unsigned readSegment(std::span< std::byte > buffer)
Reads a single segment from the blob into the provided buffer.
Blob & operator=(const Blob &)=delete
Copy assignment is not supported.
void writeSegment(std::span< const std::byte > buffer)
Writes a single segment from the buffer into the blob.
FbRef< fb::IBlob > getHandle() noexcept
Exposes the underlying Firebird blob handle.
void close()
Closes the blob and finalizes any pending changes.
Represents a transaction in a Firebird database.
BlobStorage
Blob storage options.
BlobSeekMode
Defines the origin used when repositioning a blob.