sqlitepp
A small sqlite3 C++ library
 All Classes Functions Pages
Public Member Functions | List of all members
sqlitepp::Statement Class Reference

A prepared statement. More...

#include <sqlitepp.h>

Public Member Functions

 Statement (Database &db)
 Default constructor. More...
 
 ~Statement ()
 Destructor.
 
void bindString (const int n, const std::string &value)
 Binds the nth parameter with the passed value as string. More...
 
void bindInt (const int n, const int value)
 Binds the nth parameter with the passed value as integer. More...
 
void bindDouble (const int n, const double value)
 Binds the nth parameter with the passed value as integer. More...
 
void bindNull (const int n)
 Binds the nth parameter with the null value. More...
 
std::string getString (const std::string &column) const
 gets a column as string More...
 
int getInt (const std::string &column) const
 gets a column as integer More...
 
double getDouble (const std::string &column) const
 gets a column as double More...
 
void getString (const int n, std::string &out) const
 gets the nth column as string and saves it in out More...
 
void getInt (const int n, int &out) const
 gets the nth column as integer and saves it in out More...
 
void getDouble (const int n, double &out) const
 gets the nth column as string and saves it in out More...
 
std::string getString (const int n) const
 gets the nth column as string More...
 
int getInt (const int n) const
 gets the nth column as integer More...
 
double getDouble (const int n) const
 gets the nth column as double More...
 
void prepare (const std::string &sql)
 prepares a string as statement More...
 
bool fetchRow (void)
 fetches the next row More...
 
void exec (void)
 executes the prepared statement
 
void finalize (void)
 releases any allocated resources. Use it, when you want to reuse a statement object.
 

Detailed Description

A prepared statement.

Definition at line 183 of file sqlitepp.h.

Constructor & Destructor Documentation

sqlitepp::Statement::Statement ( Database db)

Default constructor.

Parameters
dbdatabase, on which the statement is executed

Definition at line 33 of file statement.cpp.

Member Function Documentation

void sqlitepp::Statement::bindDouble ( const int  n,
const double  value 
)

Binds the nth parameter with the passed value as integer.

Parameters
n
value

Definition at line 179 of file statement.cpp.

void sqlitepp::Statement::bindInt ( const int  n,
const int  value 
)

Binds the nth parameter with the passed value as integer.

Parameters
n
value

Definition at line 167 of file statement.cpp.

void sqlitepp::Statement::bindNull ( const int  n)

Binds the nth parameter with the null value.

Parameters
n

Definition at line 185 of file statement.cpp.

void sqlitepp::Statement::bindString ( const int  n,
const std::string &  value 
)

Binds the nth parameter with the passed value as string.

Parameters
n
value

Definition at line 173 of file statement.cpp.

bool sqlitepp::Statement::fetchRow ( void  )

fetches the next row

Returns

Definition at line 93 of file statement.cpp.

double sqlitepp::Statement::getDouble ( const std::string &  column) const

gets a column as double

Parameters
column
Returns

Definition at line 146 of file statement.cpp.

void sqlitepp::Statement::getDouble ( const int  n,
double &  out 
) const

gets the nth column as string and saves it in out

Parameters
nthe index
outthe output double

Definition at line 161 of file statement.cpp.

double sqlitepp::Statement::getDouble ( const int  n) const

gets the nth column as double

Parameters
n

Definition at line 155 of file statement.cpp.

int sqlitepp::Statement::getInt ( const std::string &  column) const

gets a column as integer

Parameters
column
Returns

Definition at line 99 of file statement.cpp.

void sqlitepp::Statement::getInt ( const int  n,
int &  out 
) const

gets the nth column as integer and saves it in out

Parameters
nthe index
outthe output integer

Definition at line 114 of file statement.cpp.

int sqlitepp::Statement::getInt ( const int  n) const

gets the nth column as integer

Parameters
n

Definition at line 108 of file statement.cpp.

std::string sqlitepp::Statement::getString ( const std::string &  column) const

gets a column as string

Parameters
column
Returns

Definition at line 131 of file statement.cpp.

void sqlitepp::Statement::getString ( const int  n,
std::string &  out 
) const

gets the nth column as string and saves it in out

Parameters
nthe index
outthe output string

Definition at line 140 of file statement.cpp.

std::string sqlitepp::Statement::getString ( const int  n) const

gets the nth column as string

Parameters
n

Definition at line 120 of file statement.cpp.

void sqlitepp::Statement::prepare ( const std::string &  sql)

prepares a string as statement

Parameters
sqlSQL statement

Definition at line 49 of file statement.cpp.


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