diff options
author | Stelios Fragkakis <52996999+stelfrag@users.noreply.github.com> | 2022-08-02 18:12:41 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-02 18:12:41 +0300 |
commit | 6d2fd8886124fe64534636f2c1093bd19a06701b (patch) | |
tree | 6cea7f9b81c05a454d5e6cca1415df62ccd42dfc /database | |
parent | af1badd3cdb78b6aaa807a3a6a78acd0b939e0e8 (diff) |
Handle cases where entries where stored as text (with strftime("%s")) (#13472)
Diffstat (limited to 'database')
-rw-r--r-- | database/sqlite/sqlite_aclk.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/database/sqlite/sqlite_aclk.c b/database/sqlite/sqlite_aclk.c index 5164d4de5d..43b3410974 100644 --- a/database/sqlite/sqlite_aclk.c +++ b/database/sqlite/sqlite_aclk.c @@ -874,7 +874,7 @@ void sql_maint_aclk_sync_database(struct aclk_database_worker_config *wc, struct BUFFER *sql = buffer_create(ACLK_SYNC_QUERY_SIZE); buffer_sprintf(sql,"DELETE FROM aclk_chart_%s WHERE date_submitted IS NOT NULL AND " - "date_updated < unixepoch()-%d;", wc->uuid_str, ACLK_DELETE_ACK_INTERNAL); + "CAST(date_updated AS INT) < unixepoch()-%d;", wc->uuid_str, ACLK_DELETE_ACK_INTERNAL); db_execute(buffer_tostring(sql)); buffer_flush(sql); @@ -885,17 +885,17 @@ void sql_maint_aclk_sync_database(struct aclk_database_worker_config *wc, struct buffer_flush(sql); buffer_sprintf(sql,"DELETE FROM aclk_alert_%s WHERE date_submitted IS NOT NULL AND " - "date_cloud_ack < unixepoch()-%d;", wc->uuid_str, ACLK_DELETE_ACK_ALERTS_INTERNAL); + "CAST(date_cloud_ack AS INT) < unixepoch()-%d;", wc->uuid_str, ACLK_DELETE_ACK_ALERTS_INTERNAL); db_execute(buffer_tostring(sql)); buffer_flush(sql); buffer_sprintf(sql,"UPDATE aclk_chart_%s SET status = NULL, date_submitted=unixepoch() WHERE " - "date_submitted IS NULL AND date_created < unixepoch()-%d;", wc->uuid_str, ACLK_AUTO_MARK_SUBMIT_INTERVAL); + "date_submitted IS NULL AND CAST(date_created AS INT) < unixepoch()-%d;", wc->uuid_str, ACLK_AUTO_MARK_SUBMIT_INTERVAL); db_execute(buffer_tostring(sql)); buffer_flush(sql); buffer_sprintf(sql,"UPDATE aclk_chart_%s SET date_updated = unixepoch() WHERE date_updated IS NULL" - " AND date_submitted IS NOT NULL AND date_submitted < unixepoch()-%d;", + " AND date_submitted IS NOT NULL AND CAST(date_submitted AS INT) < unixepoch()-%d;", wc->uuid_str, ACLK_AUTO_MARK_UPDATED_INTERVAL); db_execute(buffer_tostring(sql)); |