Skip to content

Commit 85abb11

Browse files
authored
Relax NamedTuple length requirements (#230)
This allows queries that take less named parameters than the length of the given NamedTuple to still bind those names that exist. Enables reuse of existing NamedTuples for multiple queries.
1 parent 3f312e5 commit 85abb11

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/SQLite.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ function bind! end
255255

256256
function bind!(stmt::_Stmt, params::DBInterface.NamedStatementParams)
257257
nparams = sqlite3_bind_parameter_count(stmt.handle)
258-
(nparams == length(params)) || throw(SQLiteException("values should be provided for all query placeholders"))
258+
(nparams <= length(params)) || throw(SQLiteException("values should be provided for all query placeholders"))
259259
for i in 1:nparams
260260
name = unsafe_string(sqlite3_bind_parameter_name(stmt.handle, i))
261261
isempty(name) && throw(SQLiteException("nameless parameters should be passed as a Vector"))

0 commit comments

Comments
 (0)