Sese Framework
2.3.0
A cross-platform framework
|
Database-driven instance class. More...
#include <DriverInstance.h>
Public Types | |
using | Ptr = std::unique_ptr<DriverInstance> |
Public Member Functions | |
virtual | ~DriverInstance () noexcept=default |
Destructors. | |
virtual ResultSet::Ptr | executeQuery (const char *sql) noexcept=0 |
virtual int64_t | executeUpdate (const char *sql) noexcept=0 |
virtual PreparedStatement::Ptr | createStatement (const char *sql) noexcept=0 |
virtual int | getLastError () const noexcept=0 |
virtual const char * | getLastErrorMessage () const noexcept=0 |
virtual bool | setAutoCommit (bool enable) noexcept=0 |
virtual bool | getAutoCommit (bool &status) noexcept=0 |
virtual bool | rollback () noexcept=0 |
virtual bool | commit () noexcept=0 |
virtual bool | getInsertId (int64_t &id) const noexcept=0 |
virtual bool | begin () noexcept=0 |
ErrorCode | getErrorCode () const |
Database-driven instance class.
using sese::db::DriverInstance::Ptr = std::unique_ptr<DriverInstance> |
|
virtualdefaultnoexcept |
Destructors.
|
nodiscardpure virtualnoexcept |
Starts the transaction
false | If the transaction start fails |
Implemented in sese::db::impl::MariaDriverInstanceImpl, sese::db::impl::PostgresDriverInstanceImpl, and sese::db::impl::SqliteDriverInstanceImpl.
|
nodiscardpure virtualnoexcept |
Commits the transaction
false | If the commit fails |
Implemented in sese::db::impl::MariaDriverInstanceImpl, sese::db::impl::PostgresDriverInstanceImpl, and sese::db::impl::SqliteDriverInstanceImpl.
|
pure virtualnoexcept |
Creates a prepared statement object
sql | The SQL query string |
nullptr | If creation fails |
Implemented in sese::db::impl::MariaDriverInstanceImpl, sese::db::impl::PostgresDriverInstanceImpl, and sese::db::impl::SqliteDriverInstanceImpl.
|
pure virtualnoexcept |
Execute the query
sql | Query statements |
nullptr | Query failed |
Implemented in sese::db::impl::MariaDriverInstanceImpl, sese::db::impl::PostgresDriverInstanceImpl, and sese::db::impl::SqliteDriverInstanceImpl.
|
pure virtualnoexcept |
Execute the update
sql | Update statements |
-1 | Execution failed |
Implemented in sese::db::impl::MariaDriverInstanceImpl, sese::db::impl::PostgresDriverInstanceImpl, and sese::db::impl::SqliteDriverInstanceImpl.
|
nodiscardpure virtualnoexcept |
Checks whether auto-commit is enabled
false | If the operation fails |
Implemented in sese::db::impl::MariaDriverInstanceImpl, sese::db::impl::PostgresDriverInstanceImpl, and sese::db::impl::SqliteDriverInstanceImpl.
|
inline |
References getLastError(), and getLastErrorMessage().
|
nodiscardpure virtualnoexcept |
Retrieves the auto-incremented ID
false | If the retrieval fails |
Implemented in sese::db::impl::MariaDriverInstanceImpl, sese::db::impl::PostgresDriverInstanceImpl, and sese::db::impl::SqliteDriverInstanceImpl.
|
nodiscardpure virtualnoexcept |
Retrieves the error code corresponding to the instance's driver
Implemented in sese::db::impl::MariaDriverInstanceImpl, sese::db::impl::PostgresDriverInstanceImpl, and sese::db::impl::SqliteDriverInstanceImpl.
Referenced by getErrorCode().
|
nodiscardpure virtualnoexcept |
Retrieves the error message corresponding to the instance's driver (null check required)
Implemented in sese::db::impl::MariaDriverInstanceImpl, sese::db::impl::PostgresDriverInstanceImpl, and sese::db::impl::SqliteDriverInstanceImpl.
Referenced by getErrorCode().
|
nodiscardpure virtualnoexcept |
Rolls back the transaction
false | If the rollback fails |
Implemented in sese::db::impl::MariaDriverInstanceImpl, sese::db::impl::PostgresDriverInstanceImpl, and sese::db::impl::SqliteDriverInstanceImpl.
|
nodiscardpure virtualnoexcept |
Sets the transaction auto-commit mode
begin()
to start a transaction when using PostgreSQL. begin()
to start a transaction when using SQLite. enable | Enable or disable auto-commit mode |
false | If the operation fails |
Implemented in sese::db::impl::MariaDriverInstanceImpl, sese::db::impl::PostgresDriverInstanceImpl, and sese::db::impl::SqliteDriverInstanceImpl.