28#include "fb-cpp-export.h"
31#include "Descriptor.h"
61 NONE = fb::IBatch::BLOB_NONE,
71 ID_USER = fb::IBatch::BLOB_ID_USER,
76 STREAM = fb::IBatch::BLOB_STREAM,
118 recordCounts = value;
127 return bufferBytesSize;
135 bufferBytesSize = value;
161 return detailedErrors;
169 detailedErrors = value;
174 bool multiError =
false;
175 bool recordCounts =
false;
176 std::optional<unsigned> bufferBytesSize;
178 unsigned detailedErrors = 64;
192 static constexpr int EXECUTE_FAILED = fb::IBatchCompletionState::EXECUTE_FAILED;
197 static constexpr int SUCCESS_NO_INFO = fb::IBatchCompletionState::SUCCESS_NO_INFO;
236 int getState(
unsigned pos);
243 std::optional<unsigned> findError(
unsigned pos);
250 std::vector<std::intptr_t> getStatus(
unsigned pos);
254 impl::StatusWrapper statusWrapper;
334 return handle !=
nullptr;
347 void add(
unsigned count,
const void* inBuffer);
380 void appendBlobData(std::span<const std::byte> data);
385 void addBlobStream(std::span<const std::byte> data);
391 BlobId registerBlob(
const BlobId& existingBlob);
396 void setDefaultBpb(
const BlobOptions& bpb);
401 unsigned getBlobAlignment();
415 BatchCompletionState execute();
430 FbRef<fb::IMessageMetadata> getInputMetadata();
435 const std::vector<Descriptor>& getInputDescriptors();
442 std::vector<std::uint8_t> buildParametersBlock(
const BatchOptions& options);
443 std::vector<std::uint8_t> prepareBpb(
const BlobOptions& bpb);
444 void buildInputDescriptors();
448 Transaction* transaction;
449 Statement* statement =
nullptr;
450 impl::StatusWrapper statusWrapper;
451 FbRef<fb::IBatch> handle;
452 std::vector<Descriptor> inputDescriptors;
Represents a connection to a Firebird database.
Wraps IBatchCompletionState to provide RAII-safe access to batch execution results.
BatchCompletionState & operator=(BatchCompletionState &&)=delete
Move assignment is not supported.
BatchCompletionState & operator=(const BatchCompletionState &)=delete
Copy assignment is not supported.
BatchCompletionState(const BatchCompletionState &)=delete
Copy construction is not supported.
Configuration options for creating a Batch.
BatchOptions & setRecordCounts(bool value)
Enables or disables per-message affected row counts.
std::optional< unsigned > getBufferBytesSize() const
Returns the batch buffer size in bytes, or nullopt for the server default.
BatchOptions & setBlobPolicy(BlobPolicy value)
Sets the blob handling policy.
bool getRecordCounts() const
Returns whether per-message affected row counts are reported.
unsigned getDetailedErrors() const
Returns the maximum number of detailed error statuses to collect.
BatchOptions & setDetailedErrors(unsigned value)
Sets the maximum number of detailed error statuses to collect.
BlobPolicy getBlobPolicy() const
Returns the blob handling policy.
BatchOptions & setMultiError(bool value)
Enables or disables collection of multiple errors per execution.
bool getMultiError() const
Returns whether multiple errors are collected per execution.
BatchOptions & setBufferBytesSize(unsigned value)
Sets the batch buffer size in bytes.
Wraps the Firebird IBatch interface for bulk DML operations.
Batch & operator=(const Batch &)=delete
Copy assignment is not supported.
Batch(const Batch &)=delete
Copy construction is not supported.
bool isValid() const noexcept
Returns whether the batch handle is valid.
Batch & operator=(Batch &&)=delete
Move assignment is not supported.
~Batch() noexcept
Closes the batch handle if still valid.
Represents a Firebird blob identifier.
Additional options used when creating or opening blobs.
Represents a Firebird client library instance.
Prepares, executes, and fetches SQL statements against a Firebird attachment.
Represents a transaction in one or more Firebird databases.
BlobPolicy
Selects the blob handling policy for a Batch.
@ ID_ENGINE
Batch-local blob IDs are generated by the Firebird engine.
@ STREAM
Blobs are sent inline as a stream.
@ NONE
Blobs are not allowed in the batch.
@ ID_USER
Batch-local blob IDs are generated by the caller.
std::unique_ptr< T, impl::FbDisposeDeleter > FbUniquePtr
Unique pointer type for Firebird disposable objects.