开发者

Android query selection difference

开发者 https://www.devze.com 2023-03-10 02:08 出处:网络
Using query for my database searching for rows with a specific number, I notice that for the selection argument if I use:

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

0

精彩评论

暂无评论...
验证码 换一张
取 消