From 9b6ccb3eeffe94634050a9427965b2e4f694327c Mon Sep 17 00:00:00 2001 From: Felipe Pena Date: Thu, 3 Apr 2025 11:18:29 -0300 Subject: [PATCH] db.mysql: fix handling of nullable timestamp (fix #24120) (#24125) --- vlib/db/mysql/orm.c.v | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/vlib/db/mysql/orm.c.v b/vlib/db/mysql/orm.c.v index fc01bdc56e..d7beedfb61 100644 --- a/vlib/db/mysql/orm.c.v +++ b/vlib/db/mysql/orm.c.v @@ -301,7 +301,11 @@ fn data_pointers_to_primitives(data_pointers []&u8, types []int, field_types []F } .type_datetime, .type_timestamp { string_time := unsafe { cstring_to_vstring(&char(data)) } - primitive = time.parse(string_time)! + if string_time == '' { + primitive = orm.Null{} + } else { + primitive = time.parse(string_time)! + } } else {} }