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

Maria prepared statement implementation. More...

#include <MariaPreparedStatementImpl.h>

Inheritance diagram for sese::db::impl::MariaPreparedStatementImpl:
sese::db::PreparedStatement

Public Member Functions

 MariaPreparedStatementImpl (MYSQL_STMT *stmt, MYSQL_RES *meta, size_t count) noexcept
 
 ~MariaPreparedStatementImpl () noexcept override
 
ResultSet::Ptr executeQuery () noexcept override
 Execute query.
 
int64_t executeUpdate () noexcept override
 Execute update.
 
bool setDouble (uint32_t index, const double &value) noexcept override
 Set double-precision floating-point value.
 
bool setFloat (uint32_t index, const float &value) noexcept override
 Set single-precision floating-point value.
 
bool setInteger (uint32_t index, const int32_t &value) noexcept override
 Set integer value.
 
bool setLong (uint32_t index, const int64_t &value) noexcept override
 Set long integer value.
 
bool setText (uint32_t index, const char *value) noexcept override
 Set text value.
 
bool setNull (uint32_t index) noexcept override
 Set to NULL.
 
bool setDateTime (uint32_t index, const sese::DateTime &value) noexcept override
 Set to dateTime.
 
bool getColumnType (uint32_t index, MetadataType &type) noexcept override
 Get result set column type.
 
int64_t getColumnSize (uint32_t index) noexcept override
 Get result set column size. This interface is usually only effective when the type is binary or string, and the unit is bytes.
 
int getLastError () const noexcept override
 Get the error code for the corresponding driver of the instance.
 
const char * getLastErrorMessage () const noexcept override
 Get the error message for the corresponding driver of the instance. Need to check for null.
 
- Public Member Functions inherited from sese::db::PreparedStatement
virtual ~PreparedStatement () noexcept=default
 
ErrorCode getErrorCode () const
 

Static Public Member Functions

static bool mallocBindStruct (MYSQL_RES *meta, MYSQL_BIND **bind) noexcept
 
static void freeBindStruct (MYSQL_BIND *bind, size_t count) noexcept
 
static void reinterpret (MYSQL_BIND *target, enum_field_types expece_type, const void *buffer, size_t size) noexcept
 

Protected Attributes

MYSQL_STMT * stmt
 
size_t count = 0
 
MYSQL_BIND * param
 
MYSQL_RES * meta
 

Additional Inherited Members

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

Detailed Description

Maria prepared statement implementation.

Constructor & Destructor Documentation

◆ MariaPreparedStatementImpl()

sese::db::impl::MariaPreparedStatementImpl::MariaPreparedStatementImpl ( MYSQL_STMT * stmt,
MYSQL_RES * meta,
size_t count )
explicitnoexcept

References count().

◆ ~MariaPreparedStatementImpl()

sese::db::impl::MariaPreparedStatementImpl::~MariaPreparedStatementImpl ( )
overridenoexcept

References count, free(), meta, param, and stmt.

Member Function Documentation

◆ executeQuery()

sese::db::ResultSet::Ptr sese::db::impl::MariaPreparedStatementImpl::executeQuery ( )
overridevirtualnoexcept

Execute query.

Returns
Query result set
Return values
nullptrQuery failed

Implements sese::db::PreparedStatement.

◆ executeUpdate()

int64_t sese::db::impl::MariaPreparedStatementImpl::executeUpdate ( )
overridevirtualnoexcept

Execute update.

Returns
Number of rows affected
Return values
-1Update failed

Implements sese::db::PreparedStatement.

◆ freeBindStruct()

void sese::db::impl::MariaPreparedStatementImpl::freeBindStruct ( MYSQL_BIND * bind,
size_t count )
staticnoexcept

◆ getColumnSize()

int64_t sese::db::impl::MariaPreparedStatementImpl::getColumnSize ( uint32_t index)
overridevirtualnoexcept

Get result set column size. This interface is usually only effective when the type is binary or string, and the unit is bytes.

Parameters
indexIndex value
Returns
Returns -1 if failed

Implements sese::db::PreparedStatement.

◆ getColumnType()

bool sese::db::impl::MariaPreparedStatementImpl::getColumnType ( uint32_t index,
MetadataType & type )
overridevirtualnoexcept

Get result set column type.

Parameters
indexIndex value
typeColumn type
Returns
Whether the retrieval was successful

Implements sese::db::PreparedStatement.

References sese::db::CHAR, sese::db::DATE, sese::db::DATE_TIME, sese::db::DOUBLE, sese::db::FLOAT, sese::db::INTEGER, sese::db::LONG, sese::db::SHORT, sese::db::TEXT, sese::db::TIME, and sese::db::UNKNOWN.

◆ getLastError()

int sese::db::impl::MariaPreparedStatementImpl::getLastError ( ) const
nodiscardoverridevirtualnoexcept

Get the error code for the corresponding driver of the instance.

Returns
Error code

Implements sese::db::PreparedStatement.

◆ getLastErrorMessage()

const char * sese::db::impl::MariaPreparedStatementImpl::getLastErrorMessage ( ) const
nodiscardoverridevirtualnoexcept

Get the error message for the corresponding driver of the instance. Need to check for null.

Return values
nullptrFailed to get error message
Returns
Error message

Implements sese::db::PreparedStatement.

◆ mallocBindStruct()

bool sese::db::impl::MariaPreparedStatementImpl::mallocBindStruct ( MYSQL_RES * meta,
MYSQL_BIND ** bind )
staticnoexcept

◆ reinterpret()

void sese::db::impl::MariaPreparedStatementImpl::reinterpret ( MYSQL_BIND * target,
enum_field_types expece_type,
const void * buffer,
size_t size )
staticnoexcept

References free().

◆ setDateTime()

bool sese::db::impl::MariaPreparedStatementImpl::setDateTime ( uint32_t index,
const sese::DateTime & value )
overridevirtualnoexcept

Set to dateTime.

Parameters
indexIndex
valueDate
Returns
Whether the setting was successful

Implements sese::db::PreparedStatement.

References count(), and free().

◆ setDouble()

bool sese::db::impl::MariaPreparedStatementImpl::setDouble ( uint32_t index,
const double & value )
overridevirtualnoexcept

Set double-precision floating-point value.

Parameters
indexIndex
valueValue
Returns
Whether the setting was successful

Implements sese::db::PreparedStatement.

References count().

◆ setFloat()

bool sese::db::impl::MariaPreparedStatementImpl::setFloat ( uint32_t index,
const float & value )
overridevirtualnoexcept

Set single-precision floating-point value.

Parameters
indexIndex
valueValue
Returns
Whether the setting was successful

Implements sese::db::PreparedStatement.

References count().

◆ setInteger()

bool sese::db::impl::MariaPreparedStatementImpl::setInteger ( uint32_t index,
const int32_t & value )
overridevirtualnoexcept

Set integer value.

Parameters
indexIndex
valueValue
Returns
Whether the setting was successful

Implements sese::db::PreparedStatement.

References count().

◆ setLong()

bool sese::db::impl::MariaPreparedStatementImpl::setLong ( uint32_t index,
const int64_t & value )
overridevirtualnoexcept

Set long integer value.

Parameters
indexIndex
valueValue
Returns
Whether the setting was successful

Implements sese::db::PreparedStatement.

References count().

◆ setNull()

bool sese::db::impl::MariaPreparedStatementImpl::setNull ( uint32_t index)
overridevirtualnoexcept

Set to NULL.

Parameters
indexIndex
Returns
Whether the setting was successful

Implements sese::db::PreparedStatement.

References count(), and free().

◆ setText()

bool sese::db::impl::MariaPreparedStatementImpl::setText ( uint32_t index,
const char * value )
overridevirtualnoexcept

Set text value.

Parameters
indexIndex
valueValue
Returns
Whether the setting was successful

Implements sese::db::PreparedStatement.

References count(), and free().

Member Data Documentation

◆ count

size_t sese::db::impl::MariaPreparedStatementImpl::count = 0
protected

◆ meta

MYSQL_RES* sese::db::impl::MariaPreparedStatementImpl::meta
protected

◆ param

MYSQL_BIND* sese::db::impl::MariaPreparedStatementImpl::param
protected

◆ stmt

MYSQL_STMT* sese::db::impl::MariaPreparedStatementImpl::stmt
protected

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