-
Notifications
You must be signed in to change notification settings - Fork 81
Closed
Description
Looking at the source, it seems as if there is not a bind!(stmt::Stmt, i::Int, val::Vector/Tuple)
in SQLite.jl for queries of the form SELECT * FROM table WHERE x IN (?)
and the parameter would be a julia vector or tuple. I also did not see a sqlite3_bind_*
in api.jl for this kind of thing. Below is some example code that could be used for a test.
I have no idea how to go about calling C-code from Julia. So I can't really help here.
using SQLite
using DataFrames
using Base.Test
df = DataFrame(:x => 1:5, :y => 2:6)
db = SQLite.DB(":memory:")
SQLite.load(db, "test", df)
xs = [2:4 ...]
# select from df in multiple ways:
sdf1 = df[in.(df[:x], [xs]),:]
sdf2 = SQLite.query(db, "SELECT * FROM test WHERE x IN (?) ORDER BY x", values=[xs])
sdf3 = SQLite.query(db, "SELECT * FROM test WHERE x IN (2, 3, 4) ORDER BY x")
@test sdf1 == sdf2
@test sdf1 == sdf3
Metadata
Metadata
Assignees
Labels
No labels