Mercurial > hg > syntilista
comparison src/main.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 | cfaf03d8d23e |
comparison
equal
deleted
inserted
replaced
247:8980b61740c1 | 248:4f947840c806 |
---|---|
51 ) | 51 ) |
52 }, | 52 }, |
53 }; | 53 }; |
54 | 54 |
55 static const int nslSQLSchemaData = sizeof(slSQLSchemaData) / sizeof(slSQLSchemaData[0]); | 55 static const int nslSQLSchemaData = sizeof(slSQLSchemaData) / sizeof(slSQLSchemaData[0]); |
56 | |
57 | |
58 // | |
59 // Check if an SQL error has occured (for given QSqlError) and | |
60 // report it to stdout if so. Return "false" if error has occured, | |
61 // true otherwise. | |
62 // | |
63 bool slCheckAndReportSQLError(const QString where, const QSqlError &err, bool report) | |
64 { | |
65 if (err.isValid()) | |
66 { | |
67 // If an error has occured, log it | |
68 slLog("ERROR", | |
69 QStringLiteral("SQL %1: %2"). | |
70 arg(where).arg(err.text())); | |
71 return false; | |
72 } | |
73 else | |
74 { | |
75 // If no error, but event reporting requested, log it | |
76 if (report) | |
77 { | |
78 slLog("NOTE", | |
79 QStringLiteral("SQL OK %1").arg(where)); | |
80 } | |
81 return true; | |
82 } | |
83 } | |
84 | 56 |
85 | 57 |
86 void SLPersonInfo::dump() | 58 void SLPersonInfo::dump() |
87 { | 59 { |
88 printf( | 60 printf( |