Skip to content

Commit 51c9493

Browse files
lucianolorentiquinnj
authored andcommitted
Fix signature of DBInterface.prepare
1 parent 6b6b208 commit 51c9493

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

src/tables.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,13 @@ end
6969
DBInterface.lastrowid(q::Query) = last_insert_rowid(q.stmt.db)
7070

7171
"""
72-
DBInterface.prepare(db::SQLite.DB, sql::String)
72+
DBInterface.prepare(db::SQLite.DB, sql::AbstractString)
7373
7474
Prepare an SQL statement given as a string in the sqlite database; returns an `SQLite.Stmt` compiled object.
7575
See `DBInterface.execute`(@ref) for information on executing a prepared statement and passing parameters to bind.
7676
A `SQLite.Stmt` object can be closed (resources freed) using `DBInterface.close!`(@ref).
7777
"""
78-
DBInterface.prepare(db::DB, sql::String) = Stmt(db, sql)
78+
DBInterface.prepare(db::DB, sql::AbstractString) = Stmt(db, sql)
7979

8080
"""
8181
DBInterface.execute(db::SQLite.DB, sql::String, [params])

test/runtests.jl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,12 @@ r = DBInterface.execute(db, "SELECT * FROM T") |> columntable
258258
@test r[1][2] == 2
259259
@test r[1][3] == 3
260260

261+
262+
r = DBInterface.execute(db, strip(" SELECT * FROM T ")) |> columntable
263+
@test r[1][1] == 1
264+
@test r[1][2] == 2
265+
@test r[1][3] == 3
266+
261267
@test SQLite.esc_id(["1", "2", "3"]) == "\"1\",\"2\",\"3\""
262268

263269
SQLite.createindex!(db, "T", "x", "x_index"; unique=false)
@@ -292,4 +298,4 @@ r2 = DBInterface.execute(db, "SELECT * FROM T2") |> columntable
292298
# throw informative error on duplicate column names #193
293299
@test_throws ErrorException SQLite.load!((a=[1,2,3], A=[1,2,3]), db)
294300

295-
end # @testset
301+
end # @testset

0 commit comments

Comments
 (0)