DUNE: Uniform Navigational Environment
2.6.0-rc1
|
SQL statement.
Public Member Functions | |
Statement (const char *sql_stmt, Connection &conn) | |
~Statement () | |
bool | execute (int *count=0) |
void | reset (void) |
Statement & | operator<< (Null null) |
Statement & | operator<< (int value) |
Statement & | operator<< (double value) |
Statement & | operator<< (const std::string &value) |
Statement & | operator<< (const char *value) |
Statement & | operator<< (const Blob &value) |
template<typename T > | |
Statement & | operator<< (T value) |
Statement & | operator>> (int &value) |
Statement & | operator>> (double &value) |
Statement & | operator>> (std::string &value) |
Statement & | operator>> (Blob &value) |
template<typename T > | |
Statement & | operator>> (T &value) |
template<typename T > | |
Statement & | operator>> (std::pair< bool, T > &r) |
DUNE::Database::Statement::Statement | ( | const char * | sql_stmt, |
Connection & | conn | ||
) |
Constructor.
sql_stmt | SQL statement. |
conn | Database connection. |
References DUNE::Database::Connection::handle().
DUNE::Database::Statement::~Statement | ( | void | ) |
Destructor.
bool DUNE::Database::Statement::execute | ( | int * | count = 0 | ) |
Execute statement.
All statement arguments must be bound when this method is called using operator<<() in order of the statement wildcards. It will return true if there are more rows to process, false otherwise. When it returns true, the results can be obtained using operator>>() in order of the column results. When it returns false, reset() will have been called internally, so there is no need to call it subsequently.
count | for INSERT, UPDATE or DELETE statements, may return the number of rows affected by the operation |
References DUNE::Database::Connection::handle(), and reset().
Referenced by DUNE::Database::Connection::beginTransaction(), DUNE::Database::Connection::commit(), and DUNE::Database::Connection::rollback().
Bind an argument to NULL.
null | Null datum. |
Statement & DUNE::Database::Statement::operator<< | ( | int | value | ) |
Bind an argument to an integer value.
value | argument value. |
Statement & DUNE::Database::Statement::operator<< | ( | double | value | ) |
Bind an argument to a double value.
value | argument value. |
Statement & DUNE::Database::Statement::operator<< | ( | const std::string & | value | ) |
Bind an argument to a string value.
value | argument value. |
Statement & DUNE::Database::Statement::operator<< | ( | const char * | value | ) |
Bind an argument to a string value.
value | argument value. |
Bind an argument to a blob value.
value | argument value. |
|
inline |
Bind an argument to an integer value (template version for other integral types).
value | argument value. |
Statement & DUNE::Database::Statement::operator>> | ( | int & | value | ) |
Get a column result of INTEGER type (queries only).
value | result reference. |
Statement & DUNE::Database::Statement::operator>> | ( | double & | value | ) |
Get a column result of REAL type (queries only).
value | result reference. |
Statement & DUNE::Database::Statement::operator>> | ( | std::string & | value | ) |
Get a column result of VARCHAR type (queries only).
value | result reference. |
Get a column result of BLOB type (queries only).
value | result reference. |
|
inline |
Get a column result of INTEGER type (queries only) – template version.
value | result reference. |
|
inline |
Get a possibly NULL result of a given type.
The first pair element will be set to 'true' if result is defined (i.e. not NULL), and in that case the second pair element
r | result reference. |
void DUNE::Database::Statement::reset | ( | void | ) |
Reset.
The statement will not be bound to any arguments nor have any available results afterwards.
Referenced by execute().