Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "SQLite"
uuid = "0aa819cd-b072-5ff4-a722-6bc24af294d9"
authors = ["Jacob Quinn <[email protected]>", "JuliaData Contributors"]
version = "1.6.0"
version = "1.6.1"

[deps]
DBInterface = "a10d1c49-ce27-4219-8d33-6db1a4562965"
Expand Down
14 changes: 12 additions & 2 deletions src/tables.jl
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,12 @@ end
)
end

function getvalue(q::Query{strict}, col::Int, rownumber::Int, ::Type{T}) where {strict, T}
function getvalue(
q::Query{strict},
col::Int,
rownumber::Int,
::Type{T},
) where {strict,T}
rownumber == q.current_rownumber[] || wrongrow(rownumber)
handle = _get_stmt_handle(q.stmt)
t = C.sqlite3_column_type(handle, col - 1)
Expand Down Expand Up @@ -144,6 +149,11 @@ function DBInterface.execute(
allowduplicates::Bool = false,
strict::Bool = false,
)
if isa(params, NamedTuple) &&
isempty(setdiff(keys(params), [:strict, :allowduplicates]))
strict = get(params, :strict, false)
allowduplicates = get(params, :allowduplicates, false)
end
status = execute(stmt, params)
handle = _get_stmt_handle(stmt)
cols = C.sqlite3_column_count(handle)
Expand Down Expand Up @@ -298,7 +308,7 @@ function load!(
st = nothing;
temp::Bool = false,
ifnotexists::Bool = false,
on_conflict::Union{String, Nothing} = nothing,
on_conflict::Union{String,Nothing} = nothing,
replace::Bool = false,
analyze::Bool = false,
)
Expand Down
15 changes: 15 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,21 @@ end
end
end

@testset "strict=true || isempty(query)" begin
setup_clean_test_db() do db
empty_query =
DBInterface.execute(db, "SELECT * FROM Employee LIMIT 0")
sch = Tables.schema(empty_query)
@test sch == Tables.Schema(empty_query.names, empty_query.types)
strict_query =
DBInterface.execute(db, "SELECT * FROM Employee"; strict = true)
@test strict_query isa SQLite.Query{true}
sch2 = Tables.schema(strict_query)
@test sch2 == Tables.Schema(strict_query.names, strict_query.types)
@test sch.names == sch2.names
end
end

@testset "empty query has correct schema and return type" begin
setup_clean_test_db() do db
empty_scheme = DBInterface.execute(
Expand Down