c - 如何在 Windows 上的 sqlite3 中启用全文搜索

标签 c sqlite visual-c++

我已经使用 Visual C++ 2008 在 Windows 7 上编译了 sqlite 在“sqlite3.c”文件中启用 FTS4,如下所示

#ifndef SQLITE_ENABLE_FTS3
#define SQLITE_ENABLE_FTS3
#define SQLITE_ENABLE_FTS4
#define SQLITE_ENABLE_FTS3_PARENTHESIS
#endif

调试版本工作正常,但发布版本失败并出现错误 尝试创建表时“没有这样的模块 FTS3”

CREATE VIRTUAL TABLE DOCS USING FTS3(DOC_NAME, DOC)

这是怎么回事?

最佳答案

来自 http://www.sqlite.org/fts3.html

部分2。编译和启用 FTS3 和 FTS4

If using the amalgamation autoconf based build system, setting the CPPFLAGS environment variable while running the 'configure' script is an easy way to set these macros. For example, the following command:

CPPFLAGS="-DSQLITE_ENABLE_FTS3 -DSQLITE_ENABLE_FTS3_PARENTHESIS" ./configure <configure options>

那些通常传递给配置脚本的选项(如果有的话)在哪里。

Because FTS3 and FTS4 are virtual tables, The SQLITE_ENABLE_FTS3 compile-time option is incompatible with the SQLITE_OMIT_VIRTUALTABLE option.

If a build of SQLite does not include the FTS modules, then any attempt to prepare an SQL statement to create an FTS3 or FTS4 table or to drop or access an existing FTS table in any way will fail. The error message returned will be similar to "no such module: ftsN" (where N is either 3 or 4).

If the C version of the ICU library is available, then FTS may also be compiled with the SQLITE_ENABLE_ICU pre-processor macro defined. Compiling with this macro enables an FTS tokenizer that uses the ICU library to split a document into terms (words) using the conventions for a specified language and locale.

-DSQLITE_ENABLE_ICU

关于c - 如何在 Windows 上的 sqlite3 中启用全文搜索,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7163566/

相关文章:

c++ - gcc 链接器描述文件强制符号位于特定地址

c - Silabs Clockbuilder C头文件使用

c - 数组附加和平均未在 C 程序中显示输出,但要求 2 个输入

database - 在 SQLite 中设置整数列的默认值

c++ - 如何使用 sqlite3_exec 从 sqlite3 数据库中选择数据到变量中?

c - 如何在 C 中将 double 转换为 int?

c++ - 为什么 Microsoft std::vector::insert 使用 rotate()?

visual-studio-2008 - 多线程 DLL (/MD) 与多线程 (/MT)

c++ - 对嵌套结构单链和双链进行排序

php - SQLite 数据库中的递归被锁定