Skip to content

Commit 150941a

Browse files
committed
Fix two quick issues
First is allowing bind to take AbstractVector; this is needed for DBInterface.executemany which passes a custom AbstractVector "view" type for parameters. Second is calling sqlite_reset before executing statements; this is important for prepared statements because they may have been executed before and never reset (they're usually reset by iterating results, but we don't require users to fully consume cursor results).
1 parent 70ac515 commit 150941a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/SQLite.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ function bind!(stmt::Stmt, params::Union{NamedTuple, Dict})
181181
end
182182
end
183183

184-
function bind!(stmt::Stmt, values::Union{Vector, Tuple})
184+
function bind!(stmt::Stmt, values::Union{AbstractVector, Tuple})
185185
nparams = sqlite3_bind_parameter_count(stmt.handle)
186186
@assert nparams == length(values) "you must provide values for all query placeholders"
187187
for i in 1:nparams
@@ -306,6 +306,7 @@ The sqlite return status code is returned. To return results from a query, pleas
306306
function execute end
307307

308308
function execute(stmt::Stmt, params=())
309+
sqlite3_reset(stmt.handle)
309310
bind!(stmt, params)
310311
r = sqlite3_step(stmt.handle)
311312
stmt.status = r

0 commit comments

Comments
 (0)