build query a bit more effeciently

This commit is contained in:
Eric House 2014-03-19 22:52:33 -07:00
parent 38fe8ec3fd
commit c7818bd364

View file

@ -1669,13 +1669,8 @@ public class DBUtils {
{
String selection = String.format( "%s = %d", DBHelper.LANGUAGE, lang );
if ( null != words ) {
String[] inQuotes = new String[words.length];
for ( int ii = 0; ii < inQuotes.length; ++ii ) {
inQuotes[ii] = String.format( "'%s'", words[ii] );
}
String wordsTest = String.format( " AND %s in (%s)", DBHelper.WORD,
TextUtils.join(",", inQuotes) );
selection += wordsTest;
selection += String.format( " AND %s in ('%s')", DBHelper.WORD,
TextUtils.join("','", words) );
}
initDB( context );