Treat NULLs as DateTime epoch
This commit is contained in:
parent
882ff042e2
commit
766878432b
1 changed files with 5 additions and 0 deletions
|
@ -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_FLOAT => getColumnFloat(stmt, T, idx),
|
||||||
c.SQLITE_TEXT => getColumnText(stmt, T, idx, alloc),
|
c.SQLITE_TEXT => getColumnText(stmt, T, idx, alloc),
|
||||||
c.SQLITE_NULL => {
|
c.SQLITE_NULL => {
|
||||||
|
if (T == DateTime) {
|
||||||
|
std.log.warn("SQLite: Treating NULL as DateTime epoch", .{});
|
||||||
|
return std.mem.zeroes(DateTime);
|
||||||
|
}
|
||||||
|
|
||||||
if (@typeInfo(T) != .Optional) {
|
if (@typeInfo(T) != .Optional) {
|
||||||
std.log.err("SQLite column {}: Expected value of type {}, got (null)", .{ idx, T });
|
std.log.err("SQLite column {}: Expected value of type {}, got (null)", .{ idx, T });
|
||||||
return error.ResultTypeMismatch;
|
return error.ResultTypeMismatch;
|
||||||
|
|
Loading…
Reference in a new issue