|
StormByte C++ Library: Database module 0.0.9999
StormByte-Database is a StormByte library module for handling database connections
|
Abstract database class for database handling. More...
#include <database.hxx>

Public Member Functions | |
| Database (std::shared_ptr< Logger::Log > logger) noexcept | |
| Default constructor. | |
| Database (const Database &other)=delete | |
| Default copy constructor (deleted) | |
| Database (Database &&other)=default | |
| Default move constructor. | |
| Database & | operator= (const Database &other)=delete |
| Default copy assignment operator (deleted) | |
| Database & | operator= (Database &&other)=default |
| Default move assignment operator. | |
| virtual | ~Database ()=default |
| Default destructor. | |
| bool | Connect () noexcept |
| Connects to the database. | |
| virtual void | Disconnect () noexcept |
| Disconnects from the database. | |
| bool | IsConnected () const noexcept |
| Checks if the database is connected. | |
| template<typename... Args> | |
| ExpectedRows | ExecuteSTMT (const std::string &name, Args &&... args) |
| virtual ExpectedRows | Query (const std::string &query)=0 |
| virtual bool | SilentQuery (const std::string &query) noexcept=0 |
| virtual void | BeginTransaction () |
| virtual void | BeginExclusiveTransaction () |
| virtual void | CommitTransaction () |
| virtual void | RollbackTransaction () |
Protected Member Functions | |
| virtual void | DoPreConnect () noexcept |
| Pre-connect action Default is a noop. | |
| virtual bool | DoConnect () noexcept=0 |
| Connects to the database. | |
| virtual void | DoPostConnect () noexcept |
| Post-connect action Default is a noop. | |
| virtual void | DoPreDisconnect () noexcept |
| Pre-disconnect action Default is a noop. | |
| virtual void | DoDisconnect () noexcept=0 |
| Disconnects from the database. | |
| virtual void | DoPostDisconnect () noexcept |
| Post-disconnect action Default is a noop. | |
| virtual std::unique_ptr< PreparedSTMT > | CreatePreparedSTMT (std::string &&name, std::string &&query) noexcept=0 |
| Creates a prepared statement. | |
| void | PrepareSTMT (std::string &&name, std::string &&query) noexcept |
Protected Attributes | |
| std::shared_ptr< Logger::Log > | m_logger |
| Logger instance. | |
| std::unordered_map< std::string, std::unique_ptr< PreparedSTMT > > | m_prepared_stmts |
| Prepared statements. | |
| bool | m_connected |
| Connection state. | |
Abstract database class for database handling.
|
delete |
Default copy constructor (deleted)
| other | Other Database to copy from |
|
default |
Default move constructor.
| other | Other Database to move from |
|
inlinevirtual |
Begins an exclusive transaction
|
inlinevirtual |
Begins a transaction
|
inlinevirtual |
Commits the transaction
|
protectedpure virtualnoexcept |
Creates a prepared statement.
| name | The name of the prepared statement |
| query | The query to prepare |
|
protectedpure virtualnoexcept |
Connects to the database.
|
inline |
Executes a prepared statement
| Args | Types of the arguments |
| name | The name of the prepared statement |
| args | Arguments to bind and execute |
|
inlinenoexcept |
Checks if the database is connected.
|
protectednoexcept |
Prepares a statement
| name | The name of the prepared statement |
| query | The query to prepare |
|
pure virtual |
Executes a query
| query | The query to execute. |
Implemented in StormByte::Database::MariaDB::MariaDB, StormByte::Database::Postgres::Postgres, and StormByte::Database::SQLite::SQLite3.
|
inlinevirtual |
Rolls back the transaction
|
pure virtualnoexcept |
Executes a query without returning any result
| query | The query to execute. |
Implemented in StormByte::Database::MariaDB::MariaDB, StormByte::Database::Postgres::Postgres, and StormByte::Database::SQLite::SQLite3.