From cf0d81e2d93d2748cccf46af2689cd48ae1d9c2a Mon Sep 17 00:00:00 2001 From: Jacob Quinn Date: Thu, 29 Oct 2026 11:09:48 -0600 Subject: [PATCH] Make query results subtype DBInterface.Cursor DBInterface.execute returns a SQLite.Query, which did not subtype DBInterface.Cursor, so code that dispatches on the abstract cursor type (such as StructUtils' DBInterface extension, which writes a cursor as an array of rows) did not apply to it. MySQL.jl's and FunSQL's cursors already subtype it. Co-Authored-By: Claude Opus 5.5 --- src/tables.jl | 2 +- test/runtests.jl | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/tables.jl b/src/tables.jl index 4ff80cb..4105d71 100644 --- a/src/tables.jl +++ b/src/tables.jl @@ -2,7 +2,7 @@ using Tables sym(ptr) = ccall(:jl_symbol, Ref{Symbol}, (Ptr{UInt8},), ptr) -struct Query{strict} +struct Query{strict} <: DBInterface.Cursor stmt::Stmt status::Base.RefValue{Cint} names::Vector{Symbol} diff --git a/test/runtests.jl b/test/runtests.jl index 6c6e723..9f8df46 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -446,6 +446,12 @@ end end end + @testset "Query is a DBInterface.Cursor" begin + setup_clean_test_db() do db + @test DBInterface.execute(db, "SELECT * FROM Employee") isa DBInterface.Cursor + end + end + @testset "isempty(::Query)" begin setup_clean_test_db() do db @test !DBInterface.execute(