diff --git a/src/sql/engines/sqlite.zig b/src/sql/engines/sqlite.zig index a69de93..be94c7e 100644 --- a/src/sql/engines/sqlite.zig +++ b/src/sql/engines/sqlite.zig @@ -313,6 +313,11 @@ fn getColumn(stmt: *c.sqlite3_stmt, comptime T: type, idx: u15, alloc: ?Allocato c.SQLITE_FLOAT => getColumnFloat(stmt, T, idx), c.SQLITE_TEXT => getColumnText(stmt, T, idx, alloc), c.SQLITE_NULL => { + if (T == DateTime) { + std.log.warn("SQLite: Treating NULL as DateTime epoch", .{}); + return std.mem.zeroes(DateTime); + } + if (@typeInfo(T) != .Optional) { std.log.err("SQLite column {}: Expected value of type {}, got (null)", .{ idx, T }); return error.ResultTypeMismatch;