Mercurial > hg > syntilista
comparison src/util.h @ 252:4d2b37a0acf2
Move SQL table creation from schema array to util-module.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Tue, 08 May 2018 15:00:17 +0300 |
parents | 43a5e09bb832 |
children | eadffc38ab43 |
comparison
equal
deleted
inserted
replaced
251:ede0fde2ae6e | 252:4d2b37a0acf2 |
---|---|
7 // included file "COPYING" for exact terms. | 7 // included file "COPYING" for exact terms. |
8 // | 8 // |
9 #ifndef SL_UTIL_H | 9 #ifndef SL_UTIL_H |
10 #define SL_UTIL_H | 10 #define SL_UTIL_H |
11 | 11 |
12 | |
13 #define SQL_MAX_SCHEMA_INSERTS 16 | |
14 | |
15 | |
16 // | |
17 // SQL schema / table definitions | |
18 // | |
19 typedef struct | |
20 { | |
21 QString name; | |
22 QString schema; | |
23 } SLSQLSchemaDef; | |
24 | |
25 | |
26 // | |
27 // Various helper utility functions | |
28 // | |
12 double slMoneyStrToValue(const QString &str); | 29 double slMoneyStrToValue(const QString &str); |
13 QString slMoneyValueToStr(double val); | 30 QString slMoneyValueToStr(double val); |
14 QString slMoneyValueToStrSign(double val); | 31 QString slMoneyValueToStrSign(double val); |
32 | |
15 QString slCleanupStr(const QString &str); | 33 QString slCleanupStr(const QString &str); |
34 | |
16 const QDateTime slDateTimeToLocal(const QDateTime &val); | 35 const QDateTime slDateTimeToLocal(const QDateTime &val); |
17 const QString slDateTimeToStr(const QDateTime &val); | 36 const QString slDateTimeToStr(const QDateTime &val); |
18 | 37 |
19 void slLog(const QString &mtype, const QString &msg); | 38 void slLog(const QString &mtype, const QString &msg); |
20 int slErrorMsg(const QString &title, const QString &msg); | 39 int slErrorMsg(const QString &title, const QString &msg); |
40 | |
21 bool slCheckAndReportSQLError(const QString where, const QSqlError &err, bool report = false); | 41 bool slCheckAndReportSQLError(const QString where, const QSqlError &err, bool report = false); |
42 bool slConditionallyCreateSQLTables(QSqlDatabase &db, const SLSQLSchemaDef *schema, const int nschema); | |
22 | 43 |
23 | 44 |
24 #endif // SL_UTIL_H | 45 #endif // SL_UTIL_H |