mercredi 1 avril 2015

Ruby SQLite3 bind_params

I'm having an issue with Ruby SQLite. This is my code,



stmt = DB.prepare "SELECT * FROM Tasks WHERE job = ? AND assigned = 0"
stmt.bind_params input[1]
results = stmt.execute
puts results.next


Where input[1] = "test"


If stmt.bind_params input[1] is changed to stmt.bind_params "test", the sql query works, if it is left as is, it doesn't. I've checked to make absolutely sure that "test" and input[1] are equal with == and by using .bytes on both of them and manually comparing. Any ideas on why this might be the case?


Aucun commentaire:

Enregistrer un commentaire