6#ifndef PT_DB_STATEMENT_H
7#define PT_DB_STATEMENT_H
9#include <Pt/SmartPtr.h>
13#include <Pt/DateTime.h>
15#include <Pt/Db/Cursor.h>
16#include <Pt/Db/IStatement.h>
17#include <Pt/Db/IConnection.h>
88 { _stmt->
clear();
return *
this; }
96 { _stmt->
setNull(col);
return *
this; }
103 { _stmt->setBool(col, data);
return *
this; }
110 { _stmt->setInt(col, data);
return *
this; }
117 { _stmt->setUnsigned(col, data);
return *
this; }
124 { _stmt->setFloat(col, data);
return *
this; }
131 { _stmt->setDouble(col, data);
return *
this; }
138 { _stmt->setChar(col, data);
return *
this; }
145 { _stmt->setString(col, data);
return *
this; }
152 { _stmt->setBlob(col, data);
return *
this; }
159 { data == 0 ? _stmt->
setNull(col)
160 : _stmt->setString(col, data);
return *
this; }
167 { _stmt->setDate(col, data);
return *
this; }
174 { _stmt->setTime(col, data);
return *
this; }
182 _stmt->setDatetime(col, data);
264 {
return _stmt.get(); }
Combined Date and Time value.
Definition DateTime.h:66
Date expressed in year, month, and day.
Definition Date.h:104
Copy-on-write binary large object.
Definition Blob.h:144
Database session for a registered driver.
Definition Connection.h:97
Batch cursor for large query results.
Definition Cursor.h:58
Prepared-statement backend.
Definition IStatement.h:33
Buffered query result with random-access rows.
Definition Result.h:42
One row of a buffered query result.
Definition Row.h:34
Prepared SQL statement with named host variables.
Definition Statement.h:65
void cancel()
Cancels any pending asynchronous operation.
Statement & setNull(const std::string &col)
Sets the host variable col to NULL.
Definition Statement.h:95
Statement & set(const std::string &col, float data)
Sets the host variable col to data.
Definition Statement.h:123
Statement & clear()
Sets all host variables to NULL.
Definition Statement.h:87
long long lastInsertId() const
Returns the generated row id of the last insert.
Statement & set(const std::string &col, bool data)
Sets the host variable col to data.
Definition Statement.h:102
Statement & set(const std::string &col, const Date &data)
Sets the host variable col to data.
Definition Statement.h:166
Result endSelect()
Completes an asynchronous select.
void beginExecute()
Starts asynchronous execution.
Statement & set(const std::string &col, double data)
Sets the host variable col to data.
Definition Statement.h:130
size_type execute()
Executes the statement and returns the number of rows changed.
bool operator!() const
Returns true if this object is not bound to a statement.
Definition Statement.h:253
Statement & set(const std::string &col, const char *data)
Sets the host variable col to data, or to NULL if data is 0.
Definition Statement.h:158
Statement(IStatement *stmt=0)
Takes ownership of the backend stmt.
Definition Statement.h:77
Value selectValue()
Executes the statement and returns the first column of the first row.
Statement & set(const std::string &col, const DateTime &data)
Sets the host variable col to data.
Definition Statement.h:180
Signal & selectFinished()
Signal emitted when an asynchronous select completes.
Statement & set(const std::string &col, unsigned data)
Sets the host variable col to data.
Definition Statement.h:116
Cursor getCursor(size_type batchSize)
Opens a batch cursor that fetches batchSize rows at a time.
Row selectRow()
Executes the statement and returns the first row.
Statement & set(const std::string &col, char data)
Sets the host variable col to data.
Definition Statement.h:137
Statement & set(const std::string &col, const Blob &data)
Sets the host variable col to data.
Definition Statement.h:151
const IStatement * getImpl() const
Returns the backend implementation.
Definition Statement.h:258
size_type endExecute()
Completes asynchronous execution.
Signal & executeFinished()
Signal emitted when asynchronous execution completes.
IStatement * impl()
Returns the backend implementation.
Definition Statement.h:263
Statement & set(const std::string &col, int data)
Sets the host variable col to data.
Definition Statement.h:109
void beginSelect()
Starts an asynchronous select.
Statement & set(const std::string &col, const std::string &data)
Sets the host variable col to data.
Definition Statement.h:144
Result select()
Executes the statement and returns a buffered result.
IStatement::size_type size_type
Size type of this statement.
Definition Statement.h:69
Statement & set(const std::string &col, const Time &data)
Sets the host variable col to data.
Definition Statement.h:173
One column value of a query result.
Definition Value.h:35
Multicast Signal to call multiple slots.
Definition Signal.h:190
Policy based smart pointer.
Definition SmartPtr.h:462
Time expressed in hours, minutes, seconds and milliseconds.
Definition Time.h:98
Portable SQL database access.
Core module.
Definition Allocator.h:33