StormByte C++ Library: Database module 0.0.9999
StormByte-Database is a StormByte library module for handling database connections
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | List of all members
StormByte::Database::MariaDB::MariaDB Class Reference

MariaDB database implementation. More...

#include <mariadb.hxx>

Inheritance diagram for StormByte::Database::MariaDB::MariaDB:
Inheritance graph
[legend]
Collaboration diagram for StormByte::Database::MariaDB::MariaDB:
Collaboration graph
[legend]

Public Member Functions

 MariaDB (const MariaDB &db)=delete
 
 MariaDB (MariaDB &&db) noexcept=default
 
MariaDBoperator= (const MariaDB &db)=delete
 
MariaDBoperator= (MariaDB &&db) noexcept=default
 
ExpectedRows Query (const std::string &query) noexcept override
 
bool SilentQuery (const std::string &query) noexcept override
 
- Public Member Functions inherited from StormByte::Database::Database
 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.
 
Databaseoperator= (const Database &other)=delete
 Default copy assignment operator (deleted)
 
Databaseoperator= (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 void BeginTransaction ()
 
virtual void BeginExclusiveTransaction ()
 
virtual void CommitTransaction ()
 
virtual void RollbackTransaction ()
 

Protected Member Functions

 MariaDB (const std::string &host, const std::string &user, const std::string &password, const std::string &db_name, int port, std::shared_ptr< Logger::Log > logger)
 
 MariaDB (std::string &&host, std::string &&user, std::string &&password, std::string &&db_name, int port, std::shared_ptr< Logger::Log > logger)
 
- Protected Member Functions inherited from StormByte::Database::Database
virtual void DoPreConnect () noexcept
 Pre-connect action Default is a noop.
 
virtual void DoPostConnect () noexcept
 Post-connect action Default is a noop.
 
virtual void DoPostDisconnect () noexcept
 Post-disconnect action Default is a noop.
 
void PrepareSTMT (std::string &&name, std::string &&query) noexcept
 

Additional Inherited Members

- Protected Attributes inherited from StormByte::Database::Database
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.
 

Detailed Description

MariaDB database implementation.

Constructor & Destructor Documentation

◆ MariaDB() [1/2]

StormByte::Database::MariaDB::MariaDB::MariaDB ( const std::string &  host,
const std::string &  user,
const std::string &  password,
const std::string &  db_name,
int  port,
std::shared_ptr< Logger::Log >  logger 
)
protected

Constructor

Parameters
hostThe database host
userThe database user
passwordThe database password
db_nameThe database name
portThe database port
loggerLogger instance

◆ MariaDB() [2/2]

StormByte::Database::MariaDB::MariaDB::MariaDB ( std::string &&  host,
std::string &&  user,
std::string &&  password,
std::string &&  db_name,
int  port,
std::shared_ptr< Logger::Log >  logger 
)
protected

Constructor moving strings

Parameters
hostThe database host
userThe database user
passwordThe database password
db_nameThe database name
portThe database port
loggerLogger instance

Member Function Documentation

◆ Query()

ExpectedRows StormByte::Database::MariaDB::MariaDB::Query ( const std::string &  query)
overridevirtualnoexcept

Executes a query

Parameters
queryThe query to execute.
Returns
The created query

Implements StormByte::Database::Database.

◆ SilentQuery()

bool StormByte::Database::MariaDB::MariaDB::SilentQuery ( const std::string &  query)
overridevirtualnoexcept

Executes a query without returning any result

Parameters
queryThe query to execute.
Returns
True if the query was executed successfully

Implements StormByte::Database::Database.


The documentation for this class was generated from the following file: