Skip to content

Commit 6beb466

Browse files
authored
Convert NULL type columns to Julia Missing type (#261)
Takes the work of @TacHawkes and fixes the failing test.
1 parent 82e1add commit 6beb466

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

src/SQLite.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,7 @@ juliatype(x::Integer) =
372372
x == SQLITE_INTEGER ? Int64 :
373373
x == SQLITE_FLOAT ? Float64 :
374374
x == SQLITE_TEXT ? String :
375+
x == SQLITE_NULL ? Missing :
375376
Any
376377

377378
# convert SQLite declared type into Julia equivalent,

test/runtests.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ end
104104
empty_tbl = DBInterface.execute(columntable, db, "SELECT * FROM Employee WHERE FirstName='Joanne'")
105105
all_tbl = DBInterface.execute(columntable, db, "SELECT * FROM Employee")
106106
@test propertynames(empty_tbl) == propertynames(all_tbl)
107-
@test all(col -> eltype(empty_tbl[col]) >: eltype(all_tbl[col]), propertynames(all_tbl))
107+
@test all(col -> eltype(empty_tbl[col]) == Missing || eltype(empty_tbl[col]) >: eltype(all_tbl[col]), propertynames(all_tbl))
108108
end
109109

110110
DBInterface.execute(db, "create table temp as select * from album")

0 commit comments

Comments
 (0)