RADLib
RADical C++ application framework
RADDatabase::RADSqlStatement Class Reference

Prepared SQLite statement with typed binding and row stepping. More...

#include <RADDatabase.h>

Public Member Functions

 RADSqlStatement ()
 Creates an invalid statement. More...
 
 ~RADSqlStatement ()
 Finalizes the statement. More...
 
 RADSqlStatement (const RADSqlStatement &)=delete
 Statement ownership is movable but not copyable. More...
 
RADSqlStatementoperator= (const RADSqlStatement &)=delete
 Statement ownership is movable but not copyable. More...
 
 RADSqlStatement (RADSqlStatement &&other) noexcept
 Moves statement ownership. More...
 
RADSqlStatementoperator= (RADSqlStatement &&other) noexcept
 Moves statement ownership. More...
 
bool isValid () const
 Returns true when a statement was prepared successfully. More...
 
std::string lastError () const
 Returns the last statement error. More...
 
void clearBindings ()
 Clears all current bindings. More...
 
void reset ()
 Resets statement execution state. More...
 
bool bindNull (int index)
 Binds null at 1-based index. More...
 
bool bind (int index, int64_t value)
 Binds integer at 1-based index. More...
 
bool bind (int index, double value)
 Binds double at 1-based index. More...
 
bool bind (int index, const std::string &value)
 Binds text at 1-based index. More...
 
bool bind (int index, const std::vector< uint8_t > &value)
 Binds bytes at 1-based index. More...
 
bool bind (int index, const RADCore::RADVariant &value)
 Binds a RADVariant at 1-based index. More...
 
bool step ()
 Advances one row; returns true when a row is available. More...
 
bool execute ()
 Executes until done for statements that do not return rows. More...
 
int columnCount () const
 Returns number of columns in the current row. More...
 
std::string columnName (int column) const
 Returns column name by zero-based index. More...
 
RADCore::RADVariant columnValue (int column) const
 Returns column value by zero-based index. More...
 

Friends

class RADSqlDatabase
 

Detailed Description

Prepared SQLite statement with typed binding and row stepping.

Constructor & Destructor Documentation

◆ RADSqlStatement() [1/3]

RADDatabase::RADSqlStatement::RADSqlStatement ( )

Creates an invalid statement.

◆ ~RADSqlStatement()

RADDatabase::RADSqlStatement::~RADSqlStatement ( )

Finalizes the statement.

◆ RADSqlStatement() [2/3]

RADDatabase::RADSqlStatement::RADSqlStatement ( const RADSqlStatement )
delete

Statement ownership is movable but not copyable.

◆ RADSqlStatement() [3/3]

RADDatabase::RADSqlStatement::RADSqlStatement ( RADSqlStatement &&  other)
noexcept

Moves statement ownership.

Member Function Documentation

◆ bind() [1/5]

bool RADDatabase::RADSqlStatement::bind ( int  index,
const RADCore::RADVariant value 
)

Binds a RADVariant at 1-based index.

◆ bind() [2/5]

bool RADDatabase::RADSqlStatement::bind ( int  index,
const std::string &  value 
)

Binds text at 1-based index.

◆ bind() [3/5]

bool RADDatabase::RADSqlStatement::bind ( int  index,
const std::vector< uint8_t > &  value 
)

Binds bytes at 1-based index.

◆ bind() [4/5]

bool RADDatabase::RADSqlStatement::bind ( int  index,
double  value 
)

Binds double at 1-based index.

◆ bind() [5/5]

bool RADDatabase::RADSqlStatement::bind ( int  index,
int64_t  value 
)

Binds integer at 1-based index.

◆ bindNull()

bool RADDatabase::RADSqlStatement::bindNull ( int  index)

Binds null at 1-based index.

◆ clearBindings()

void RADDatabase::RADSqlStatement::clearBindings ( )

Clears all current bindings.

◆ columnCount()

int RADDatabase::RADSqlStatement::columnCount ( ) const

Returns number of columns in the current row.

◆ columnName()

std::string RADDatabase::RADSqlStatement::columnName ( int  column) const

Returns column name by zero-based index.

◆ columnValue()

RADCore::RADVariant RADDatabase::RADSqlStatement::columnValue ( int  column) const

Returns column value by zero-based index.

◆ execute()

bool RADDatabase::RADSqlStatement::execute ( )

Executes until done for statements that do not return rows.

◆ isValid()

bool RADDatabase::RADSqlStatement::isValid ( ) const

Returns true when a statement was prepared successfully.

◆ lastError()

std::string RADDatabase::RADSqlStatement::lastError ( ) const

Returns the last statement error.

◆ operator=() [1/2]

RADSqlStatement& RADDatabase::RADSqlStatement::operator= ( const RADSqlStatement )
delete

Statement ownership is movable but not copyable.

◆ operator=() [2/2]

RADSqlStatement& RADDatabase::RADSqlStatement::operator= ( RADSqlStatement &&  other)
noexcept

Moves statement ownership.

◆ reset()

void RADDatabase::RADSqlStatement::reset ( )

Resets statement execution state.

◆ step()

bool RADDatabase::RADSqlStatement::step ( )

Advances one row; returns true when a row is available.

Friends And Related Function Documentation

◆ RADSqlDatabase

friend class RADSqlDatabase
friend

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