8 #include <Cutelyst/Plugins/Utils/sql_export.h>
9 #include <Cutelyst/paramsmultimap.h>
11 #include <QtCore/QVariant>
12 #include <QtSql/QSqlDatabase>
55 bool transaction()
const;
69 bool m_transactionRunning;
158 bool htmlEscaped =
true);
179 bool forwardOnly =
false);
213 bool forwardOnly =
false);
223 #define CPreparedSqlQueryForDatabase(str, db) \
224 ([]() -> QSqlQuery { \
225 static thread_local QSqlQuery query_temp = Cutelyst::Sql::preparedQuery(str, db); \
234 #define CPreparedSqlQuery(str) \
235 ([]() -> QSqlQuery { \
236 static QSqlQuery query_temp = Cutelyst::Sql::preparedQuery(str); \
245 #define CPreparedSqlQueryThread(str) \
246 ([]() -> QSqlQuery { \
247 static thread_local QSqlQuery query_temp = Cutelyst::Sql::preparedQueryThread(str); \
256 #define CPreparedSqlQueryThreadForDB(str, db) \
257 ([]() -> QSqlQuery { \
258 static thread_local QSqlQuery query_temp = Cutelyst::Sql::preparedQueryThread(str, db); \
268 #define CPreparedSqlQueryForDatabaseFO(str, db) \
269 ([]() -> QSqlQuery { \
270 static thread_local QSqlQuery query_temp = Cutelyst::Sql::preparedQuery(str, db, true); \
280 #define CPreparedSqlQueryFO(str) \
281 ([]() -> QSqlQuery { \
282 static QSqlQuery query_temp = Cutelyst::Sql::preparedQuery(str, QSqlDatabase(), true); \
292 #define CPreparedSqlQueryThreadFO(str) \
293 ([]() -> QSqlQuery { \
294 static thread_local QSqlQuery query_temp = \
295 Cutelyst::Sql::preparedQueryThread(str, QString(), true); \
305 #define CPreparedSqlQueryThreadForDBFO(str, db) \
306 ([]() -> QSqlQuery { \
307 static thread_local QSqlQuery query_temp = \
308 Cutelyst::Sql::preparedQueryThread(str, db, true); \
This is a helper class to create scoped transactions.
CUTELYST_PLUGIN_UTILS_SQL_EXPORT QVariantList queryToHashList(QSqlQuery &query)
CUTELYST_PLUGIN_UTILS_SQL_EXPORT QVariantMap queryToMapObject(QSqlQuery &query)
CUTELYST_PLUGIN_UTILS_SQL_EXPORT QVariantHash queryToHashObject(QSqlQuery &query)
CUTELYST_PLUGIN_UTILS_SQL_EXPORT void bindParamsToQuery(QSqlQuery &query, const Cutelyst::ParamsMultiMap ¶ms, bool htmlEscaped=true)
CUTELYST_PLUGIN_UTILS_SQL_EXPORT QJsonArray queryToJsonObjectArray(QSqlQuery &query)
CUTELYST_PLUGIN_UTILS_SQL_EXPORT QString databaseNameThread(const QString &dbName=QString())
CUTELYST_PLUGIN_UTILS_SQL_EXPORT QSqlQuery preparedQuery(const QString &query, QSqlDatabase db=QSqlDatabase(), bool forwardOnly=false)
CUTELYST_PLUGIN_UTILS_SQL_EXPORT QVariantList queryToList(QSqlQuery &query)
CUTELYST_PLUGIN_UTILS_SQL_EXPORT QJsonObject queryToIndexedJsonObject(QSqlQuery &query, const QString &key)
CUTELYST_PLUGIN_UTILS_SQL_EXPORT QVariantList queryToMapList(QSqlQuery &query)
CUTELYST_PLUGIN_UTILS_SQL_EXPORT QSqlDatabase databaseThread(const QString &dbName=QString())
CUTELYST_PLUGIN_UTILS_SQL_EXPORT QVariantHash queryToIndexedHash(QSqlQuery &query, const QString &key)
CUTELYST_PLUGIN_UTILS_SQL_EXPORT QJsonArray queryToJsonArray(QSqlQuery &query)
CUTELYST_PLUGIN_UTILS_SQL_EXPORT QSqlQuery preparedQueryThread(const QString &query, const QString &dbName=QString(), bool forwardOnly=false)
CUTELYST_PLUGIN_UTILS_SQL_EXPORT QJsonObject queryToJsonObject(QSqlQuery &query)
The Cutelyst namespace holds all public Cutelyst API.