Using query for my database searching for rows with a specific number
, I notice that for the selection argument if I use:
String selection = NUMBER + " MATCH ?"
String selectionArgs = new String[]{number}
Cursor cursor1 = db.开发者_StackOverflow中文版query(TABLE_NAME, null, selection, selectionArgs, null, null, null);
cursor1.moveToFirst();
this causes an error, where as if I use:
String selection = NUMBER + " = " + number;
Cursor cursor2 = db. query(TABLE_NAME, null, selection, null, null, null, null);
cursor2.moveToFirst();
this works fine with no problems. So what's the difference?
From the SQLite documentation:
"The MATCH operator is a special syntax for the match() application-defined function. The default match() function implementation raises an exception and is not really useful for anything. But extensions can override the match() function with more helpful logic."
http://www.sqlite.org/lang_expr.html
精彩评论