【发布时间】:2012-02-23 15:34:28
【问题描述】:
我用的是SQLite3的FTS4模块,matchinfo()辅助函数的例子有问题。
目前我只是尝试从http://www.sqlite.org/fts3.html#matchinfo 运行 matchinfo() 示例,但它不起作用。
我在带有 SQLite 3.5.9(预编译版本)的 Windows 7、带有 SQLite 3.6.22 的 Ubuntu Linux OS 10.04.4 和带有 SQLite 3.7.10(都是手动编译版本)的 Mac OS 10.6.8 上进行了尝试。 在所有情况下都启用了 FTS4 模块,并且文档中的所有内容都可以正常工作(偏移量和 sn-p 函数、全文搜索查询等)。 在 Ubuntu 和 Mac OS 上,使用 matchinfo() 示例时没有得到任何结果。在 Windows 上,命令行给了我奇怪的字符。 我通过以下方式进行了尝试:使用 PHP 脚本,使用 NaviCat for SQLite3 和命令行本身。在每种情况下都是一样的。
这是我用于示例的 PHP 代码:
<?php
$db = new SQLite3("matchtest.db", SQLITE3_OPEN_READWRITE | SQLITE3_OPEN_CREATE);
$db->exec("CREATE VIRTUAL TABLE t1 USING fts4(a, b)");
$db->exec("INSERT INTO t1 VALUES('transaction default models default', 'Non transaction reads')");
$db->exec("INSERT INTO t1 VALUES('the default transaction', 'these semantics present')");
$db->exec("INSERT INTO t1 VALUES('single request', 'default data')");
//$result = $db->escapeString("'default transaction \"these semantics\"'");
$result = $db->query("SELECT matchinfo(t1) FROM t1 WHERE t1 MATCH 'default transaction \"these semantics\"'");
while($row = $result->fetchArray()){
var_dump($row);
}
?>
我没有在网上找到任何关于此问题的信息。因此,我不知道如何解决它。 可能是因为 PHP 在处理 BLOB 方面有问题?
我希望你们能帮助我。谢谢!
【问题讨论】: