The arguments in SQLiteDatabase raw query are bound as Strings , and this creates problems for me.
Request example (binding 50 ):
SELECT ? < 68
returns: 0
SELECT min(?, 68)
returns: 68
Such results are due to the fact that 50 bound as a String, and the query looks like SELECT '50' < 68 ; which returns false .
A complex query created at runtime should use SQLiteDatabase.rawQuery .
How to connect data as a whole ?
I found one solution:
SELECT CAST( ? AS INTEGER ) < 68 ;
but looks ugly. Is there any other way? I can not find adequate methods in the Android API.
source share