Export simple_query, pinyin_dict, jieba_dict and jieba_query#203
Open
xuxiaocheng0201 wants to merge 1 commit intowangfenjin:masterfrom
Open
Export simple_query, pinyin_dict, jieba_dict and jieba_query#203xuxiaocheng0201 wants to merge 1 commit intowangfenjin:masterfrom
xuxiaocheng0201 wants to merge 1 commit intowangfenjin:masterfrom
Conversation
Owner
|
为什么要重新实现 sqlite3_simple_init?感觉如果想做一个 rust 版本的话可以选择把所有函数都实现一遍 |
Author
|
不是想做rust版本,我在用sqlcipher,如果用auto-extension就没法在sqlite3_simple_init之前设置key,而fts5扩展要执行SELECT fts5(?),sqlcipher中没设置key执行select会报错,如果手动调用,最后一个参数pApi又不能为null,只好重新在rust层手动实现一个pApi可以为null的版本 |
Author
|
刚发现不对, |
Owner
|
ok 那我先不 merge 了,理论上这几个函数不用对外的,sqlite 能加载的函数就那几个 |
Owner
|
你可以解释下具体问题,我看怎么弄,看起来跟加载机制无关 |
Author
|
问题出在用 sqlcipher 时,你可以试一下,没法加载分词器,会报错。先用 |
Author
不过像 |
Author
|
目前我的解决办法是这样,不过这么大的 api 变更也不太好合并吧 Index: src/simple_tokenizer.h
<+>UTF-8
===================================================================
diff --git a/src/simple_tokenizer.h b/src/simple_tokenizer.h
--- a/src/simple_tokenizer.h
+++ b/src/simple_tokenizer.h
@@ -50,5 +50,6 @@
extern "C" void fts5_simple_xDelete(Fts5Tokenizer *tokenizer_ptr);
extern "C" int sqlite3_simple_init(sqlite3 *db, char **pzErrMsg, const sqlite3_api_routines *pApi);
+extern "C" int sqlite3_simpletokenizer_init(sqlite3 *db, char **pzErrMsg, const sqlite3_api_routines *pApi);
#endif // SIMPLE_TOKENIZER_H_
Index: src/entry.cc
<+>UTF-8
===================================================================
diff --git a/src/entry.cc b/src/entry.cc
--- a/src/entry.cc
+++ b/src/entry.cc
@@ -129,6 +129,12 @@
rc = sqlite3_create_function(db, "jieba_dict", 1, SQLITE_UTF8 | SQLITE_DETERMINISTIC, NULL, &jieba_dict, NULL, NULL);
#endif
+ return rc;
+}
+
+int sqlite3_simpletokenizer_init(sqlite3 *db, char **pzErrMsg, const sqlite3_api_routines *pApi) {
+ int rc = SQLITE_OK;
+
// fts5_tokenizer tokenizer = {fts5AsciiCreate, fts5AsciiDelete, fts5AsciiTokenize };
fts5_tokenizer tokenizer = {fts5_simple_xCreate, fts5_simple_xDelete, fts5_simple_xTokenize};
fts5_api *fts5api;
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
rusqlite/rusqlite#1813
sqlcipher/sqlcipher#586
我在 rust 层重新实现了一遍 sqlite3_simple_init,发现这四个函数没导出,希望合并