libnick 2025.9.1
A cross-platform base for native Nickvision applications.
Loading...
Searching...
No Matches
Nickvision::Database::SqliteStatement Class Reference

A sqlite statement. More...

#include <sqlitestatement.h>

Public Member Functions

 SqliteStatement (sqlite3 *database, const std::string &command)
 Constructs a SqliteStatement.
 
 SqliteStatement (const SqliteStatement &)=delete
 
 SqliteStatement (SqliteStatement &&other) noexcept
 Constructs a SqliteStatement via move.
 
 ~SqliteStatement () noexcept
 Destructs a SqliteStatement.
 
SqliteStepResult step () noexcept
 Steps through the statement.
 
template<SupportedSqliteValue T>
bool bind (int index, T value) noexcept
 Binds a value to a sqlite parameter.
 
template<SupportedSqliteValue T>
getColumn (int index) noexcept
 Gets the sqlite column value as a specific type.
 
SqliteStatementoperator= (const SqliteStatement &)=delete
 
SqliteStatementoperator= (SqliteStatement &&other) noexcept
 Assigns a SqliteStatement via move.
 
 operator bool () const noexcept
 Gets whether or not the object is valid or not.
 

Detailed Description

A sqlite statement.

Constructor & Destructor Documentation

◆ SqliteStatement() [1/3]

Nickvision::Database::SqliteStatement::SqliteStatement ( sqlite3 * database,
const std::string & command )

Constructs a SqliteStatement.

Parameters
databaseThe sqlite3 database
commandThe sql command to set to the statement
Exceptions
std::runtime_errorThrown if error in executing sql statement

◆ SqliteStatement() [2/3]

Nickvision::Database::SqliteStatement::SqliteStatement ( const SqliteStatement & )
delete

◆ SqliteStatement() [3/3]

Nickvision::Database::SqliteStatement::SqliteStatement ( SqliteStatement && other)
noexcept

Constructs a SqliteStatement via move.

Parameters
otherThe other SqliteStatement to move

◆ ~SqliteStatement()

Nickvision::Database::SqliteStatement::~SqliteStatement ( )
noexcept

Destructs a SqliteStatement.

Member Function Documentation

◆ bind()

template<SupportedSqliteValue T>
bool Nickvision::Database::SqliteStatement::bind ( int index,
T value )
inlinenoexcept

Binds a value to a sqlite parameter.

Template Parameters
TThe type of the value to bind
Parameters
indexThe index of the parameter
valueThe value to bind
Returns
True if bind was successful, else false

◆ getColumn()

template<SupportedSqliteValue T>
T Nickvision::Database::SqliteStatement::getColumn ( int index)
inlinenoexcept

Gets the sqlite column value as a specific type.

Template Parameters
TThe type to get the sqlite column value as (Can be: int, std::int64_t, double, bool, std::string)
Returns
The sqlite column value as the specified type
A default value if the sqlite column value is not of the specified type

◆ operator bool()

Nickvision::Database::SqliteStatement::operator bool ( ) const
noexcept

Gets whether or not the object is valid or not.

Returns
True if valid, else false

◆ operator=() [1/2]

SqliteStatement & Nickvision::Database::SqliteStatement::operator= ( const SqliteStatement & )
delete

◆ operator=() [2/2]

SqliteStatement & Nickvision::Database::SqliteStatement::operator= ( SqliteStatement && other)
noexcept

Assigns a SqliteStatement via move.

Parameters
otherThe other SqliteStatement to move
Returns
Reference to this SqliteStatement

◆ step()

SqliteStepResult Nickvision::Database::SqliteStatement::step ( )
noexcept

Steps through the statement.

Returns
SqliteStepResult

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