|
|
| Statement (IStatement *stmt=0) |
| | Takes ownership of the backend stmt.
|
| Statement & | clear () |
| | Sets all host variables to NULL.
|
| Statement & | setNull (const std::string &col) |
| | Sets the host variable col to NULL.
|
| Statement & | set (const std::string &col, bool data) |
| | Sets the host variable col to data.
|
| Statement & | set (const std::string &col, int data) |
| | Sets the host variable col to data.
|
| Statement & | set (const std::string &col, unsigned data) |
| | Sets the host variable col to data.
|
| Statement & | set (const std::string &col, float data) |
| | Sets the host variable col to data.
|
| Statement & | set (const std::string &col, double data) |
| | Sets the host variable col to data.
|
| Statement & | set (const std::string &col, char data) |
| | Sets the host variable col to data.
|
| Statement & | set (const std::string &col, const std::string &data) |
| | Sets the host variable col to data.
|
| Statement & | set (const std::string &col, const Blob &data) |
| | Sets the host variable col to data.
|
| Statement & | set (const std::string &col, const char *data) |
| | Sets the host variable col to data, or to NULL if data is 0.
|
| Statement & | set (const std::string &col, const Date &data) |
| | Sets the host variable col to data.
|
| Statement & | set (const std::string &col, const Time &data) |
| | Sets the host variable col to data.
|
| Statement & | set (const std::string &col, const DateTime &data) |
| | Sets the host variable col to data.
|
|
Cursor | getCursor (size_type batchSize) |
| | Opens a batch cursor that fetches batchSize rows at a time.
|
|
void | cancel () |
| | Cancels any pending asynchronous operation.
|
|
size_type | execute () |
| | Executes the statement and returns the number of rows changed.
|
|
void | beginExecute () |
| | Starts asynchronous execution.
|
| size_type | endExecute () |
| | Completes asynchronous execution.
|
|
Signal & | executeFinished () |
| | Signal emitted when asynchronous execution completes.
|
|
long long | lastInsertId () const |
| | Returns the generated row id of the last insert.
|
|
Result | select () |
| | Executes the statement and returns a buffered result.
|
| Row | selectRow () |
| | Executes the statement and returns the first row.
|
| Value | selectValue () |
| | Executes the statement and returns the first column of the first row.
|
|
void | beginSelect () |
| | Starts an asynchronous select.
|
| Result | endSelect () |
| | Completes an asynchronous select.
|
|
Signal & | selectFinished () |
| | Signal emitted when an asynchronous select completes.
|
|
bool | operator! () const |
| | Returns true if this object is not bound to a statement.
|
|
const IStatement * | getImpl () const |
| | Returns the backend implementation.
|
|
IStatement * | impl () |
| | Returns the backend implementation.
|
Statement is the compiled query the group described. Obtain it from Connection::prepare() or Connection::prepareCached(). It is a shared value. An unbound statement is empty; operator!() is true then. The constructor that takes an IStatement takes ownership of that backend.
Host variables are :name. Bind them with set() before execute or select. setNull() binds SQL NULL. clear() sets every host variable to NULL. A const char pointer that is 0 is bound as NULL.
execute() runs a statement that does not return rows and returns how many rows changed. lastInsertId() is the generated id after that execute. select() returns a buffered Result. selectRow() returns the first row and discards the rest. selectValue() returns the first column of the first row. Both throw InvalidQuery when the query returns no row.
getCursor() opens a batch cursor on this statement. beginExecute() / endExecute() / executeFinished() and beginSelect() / endSelect() / selectFinished() are the async forms. cancel() aborts a pending operation.
"SELECT name FROM users WHERE id = :id");
Prepared SQL statement with named host variables.
Definition Statement.h:65
Statement & set(const std::string &col, bool data)
Sets the host variable col to data.
Definition Statement.h:102
Value selectValue()
Executes the statement and returns the first column of the first row.
One column value of a query result.
Definition Value.h:35