Sese Framework  2.3.0
A cross-platform framework
Loading...
Searching...
No Matches
sese::db::impl::MariaDriverInstanceImpl Class Referencefinal

Maria driver implementation. More...

#include <MariaDriverInstanceImpl.h>

Inheritance diagram for sese::db::impl::MariaDriverInstanceImpl:
sese::db::DriverInstance

Public Member Functions

 MariaDriverInstanceImpl (MYSQL *conn) noexcept
 
 ~MariaDriverInstanceImpl () noexcept override
 
ResultSet::Ptr executeQuery (const char *sql) noexcept override
 
int64_t executeUpdate (const char *sql) noexcept override
 
PreparedStatement::Ptr createStatement (const char *sql) noexcept override
 
int getLastError () const noexcept override
 
const char * getLastErrorMessage () const noexcept override
 
bool setAutoCommit (bool enable) noexcept override
 
bool getAutoCommit (bool &status) noexcept override
 
bool begin () noexcept override
 
bool commit () noexcept override
 
bool rollback () noexcept override
 
bool getInsertId (int64_t &id) const noexcept override
 
- Public Member Functions inherited from sese::db::DriverInstance
virtual ~DriverInstance () noexcept=default
 Destructors.
 
ErrorCode getErrorCode () const
 

Protected Attributes

MYSQL * conn
 

Additional Inherited Members

- Public Types inherited from sese::db::DriverInstance
using Ptr = std::unique_ptr<DriverInstance>
 

Detailed Description

Maria driver implementation.

Constructor & Destructor Documentation

◆ MariaDriverInstanceImpl()

impl::MariaDriverInstanceImpl::MariaDriverInstanceImpl ( MYSQL * conn)
explicitnoexcept

◆ ~MariaDriverInstanceImpl()

impl::MariaDriverInstanceImpl::~MariaDriverInstanceImpl ( )
overridenoexcept

References conn.

Member Function Documentation

◆ begin()

bool impl::MariaDriverInstanceImpl::begin ( )
nodiscardoverridevirtualnoexcept

Starts the transaction

Return values
falseIf the transaction start fails

Implements sese::db::DriverInstance.

◆ commit()

bool impl::MariaDriverInstanceImpl::commit ( )
nodiscardoverridevirtualnoexcept

Commits the transaction

Return values
falseIf the commit fails

Implements sese::db::DriverInstance.

◆ createStatement()

PreparedStatement::Ptr impl::MariaDriverInstanceImpl::createStatement ( const char * sql)
overridevirtualnoexcept

Creates a prepared statement object

Parameters
sqlThe SQL query string
Returns
The prepared statement object
Return values
nullptrIf creation fails

Implements sese::db::DriverInstance.

References count().

◆ executeQuery()

ResultSet::Ptr impl::MariaDriverInstanceImpl::executeQuery ( const char * sql)
overridevirtualnoexcept

Execute the query

Parameters
sqlQuery statements
Returns
The result set that was queried
Return values
nullptrQuery failed

Implements sese::db::DriverInstance.

◆ executeUpdate()

int64_t impl::MariaDriverInstanceImpl::executeUpdate ( const char * sql)
overridevirtualnoexcept

Execute the update

Parameters
sqlUpdate statements
Returns
Count the number of rows updated
Return values
-1Execution failed

Implements sese::db::DriverInstance.

◆ getAutoCommit()

bool impl::MariaDriverInstanceImpl::getAutoCommit ( bool & status)
nodiscardoverridevirtualnoexcept

Checks whether auto-commit is enabled

Warning
Since libpq does not support retrieving the autoCommit status, it is recommended to use the command line to obtain this value when using PostgreSQL.
Return values
falseIf the operation fails

Implements sese::db::DriverInstance.

◆ getInsertId()

bool impl::MariaDriverInstanceImpl::getInsertId ( int64_t & id) const
nodiscardoverridevirtualnoexcept

Retrieves the auto-incremented ID

Warning
Since libpq does not support retrieving the auto-incremented ID, it is recommended to use the command line with the query ‘SELECT currval(pg_get_serial_sequence('tabName’, 'colName'))` to get the auto-incremented ID when using PostgreSQL.
Return values
falseIf the retrieval fails

Implements sese::db::DriverInstance.

◆ getLastError()

int impl::MariaDriverInstanceImpl::getLastError ( ) const
nodiscardoverridevirtualnoexcept

Retrieves the error code corresponding to the instance's driver

Returns
The error code

Implements sese::db::DriverInstance.

◆ getLastErrorMessage()

const char * impl::MariaDriverInstanceImpl::getLastErrorMessage ( ) const
nodiscardoverridevirtualnoexcept

Retrieves the error message corresponding to the instance's driver (null check required)

Returns
The error message

Implements sese::db::DriverInstance.

◆ rollback()

bool impl::MariaDriverInstanceImpl::rollback ( )
nodiscardoverridevirtualnoexcept

Rolls back the transaction

Return values
falseIf the rollback fails

Implements sese::db::DriverInstance.

◆ setAutoCommit()

bool impl::MariaDriverInstanceImpl::setAutoCommit ( bool enable)
nodiscardoverridevirtualnoexcept

Sets the transaction auto-commit mode

Warning
Since libpq does not support setting autocommit, and the autoCommit property is global, it is recommended to use begin() to start a transaction when using PostgreSQL.
Since sqlite3 does not support setting autocommit, it is recommended to use begin() to start a transaction when using SQLite.
Parameters
enableEnable or disable auto-commit mode
Return values
falseIf the operation fails

Implements sese::db::DriverInstance.

Member Data Documentation

◆ conn

MYSQL* sese::db::impl::MariaDriverInstanceImpl::conn
protected

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