2

I can't find a good example but if the name in the database is "namehascapsinit", It doesn't return anything. Is there anyway to ignore case?

String selection = MyTable.COL_NAME + " = ?";
                        String[] selectionArgs = new String[]{ "NameHasCapsInIt" };
                        c = getActivity().getContentResolver().query(MyTable.CONTENT_URI, null, selection, selectionArgs, null);

Thank in advance!

DDukesterman
  • 1,391
  • 5
  • 24
  • 42
  • 1
    Not the downvoter, but if you search "sqlite ignore case" here, you probably didn't have to ask this question. http://stackoverflow.com/questions/15480319/case-sensitive-and-insensitive-like-in-sqlite – Andrew T. Jul 15 '14 at 07:02

2 Answers2

7

Use this:

SELECT * FROM TableName WHERE col_name COLLATE NOCASE ="namehascapsinit"
Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
1

You can write your code like this

("select * from TableName where col_name collate latin1_swedish_ci =?",String[] selectionArgs = new String[]{ "namehascapsinit" });

This is the example

select * from TableName where col_name collate latin1_swedish_ci ="namehascapsinit"

instead of latin1_swedish_ci you can use whatever collation you want

Meghna
  • 539
  • 4
  • 14