SQLITE3 strings in where clauses seem confused

I'm wondering if anyone has any clarification on the difference between the following statements using sqlite3 gem with ruby 1.9.x:

@db.execute("INSERT INTO table(a,b,c) VALUES (?,?,?)", 
some_int, other_int, some_string)


@db.execute("INSERT INTO table(a,b,c) VALUES (#{some_int},"+ 
+"#{some_int}, #{some_string})")

My problem is: When I use the first method for insertion, I can't query for the "c" column using the following statement:

SELECT * FROM table WHERE c='some magic value'

I can use this:

"SELECT * FROM table WHERE c=?", "some magic value" 

but what I really want to use is

"SELECT * FROM table WHERE c IN ('#{options.join("','")}')" 

And this doesn't work with the type of inserts.

Does anyone know what the difference is at the database level that is preventing the IN from working properly?


I figured this out quite a while ago, but forgot to come back and point it out, in case someone finds this question at another time.

The difference turns out to be blobs. Apparently when you use the first form above (the substitution method using (?,?)) SQLite3 uses blogs to enter the data. However, if you construct an ordinary SQL statement, it's inserted as a regular string and the two aren't equivalent.

Insert is not possible to row query but row query used in get data that time this one working.

SQLite in you used in mobile app that time not work bat this row query you write in SQLite Browse in that work

Need Your Help

PHP: Whole HTML page as variable - is there a better way?

php html variables concatenation

I have a large form, in the end of the form a user is presented with a summary:

Searching for specific text in a text file. Returning it to a textbox

java search text-files jgrasp

I am very new to java. I am working on project for class that would look up books in a text file and display information about them. Primarily if the book is in stock or not. The text file is set u...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.