25#ifndef FBCPP_ATTACHMENT_H
26#define FBCPP_ATTACHMENT_H
56 return connectionCharSet;
64 connectionCharSet = value;
105 const std::optional<std::string>&
getRole()
const
122 const std::vector<std::uint8_t>&
getDpb()
const
141 dpb = std::move(value);
150 return createDatabase;
158 createDatabase = value;
163 std::optional<std::string> connectionCharSet;
164 std::optional<std::string> userName;
165 std::optional<std::string> password;
166 std::optional<std::string> role;
167 std::vector<std::uint8_t> dpb;
168 bool createDatabase =
false;
191 handle{std::move(o.handle)}
198 Attachment& operator=(
const Attachment&) =
delete;
209 disconnectOrDrop(
false);
224 return handle !=
nullptr;
254 void disconnectOrDrop(
bool drop);
Represents options used when creating an Attachment object.
AttachmentOptions & setConnectionCharSet(const std::string &value)
Sets the character set which will be used for the connection.
const std::optional< std::string > & getPassword() const
Returns the password which will be used to connect to the database.
AttachmentOptions & setPassword(const std::string &value)
Sets the password which will be used to connect to the database.
const std::optional< std::string > & getRole() const
Returns the role which will be used to connect to the database.
AttachmentOptions & setDpb(const std::vector< std::uint8_t > &value)
Sets the DPB (Database Parameter Block) which will be used to connect to the database.
AttachmentOptions & setRole(const std::string &value)
Sets the role which will be used to connect to the database.
AttachmentOptions & setDpb(std::vector< std::uint8_t > &&value)
Sets the DPB (Database Parameter Block) which will be used to connect to the database.
const std::vector< std::uint8_t > & getDpb() const
Returns the DPB (Database Parameter Block) which will be used to connect to the database.
AttachmentOptions & setCreateDatabase(bool value)
Sets whether the database should be created instead of connected to.
const std::optional< std::string > & getUserName() const
Returns the user name which will be used to connect to the database.
bool getCreateDatabase() const
Returns whether the database should be created instead of connected to.
const std::optional< std::string > & getConnectionCharSet() const
Returns the character set which will be used for the connection.
AttachmentOptions & setUserName(const std::string &value)
Sets the user name which will be used to connect to the database.
Represents a connection to a Firebird database.
Attachment(Client &client, const std::string &uri, const AttachmentOptions &options={})
Constructs an Attachment object that connects to (or creates) the database specified by the URI using...
Client & getClient() noexcept
Returns the Client object reference used to create this Attachment object.
void disconnect()
Disconnects from the database.
FbRef< fb::IAttachment > getHandle() noexcept
Returns the internal Firebird IAttachment handle.
~Attachment() noexcept
Disconnects from the database.
Attachment(Attachment &&o) noexcept
Move constructor.
bool isValid() noexcept
Returns whether the Attachment object is valid.
void dropDatabase()
Drops the database.
Represents a Firebird client library instance.