Saturday, October 1, 2011

Ignoring Case in SQLite Android Queries

Instead of using the "=?" string to match strings exactly, use "like?":

    db.query(TABLE_NAME, COLUMNS, REG_COLUMN + " LIKE? ", new String[] {searchQuery}, null, null, null);

instead of:

    db.query(TABLE_NAME, COLUMNS, REG_COLUMN + "=? ", new String[] {searchQuery}, null, null, null);




2 comments:

  1. Thanks mate! I did solve my problem.

    ReplyDelete
  2. Better solution: http://www.sqlite.org/lang_expr.html#collateop

    ReplyDelete