Is it possible to bind arrays of literals in sqlite3-ruby?

Posted by willb on Stack Overflow See other posts from Stack Overflow or by willb
Published on 2010-05-18T16:36:43Z Indexed on 2010/05/18 16:40 UTC
Read the original article Hit count: 282

Filed under:
|
|

I'd like to execute the following sort of query through sqlite3-ruby:

SELECT * FROM foo WHERE bar IN (:items)

and bind :items to one or many literals. Is this possible? The obvious technique of passing the list of literals as an array as follows doesn't seem to work:

db.execute("SELECT * FROM foo WHERE bar IN (:items)", :items=>[3,1])

(In the above example, only the first value in the array is bound to :items.)

© Stack Overflow or respective owner

Related posts about sqlite3

Related posts about sqlite3-ruby