sqlite的匹配运算符 [英] sqlite match operator
问题描述
在Android上我想使用类似这样的查询:
On Android i would like to use a query similar to this:
SELECT docid FROM docs WHERE docs MATCH '("sqlite database" OR "sqlite library") AND linux'
http://www.sqlite.org/fts3.html#section_3
问题是,我得到了一个畸形的比赛前pression错误。当我做更多的基本匹配查询它的工作原理,似乎这个问题可能是因为括号。
The problem is that I got a "malformed match expression error". When I do more basic match query it works, and it seems the issue might be because of the parentheses.
当我使用完全一样的语句(除表中的列名)的错误是一样的。
When I use exactly the same statement (except the table the column name) the error is the same.
完整的错误消息:
sqlite returned: error code = 1, msg = statement aborts at 7:
[SELECT * FROM namedays WHERE names MATCH '("sqlite database" OR "sqlite library") AND linux';]
malformed MATCH expression: [("sqlite database" OR "sqlite library") AND linux], db=/data/data/org.xyz/databases/data
任何想法?
推荐答案
我相信你没有的SQLite与SQLITE_ENABLE_FTS3_PARENTHESIS选项编译。因此,你只能使用标准查询语法,不是的增强的查询语法
I believe you do not have SQLite compiled with the SQLITE_ENABLE_FTS3_PARENTHESIS option. As such, you can only use the Standard Query Syntax, not the Enhanced Query Syntax
您可以轻松地通过执行 compile_options $ C $验证这一点C>编译
。例如,我们可以看到,我的sqlite3的不具有增强的语法:
You can easily verify this by executing the compile_options
pragma. For example, we see that my sqlite3 doesn't have the enhanced syntax:
sqlite> PRAGMA compile_options;
DISABLE_DIRSYNC
ENABLE_COLUMN_METADATA
ENABLE_FTS3
ENABLE_RTREE
ENABLE_UNLOCK_NOTIFY
SECURE_DELETE
TEMP_STORE=1
THREADSAFE=1
这篇关于sqlite的匹配运算符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!