Qx v0.7
Qt Extensions Library
|
The SqlDqlQuery class represents SQL queries that fit into the data query language sub-language. More...
#include <qx/sql/qx-sqlquery.h>
Public Member Functions | |
SqlDqlQuery () | |
SqlDqlQuery (SqlDatabase &db) | |
template<QxSql::sql_containing Container> | |
SqlError | appendExecute (Container &result) |
template<sql_stringable First> | |
auto & | ESCAPE (First &&fs) |
template<QxSql::sql_containing Container> | |
SqlError | execute (Container &result) |
template<typename T> | |
SqlError | execute (SqlResult< T > &result) |
template<typename T> | |
SqlError | execute (T &result) |
auto & | EXISTS (const SqlQuery &q) |
template<sql_stringable First> | |
auto & | GROUP_BY (First &&fs) |
template<sql_stringable First> | |
auto & | HAVING (First &&fs) |
template<sql_stringable First> | |
auto & | ILIKE (First &&fs) |
template<sql_stringable First> | |
auto & | JOIN (First &&fs) |
template<sql_stringable First> | |
auto & | LIKE (First &&fs) |
template<sql_stringable First> | |
auto & | LIMIT (First &&fs) |
auto & | NOT () |
template<sql_stringable First> | |
auto & | NOT (First &&fs) |
template<sql_stringable First> | |
auto & | OFFSET (First &&fs) |
template<sql_stringable First, sql_stringable ... Rest> | |
auto & | ORDER_BY (First &&fs, Rest &&... s) |
template<sql_stringable First> | |
auto & | SIMILAR_TO (First &&fs) |
![]() | |
auto & | AS (First &&fs) |
auto & | BETWEEN (First &&fs) |
auto & | CASE () |
auto & | DISTINCT () |
auto & | ELSE (First &&fs) |
auto & | END () |
SqlDqlQuery & | FROM () |
auto & | FROM (First &&fs, Rest &&... s) |
SqlDqlQuery & | IN (const R &range) |
auto & | IN (const SqlQuery &q) |
auto & | IN (First &&fs, Rest &&... s) |
auto & | IS () |
auto & | IS (First &&fs) |
auto & | ON (First &&fs) |
SqlDqlQuery & | SELECT () |
SqlDqlQuery & | SELECT (First &&fsel, Rest &&... sel) |
SqlDqlQuery & | SELECT_DISTINCT () |
SqlDqlQuery & | SELECT_DISTINCT (First &&fsel, Rest &&... sel) |
auto & | THEN (First &&fs) |
SqlDqlQuery & | verbatim (const QString &sql, bool space=true) |
auto & | WHEN () |
auto & | WHEN (First &&fs) |
auto & | WHERE () |
auto & | WHERE (First &&fs) |
![]() | |
void | bindValue (const QString &placeholder, const QVariant &val) |
SqlDatabase * | database () |
const SqlDatabase * | database () const |
bool | hasDatabase () const |
QString | string () const |
A query can be created separately, but is most often created directly using one of the methods of SqlDatabase.
Qx::SqlDqlQuery::SqlDqlQuery | ( | ) |
Creates a DQL query without an associated database.
A query without an associated database cannot be execute, but can be used as a sub-query.
Qx::SqlDqlQuery::SqlDqlQuery | ( | SqlDatabase & | db | ) |
Creates a DQL query associated with database db.
|
inline |
Same as execute(Container&), except that the result buffer is not cleared and so the results are appended to the existing container, instead of replacing them.
auto & Qx::SqlDqlQuery::ESCAPE | ( | First && | fs | ) |
Adds a ESCAPE
clause to the query using fs and returns a reference to the query.
|
inline |
Executes the query, placing the result into the container result. Each element of the result container corresponds to a row from the SQL result. If the original result has fields that are not present in the utilized struct, they will simply be omitted.
A valid error is returned if there was an issue executing the query.
Executes the query, placing the result into result. If the original result has fields that are not present in the utilized struct, they will simply be omitted.
A valid error is returned if there was an issue executing the query.
|
inline |
Executes the query, placing the result into result. If the original result contains more than one row, only the first row is returned, and if empty, then result is set to a default constructed value.
A valid error is returned if there was an issue executing the query.
auto & Qx::SqlDqlQuery::EXISTS | ( | const SqlQuery & | q | ) |
Adds a EXISTS
clause to the query using q as a sub-query and returns a reference to the query.
auto & Qx::SqlDqlQuery::GROUP_BY | ( | First && | fs | ) |
Adds a GROUP BY
clause to the query using fs and returns a reference to the query.
auto & Qx::SqlDqlQuery::HAVING | ( | First && | fs | ) |
Adds a HAVING
clause to the query using fs and returns a reference to the query.
auto & Qx::SqlDqlQuery::ILIKE | ( | First && | fs | ) |
Adds a ILIKE
clause to the query using fs and returns a reference to the query.
auto & Qx::SqlDqlQuery::JOIN | ( | First && | fs | ) |
Adds a JOIN
clause to the query using fs and returns a reference to the query.
auto & Qx::SqlDqlQuery::LIKE | ( | First && | fs | ) |
Adds a LIKE
clause to the query using fs and returns a reference to the query.
auto & Qx::SqlDqlQuery::LIMIT | ( | First && | fs | ) |
Adds a LIMIT
clause to the query using fs and returns a reference to the query.
auto & Qx::SqlDqlQuery::NOT | ( | ) |
Adds a NOT
clause to the query and returns a reference to the query.
auto & Qx::SqlDqlQuery::NOT | ( | First && | fs | ) |
Adds a NOT
clause to the query using fs and returns a reference to the query.
auto & Qx::SqlDqlQuery::OFFSET | ( | First && | fs | ) |
Adds a OFFSET
clause to the query using fs and returns a reference to the query.
auto & Qx::SqlDqlQuery::ORDER_BY | ( | First && | fs, |
Rest &&... | s ) |
Adds a ORDER BY
clause to the query using fs through s and returns a reference to the query.
auto & Qx::SqlDqlQuery::SIMILAR_TO | ( | First && | fs | ) |
Adds a SIMILAR TO
clause to the query using fs and returns a reference to the query.