# HG changeset patch # User Matti Hamalainen # Date 1525774877 -10800 # Node ID 4f947840c806bb13f93c936cb125583301b4ed2c # Parent 8980b61740c16c58eec9fb99a91ac5d440f608e5 Oops, forgot to move slCheckAndReportSQLError() to util.cpp. Fixed. diff -r 8980b61740c1 -r 4f947840c806 src/main.cpp --- 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( diff -r 8980b61740c1 -r 4f947840c806 src/util.cpp --- 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; + } +}