dimanche 28 décembre 2014

COLLATE NOCASE bug?

Currently on Android 5.x my app is having issues with an SQLite query. There seem to be an issue with ORDER BY " + KEY_TEMP_CAT_CATEGORY + " COLLATE NOCASE. This is causing my query to exclude some items from the results. Removing this particular part causes the issue to disappear. This wasn't an issue until Android 5.x :(


Any tips or ideas how I can resolve this would be greatly appreciated.


Here is the full query:



// query for total categories
String queryTotalCat =
"SELECT _id, NULL as " + KEY_TEMP_CAT_CATEGORY + ", " +
"COUNT(*) as " + KEY_TEMP_CAT_COUNT + " " +
"FROM " + TABLE_NAME + " " +
"WHERE " + KEY_TYPE_FAVORITE + "!=0";

// query for total count of each repeated categories
String queryTotalRows =
"SELECT _id, " + KEY_CATEGORY + " as " + KEY_TEMP_CAT_CATEGORY + ", " +
"COUNT(" + KEY_CATEGORY + ") as " + KEY_TEMP_CAT_COUNT + " " +
"FROM " + TABLE_NAME + " " +
"WHERE " + KEY_TYPE_FAVORITE + "!=0";

// union the two queries
String query =
queryTotalCat + " UNION " + queryTotalRows + " " +
"ORDER BY "+ KEY_TEMP_CAT_CATEGORY + " " +
"COLLATE NOCASE ASC";

Aucun commentaire:

Enregistrer un commentaire