Skip to content

Commit 9b6ccb3

Browse files
authored
db.mysql: fix handling of nullable timestamp (fix #24120) (#24125)
1 parent 6326080 commit 9b6ccb3

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

‎vlib/db/mysql/orm.c.v‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,11 @@ fn data_pointers_to_primitives(data_pointers []&u8, types []int, field_types []F
301301
}
302302
.type_datetime, .type_timestamp {
303303
string_time := unsafe { cstring_to_vstring(&char(data)) }
304-
primitive = time.parse(string_time)!
304+
if string_time == '' {
305+
primitive = orm.Null{}
306+
} else {
307+
primitive = time.parse(string_time)!
308+
}
305309
}
306310
else {}
307311
}

0 commit comments

Comments
 (0)