Form string "?, ?, ..., ?" can be a dynamically created string and safely fit into the original SQL query (since this is a limited form that does not contain external data), and then placeholders can be used as usual.
Consider the String makePlaceholders(int len) function String makePlaceholders(int len) , which returns len question marks separated by commas, and then:
String[] names = { "name1", "name2" };
Just be sure to pass as many values as places. The maximum default limit for host parameters in SQLite is 999 - at least in normal build, not sure about Android :)
Happy coding.
Here is one implementation:
String makePlaceholders(int len) { if (len < 1) {
user166390 Sep 14 '11 at 15:36 2011-09-14 15:36
source share