android - how to query against array of integer -


i query:

select * table field1 in (1, 2 ,3);

the field1 integer type. field type string be:

select * table field1 in ('1', '2' ,'3');

but in android both use selectionars string[].

string[] filter = new string("1", "2", "3"); cursor altocursor = mcontentresolver.query(                 uri, projection,                 "field1 in (?,?,?)" +                 filter, null); 

how different field type string, field1 type of string. query same, how know if "1" in string[] integer or string:

string[] filter = new string("1", "2", "3"); cursor altocursor = mcontentresolver.query(                 uri, projection,                 "field1 in (?,?,?)" +                 filter, null); 

confused here, anyone's appreciated!

typically data type of column querying defined integer or string.

database engine not realize if passing string or integer. moment query passed sql engine through error if placing integer values in string column without quote.

  1. check column querying
  2. if string encode them quote
  3. if integer can pass values as comma separated values

to test if string integer can use if (x int)

but in case android smart enough put code them-self guess


Comments

Popular posts from this blog

c# - Better 64-bit byte array hash -

webrtc - Which ICE candidate am I using and why? -

php - Zend Framework / Skeleton-Application / Composer install issue -