diff src/util.cpp @ 255:55581d90c55d

Change API for slCheckAndReportSQLError().
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 10 Oct 2018 13:21:51 +0300
parents 0e0ad52994ca
children df3f902588af
line wrap: on
line diff
--- a/src/util.cpp	Thu May 10 01:16:30 2018 +0300
+++ b/src/util.cpp	Wed Oct 10 13:21:51 2018 +0300
@@ -114,8 +114,9 @@
 // report it to stdout if so. Return "false" if error has occured,
 // true otherwise.
 //
-bool slCheckAndReportSQLError(const QString where, const QSqlError &err, bool report)
+bool slCheckAndReportSQLError(const QSqlQuery &query, const QString where, bool report)
 {
+    const QSqlError err = query.lastError();
     if (err.isValid())
     {
         // If an error has occured, log it
@@ -154,7 +155,7 @@
             tcreate.exec(sql);
 
             if (!slCheckAndReportSQLError(
-                sql, tcreate.lastError(), true))
+                tcreate, sql, true))
                 return false;
 
             tcreate.finish();
@@ -174,7 +175,7 @@
                     insert.exec(sql);
 
                     if (!slCheckAndReportSQLError(
-                        sql, insert.lastError(), true))
+                        insert, sql, true))
                         return false;
 
                     insert.finish();