Hi All,

CREATE TABLE test (A TEXT);
INSERT INTO test VALUES ('1');
SELECT * FROM test WHERE A=1; // returns 1
SELECT * FROM test WHERE A=1.0; // returns nothing

How is the second comparison done?

I realize that you can have double values that are too large to convert to
int64, but as I understand, SQLite does convert doubles to integer values
for storage when they are small enough.

The problem presented itself when binding integers from an Access table
with sqlite3_bind_double because the Access table has the integers in a
float field. (Apparently common). I had to change my library to check
integers in double fields and then bind with sqlite3_bind_int64 in order to
hit a result with WHERE.

What is the best way to check for integers? (fabs(val)<LLONG_MAX) &&
modf(val, &intpart)<EPSILON  ?

Regards,

Paul.

Reply via email to