changeset 248:4f947840c806

Oops, forgot to move slCheckAndReportSQLError() to util.cpp. Fixed.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 08 May 2018 13:21:17 +0300
parents 8980b61740c1
children cfaf03d8d23e
files src/main.cpp src/util.cpp
diffstat 2 files changed, 26 insertions(+), 28 deletions(-) [+]
line wrap: on
line diff
--- a/src/main.cpp	Tue May 08 13:18:58 2018 +0300
+++ b/src/main.cpp	Tue May 08 13:21:17 2018 +0300
@@ -55,34 +55,6 @@
 static const int nslSQLSchemaData = sizeof(slSQLSchemaData) / sizeof(slSQLSchemaData[0]);
 
 
-//
-// Check if an SQL error has occured (for given QSqlError) and
-// report it to stdout if so. Return "false" if error has occured,
-// true otherwise.
-//
-bool slCheckAndReportSQLError(const QString where, const QSqlError &err, bool report)
-{
-    if (err.isValid())
-    {
-        // If an error has occured, log it
-        slLog("ERROR",
-            QStringLiteral("SQL %1: %2").
-            arg(where).arg(err.text()));
-        return false;
-    }
-    else
-    {
-        // If no error, but event reporting requested, log it
-        if (report)
-        {
-            slLog("NOTE",
-                QStringLiteral("SQL OK %1").arg(where));
-        }
-        return true;
-    }
-}
-
-
 void SLPersonInfo::dump()
 {
     printf(
--- a/src/util.cpp	Tue May 08 13:18:58 2018 +0300
+++ b/src/util.cpp	Tue May 08 13:21:17 2018 +0300
@@ -109,3 +109,29 @@
 }
 
 
+//
+// Check if an SQL error has occured (for given QSqlError) and
+// report it to stdout if so. Return "false" if error has occured,
+// true otherwise.
+//
+bool slCheckAndReportSQLError(const QString where, const QSqlError &err, bool report)
+{
+    if (err.isValid())
+    {
+        // If an error has occured, log it
+        slLog("ERROR",
+            QStringLiteral("SQL %1: %2").
+            arg(where).arg(err.text()));
+        return false;
+    }
+    else
+    {
+        // If no error, but event reporting requested, log it
+        if (report)
+        {
+            slLog("NOTE",
+                QStringLiteral("SQL OK %1").arg(where));
+        }
+        return true;
+    }
+}