mardi 10 mars 2015

How to put parameters in sql query builder with LIKE %..% sql

So i'm using a SQLiteQueryBuilder in this form.



private static final String broadSearchSelection =
ArticleEntry.COLUMN_TITLE + " LIKE % ? % OR " +
ArticleEntry.COLUMN_SOURCE + " LIKE % ? % OR " +
ArticleEntry.COLUMN_SUMMARY + " LIKE % ? % OR " +
CategoryEntry.COLUMN_DISPLAY_CATEGORY_NAME + " LIKE % ? % ";


Unfortunately, it doesn't allow me to run the program in this form. Neither with LIKE " % ? % ", nor LIKE ' % ? % ' , nor with \" nor with \'. Can you guyz tell me how to write the builder such that it reconizes my parameters? I'm runnig it with the code:



articleByCategoryQueryBuilder.query(mOpenHelper.getReadableDatabase(),
projection,
selection,
selectionArgs,
null,
null,
null
);

Aucun commentaire:

Enregistrer un commentaire