From a275c6a0f21d7b3c8f5dbb84ba575acd6108f244 Mon Sep 17 00:00:00 2001 From: Robert Szefner Date: Sat, 29 Dec 2018 16:18:47 +0100 Subject: [PATCH] log query prepare errors in query.log --- src/tsqlquery.cpp | 12 ++++++++++++ src/tsqlquery.h | 9 --------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/tsqlquery.cpp b/src/tsqlquery.cpp index f4abef341..a00022fbc 100644 --- a/src/tsqlquery.cpp +++ b/src/tsqlquery.cpp @@ -143,6 +143,18 @@ QString TSqlQuery::formatValue(const QVariant &val, const QSqlDatabase &database return formatValue(val, val.type(), database); } +/*! + Prepares the SQL query \a query for execution. +*/ +TSqlQuery &TSqlQuery::prepare(const QString &query) +{ + bool ret = QSqlQuery::prepare(query); + if (!ret) { + Tf::writeQueryLog(QLatin1String("(Query prepare) ") + query, ret, lastError()); + } + return *this; +} + /*! Executes the SQL in \a query. Returns true and sets the query state to active if the query was successful; otherwise returns false. diff --git a/src/tsqlquery.h b/src/tsqlquery.h index 6b99d226f..937b22029 100644 --- a/src/tsqlquery.h +++ b/src/tsqlquery.h @@ -34,15 +34,6 @@ class T_CORE_EXPORT TSqlQuery : public QSqlQuery }; -/*! - Prepares the SQL query \a query for execution. -*/ -inline TSqlQuery &TSqlQuery::prepare(const QString &query) -{ - QSqlQuery::prepare(query); - return *this; -} - /*! Set the placeholder \a placeholder to be bound to value \a val in the prepared statement.