How do I make a case insensitive query with ContentResolver in Android?

前端 未结 3 820
半阙折子戏
半阙折子戏 2021-02-08 04:45

My goal is to get all rows from native db with a specific email address on Android Gingerbread and above.

This query gets only the rows where the case also matches.

3条回答
  •  甜味超标
    2021-02-08 05:35

    Cursor cursor = this.db.query("UserTbl", new String[] {"UserId",
                            "Username", "Password" },
                            "Username = ? COLLATE NOCASE AND Password = ? COLLATE NOCASE", new String[] { userNameString,
                                    passwordString }, null, null, null);
    

提交回复
热议问题