diff options
author | June McEnroe <june@causal.agency> | 2019-12-05 11:20:46 -0500 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2019-12-05 11:20:46 -0500 |
commit | 5fedc8a9318e5ba1dcfd582b06da8fdea2e13124 (patch) | |
tree | 9e6fe097d883cef1796d542ac29bbf8be7c93e28 | |
parent | Add basic unscoop import tool (diff) | |
download | litterbox-5fedc8a9318e5ba1dcfd582b06da8fdea2e13124.tar.gz litterbox-5fedc8a9318e5ba1dcfd582b06da8fdea2e13124.zip |
Insert colons into timezones
Diffstat (limited to '')
-rw-r--r-- | unscoop.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/unscoop.c b/unscoop.c index 7679f19..be57128 100644 --- a/unscoop.c +++ b/unscoop.c @@ -158,11 +158,15 @@ int main(int argc, char *argv[]) { "INSERT OR IGNORE INTO names (nick, user, host)" "VALUES ($nick, $user, $host);" ); + // SQLite expects a colon in the timezone, but ISO8601 does not. sqlite3_stmt *insertEvent = dbPrepare( db, SQLITE_PREPARE_PERSISTENT, "INSERT INTO events (contextID, type, time, nameID, target, message)" - "SELECT $contextID, $type, $time, id, $target, $message FROM names" - " WHERE nick = $nick AND user = $user AND host = $host;" + "SELECT" + " $contextID, $type," + " datetime(substr($time, 1, 22) || ':' || substr($time, -2))," + " id, $target, $message" + " FROM names WHERE nick = $nick AND user = $user AND host = $host;" ); dbBindInt(insertEvent, 1, contextID); @@ -194,7 +198,6 @@ int main(int argc, char *argv[]) { if (error) continue; dbBindInt(insertEvent, 2, matcher->type); - // FIXME: SQLite doesn't parse ISO8601 timezones. bindMatch(insertEvent, 3, line, match[matcher->time]); if (matcher->target) { bindMatch(insertEvent, 4, line, match[matcher->target]); |