|
| Database (const QSqlDatabase &db=QSqlDatabase()) |
|
| Database (Database &&other) |
|
Database & | operator= (Database &&other) |
|
QSqlError | lastError () const |
| Returns information about the last error that occurred on the underlying database. More...
|
|
NonQueryResult | execNonQuery (const QString &sql) const |
| Executes non-query SQL statement (DELETE, INSERT, UPDATE, CREATE, ALTER, etc.) More...
|
|
QueryResult | execQuery (const QString &sql) const |
| Executes SELECT query. More...
|
|
InsertQuery | insertInto (const QString &table) const |
| Creates INSERT query wrapper. More...
|
|
DeleteQuery | deleteFrom (const QString &table) const |
| Creates DELETE query wrapper. More...
|
|
UpdateQuery | update (const QString &table) const |
| Creates UPDATE query wrapper. More...
|
|
PreparedQuery | prepare (const QString &sql, bool forwardOnly=true) const |
| Prepares SQL statement. More...
|
|
QSqlDatabase & | qSqlDatabase () |
| Returns a reference to the wrapped QSqlDatabase object. More...
|
|
template<typename Func > |
int | each (const QString &query, Func &&f) const |
| Executes query and applies function f to each result row. More...
|
|
template<typename Func > |
int | first (const QString &query, Func &&f) const |
| Executes query and applies function f to the first result row. More...
|
|
template<typename Func > |
int | range (const QString &query, int start, int count, Func &&f) const |
| Executes query and applies function f to count result rows starting from index start. More...
|
|
template<typename Func > |
int | top (const QString &query, int topCount, Func &&f) const |
| Executes query and applies function f to topCount result rows. More...
|
|
template<typename T > |
T | scalar (const QString &query) const |
| Executes query and returns scalar value converted to T. More...
|
|
QVariant | scalar (const QString &query) const |
| Executes query and returns scalar value. More...
|
|
QSqlDatabase wrapper.
void test()
{
QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
db.setDatabaseName(":memory:");
try
{
sdb.execNonQuery("CREATE TABLE table (a int, b int, c int, d text)");
}
{
}
}