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)

and

@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?

Answers


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

problems with Stateless session bean with EJB3.0 and websphere6.1

session ejb-3.0 javabeans stateless

**I am not able to create Stateless session bean with EJB3.0 and Websphere 6.1.

Increase the width of the style

html css

I currently have something like this::