diff options
author | David Sommerseth <dazo@users.sourceforge.net> | 2012-10-07 16:08:38 +0200 |
---|---|---|
committer | David Sommerseth <dazo@users.sourceforge.net> | 2012-10-08 02:17:51 +0200 |
commit | 79b7a8c5ad5d4de6fc69d71585625b8a74198c47 (patch) | |
tree | deff813df996c47f2bdeb824577309a54ae8c3c7 /database/sqlite/edb-sqlite.c | |
parent | b036940698442e61d7623702a7835af4d4e8e76a (diff) | |
download | eurephia-79b7a8c5ad5d4de6fc69d71585625b8a74198c47.tar.gz eurephia-79b7a8c5ad5d4de6fc69d71585625b8a74198c47.tar.xz eurephia-79b7a8c5ad5d4de6fc69d71585625b8a74198c47.zip |
sqlite: Added SQL function to convert datetime timestamps from UTC/GMT to localtime
All CURRENT_TIMESTAMP calls are returned in UTC/GMT, and this value is stored in the
database. When using eurephiadm to look at these datetime fields the UTC/GMT value
is used, and needs to be taken in consideration when looking at the reports. This
patch is the first step to handle the local time zone better.
This patch also fixes the 'debug' program in sqlite.c, making use of the
eurephia_log_init() and eurephia_log_close() calls for log preparations.
Signed-off-by: David Sommerseth <dazo@users.sourceforge.net>
Diffstat (limited to 'database/sqlite/edb-sqlite.c')
-rw-r--r-- | database/sqlite/edb-sqlite.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/database/sqlite/edb-sqlite.c b/database/sqlite/edb-sqlite.c index 4c15a5a..724e095 100644 --- a/database/sqlite/edb-sqlite.c +++ b/database/sqlite/edb-sqlite.c @@ -164,6 +164,13 @@ int eDBconnect(eurephiaCTX *ctx, const int argc, const char **argv) dbc->config = NULL; ctx->dbc = dbc; + if( sqlite_init_functions(ctx) != dbSUCCESS ) { + sqlite3_close((sqlite3 *) dbc->dbhandle); + free_nullsafe(ctx, dbc->dbname); + dbc->dbhandle = NULL; + return 0; + } + // Load configuration parameters into memory eurephia_log(ctx, LOG_INFO, 1, "Reading config from database (openvpn_config)"); res = sqlite_query(ctx, "SELECT datakey, dataval FROM openvpn_config"); |