using SearchLight
using SearchLightSQLite
include("app/resources/houses/Houses.jl")
using .Houses
SearchLight.Configuration.load() |> SearchLight.connect
h = House(street="Barcelona", size=400, rooms=missing)
save(h)
h = House(street="Barcelona 2", size=400, rooms=nothing)
save(h)
h = House(street="Barcelona 3", size=400, rooms=4)
save(h)
This is the log info:
[ Info: INSERT INTO houses ("street", "size", "rooms") VALUES ('Barcelona', 400.0, 'missing')
[ Info: ; SELECT CASE WHEN last_insert_rowid() = 0 THEN -1 ELSE last_insert_rowid() END AS LAST_INSERT_ID
[ Info: INSERT INTO houses ("street", "size", "rooms") VALUES ('Barcelona 2', 400.0, NULL)
[ Info: ; SELECT CASE WHEN last_insert_rowid() = 0 THEN -1 ELSE last_insert_rowid() END AS LAST_INSERT_ID
[ Info: INSERT INTO houses ("street", "size", "rooms") VALUES ('Barcelona 3', 400.0, 4)
[ Info: ; SELECT CASE WHEN last_insert_rowid() = 0 THEN -1 ELSE last_insert_rowid() END AS LAST_INSERT_ID
Expected behaviormissing should insert NULLlike nothingdoes
Describe the bug When a struct's field has
missing
value of typeMissing
, saving it to a sqlite DB inserts a string instead of aNULL
value.To reproduce
I've created a MWE that inserts
missing
,nothing
andInt
values. The full code is here: https://github.com/GenieFramework/CodeExamples/tree/main/src/3.database/null_valuesThis is the log info:
Expected behavior
missing
should insertNULL
likenothing
doesAdditional context This issue comes from a Discord thread https://discord.com/channels/774897545717219328/1089630389263405086