comparison src/util.cpp @ 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 43a5e09bb832
children 4d2b37a0acf2
comparison
equal deleted inserted replaced
247:8980b61740c1 248:4f947840c806
107 107
108 return dlg.exec(); 108 return dlg.exec();
109 } 109 }
110 110
111 111
112 //
113 // Check if an SQL error has occured (for given QSqlError) and
114 // report it to stdout if so. Return "false" if error has occured,
115 // true otherwise.
116 //
117 bool slCheckAndReportSQLError(const QString where, const QSqlError &err, bool report)
118 {
119 if (err.isValid())
120 {
121 // If an error has occured, log it
122 slLog("ERROR",
123 QStringLiteral("SQL %1: %2").
124 arg(where).arg(err.text()));
125 return false;
126 }
127 else
128 {
129 // If no error, but event reporting requested, log it
130 if (report)
131 {
132 slLog("NOTE",
133 QStringLiteral("SQL OK %1").arg(where));
134 }
135 return true;
136 }
137 }