ROSE
0.9.6a
|
A database operation. More...
#include <SqlDatabase.h>
Classes | |
class | iterator |
Iterates over the result rows. More... | |
Public Member Functions | |
iterator | begin () |
Execute this statement. More... | |
iterator | end () |
Returns an end iterator. More... | |
void | execute () |
Execute a statement and ignore its result rows if it has any. More... | |
int | execute_int () |
Execute a statement that returns a single integer. More... | |
Driver | driver () const |
Returns the low-level driver name for this statement. More... | |
TransactionPtr | transaction () const |
Returns the transaction for this statement. More... | |
void | print (std::ostream &) const |
Print some basic info about this statement. More... | |
~Statement () | |
StatementPtr | bind (size_t idx, int32_t val) |
Bind value to a '?' placeholder in the SQL statement. More... | |
StatementPtr | bind (size_t idx, int64_t val) |
Bind value to a '?' placeholder in the SQL statement. More... | |
StatementPtr | bind (size_t idx, uint32_t val) |
Bind value to a '?' placeholder in the SQL statement. More... | |
StatementPtr | bind (size_t idx, uint64_t val) |
Bind value to a '?' placeholder in the SQL statement. More... | |
StatementPtr | bind (size_t idx, double val) |
Bind value to a '?' placeholder in the SQL statement. More... | |
StatementPtr | bind (size_t idx, const std::string &val) |
Bind value to a '?' placeholder in the SQL statement. More... | |
void | set_debug (FILE *f) |
Debugging property. More... | |
FILE * | get_debug () const |
Debugging property. More... | |
Static Public Member Functions | |
static StatementPtr | create (const TransactionPtr &tranx, const std::string &sql) |
Create a new statement. More... | |
Protected Member Functions | |
Statement (const TransactionPtr &tranx, const std::string &sql) | |
Private Member Functions | |
void | init (const TransactionPtr &tranx, const std::string &sql) |
void | finish () |
Private Attributes | |
StatementImpl * | impl |
A database operation.
A Statement represents a single SQL statement to be executed within a transaction. Statements may contain value placeholders indicated by '?' characters which are numbered consecutively starting at zero. Actual values must be bound to all the placeholders before the statement can be executed. A single statement may be executed multiple times and may have different actual values bound to its place holders each time.
When a statement is executed within a transaction, it may return zero or more result rows each containing one or more columns of values. The results are returned via STL-like iterators. Re-executing a statement will cause its previous iterators to become invalid and throw exceptions if they are used.
Definition at line 338 of file SqlDatabase.h.
|
inline |
Definition at line 419 of file SqlDatabase.h.
|
inlineprotected |
Definition at line 422 of file SqlDatabase.h.
References Dbg::init().
|
inlinestatic |
Create a new statement.
Statements can be created either by this class method or by calling Transaction::statement().
Definition at line 343 of file SqlDatabase.h.
StatementPtr SqlDatabase::Statement::bind | ( | size_t | idx, |
int32_t | val | ||
) |
Bind value to a '?' placeholder in the SQL statement.
Placeholders are counted from zero based on their position in the text of the SQL command. Only after all placeholders are bound to values can this statement be executed. The bind() method returns the statement pointer so that bind calls can be chained together.
StatementPtr SqlDatabase::Statement::bind | ( | size_t | idx, |
int64_t | val | ||
) |
Bind value to a '?' placeholder in the SQL statement.
Placeholders are counted from zero based on their position in the text of the SQL command. Only after all placeholders are bound to values can this statement be executed. The bind() method returns the statement pointer so that bind calls can be chained together.
StatementPtr SqlDatabase::Statement::bind | ( | size_t | idx, |
uint32_t | val | ||
) |
Bind value to a '?' placeholder in the SQL statement.
Placeholders are counted from zero based on their position in the text of the SQL command. Only after all placeholders are bound to values can this statement be executed. The bind() method returns the statement pointer so that bind calls can be chained together.
StatementPtr SqlDatabase::Statement::bind | ( | size_t | idx, |
uint64_t | val | ||
) |
Bind value to a '?' placeholder in the SQL statement.
Placeholders are counted from zero based on their position in the text of the SQL command. Only after all placeholders are bound to values can this statement be executed. The bind() method returns the statement pointer so that bind calls can be chained together.
StatementPtr SqlDatabase::Statement::bind | ( | size_t | idx, |
double | val | ||
) |
Bind value to a '?' placeholder in the SQL statement.
Placeholders are counted from zero based on their position in the text of the SQL command. Only after all placeholders are bound to values can this statement be executed. The bind() method returns the statement pointer so that bind calls can be chained together.
StatementPtr SqlDatabase::Statement::bind | ( | size_t | idx, |
const std::string & | val | ||
) |
Bind value to a '?' placeholder in the SQL statement.
Placeholders are counted from zero based on their position in the text of the SQL command. Only after all placeholders are bound to values can this statement be executed. The bind() method returns the statement pointer so that bind calls can be chained together.
iterator SqlDatabase::Statement::begin | ( | ) |
Execute this statement.
Returns the iterator pointing to the first row of the result.
|
inline |
Returns an end iterator.
End iterators are just default-constructed iterators–an iterator from any statement can be compared to an end iterator from any statement.
Definition at line 392 of file SqlDatabase.h.
void SqlDatabase::Statement::execute | ( | ) |
Execute a statement and ignore its result rows if it has any.
int SqlDatabase::Statement::execute_int | ( | ) |
Execute a statement that returns a single integer.
Driver SqlDatabase::Statement::driver | ( | ) | const |
Returns the low-level driver name for this statement.
TransactionPtr SqlDatabase::Statement::transaction | ( | ) | const |
Returns the transaction for this statement.
void SqlDatabase::Statement::set_debug | ( | FILE * | f) |
Debugging property.
If non-null, then debugging information is sent to that file. Transactions inherit the debugging property of their connection, and statements inherit the debugging property of their transaction (which is overridden by this method).
FILE* SqlDatabase::Statement::get_debug | ( | ) | const |
Debugging property.
If non-null, then debugging information is sent to that file. Transactions inherit the debugging property of their connection, and statements inherit the debugging property of their transaction (which is overridden by this method).
void SqlDatabase::Statement::print | ( | std::ostream & | ) | const |
Print some basic info about this statement.
|
private |
|
private |
|
private |
Definition at line 429 of file SqlDatabase.h.