OLD | NEW |
1 /* | 1 /* |
2 ** 2013 Apr 22 | 2 ** 2013 Apr 22 |
3 ** | 3 ** |
4 ** The author disclaims copyright to this source code. In place of | 4 ** The author disclaims copyright to this source code. In place of |
5 ** a legal notice, here is a blessing: | 5 ** a legal notice, here is a blessing: |
6 ** | 6 ** |
7 ** May you do good and not evil. | 7 ** May you do good and not evil. |
8 ** May you find forgiveness for yourself and forgive others. | 8 ** May you find forgiveness for yourself and forgive others. |
9 ** May you share freely, never taking more than you give. | 9 ** May you share freely, never taking more than you give. |
10 ** | 10 ** |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 Fts3Hash *pHash, | 78 Fts3Hash *pHash, |
79 const char *zName, | 79 const char *zName, |
80 const sqlite3_tokenizer_module **pp, | 80 const sqlite3_tokenizer_module **pp, |
81 char **pzErr | 81 char **pzErr |
82 ){ | 82 ){ |
83 sqlite3_tokenizer_module *p; | 83 sqlite3_tokenizer_module *p; |
84 int nName = (int)strlen(zName); | 84 int nName = (int)strlen(zName); |
85 | 85 |
86 p = (sqlite3_tokenizer_module *)sqlite3Fts3HashFind(pHash, zName, nName+1); | 86 p = (sqlite3_tokenizer_module *)sqlite3Fts3HashFind(pHash, zName, nName+1); |
87 if( !p ){ | 87 if( !p ){ |
88 *pzErr = sqlite3_mprintf("unknown tokenizer: %s", zName); | 88 sqlite3Fts3ErrMsg(pzErr, "unknown tokenizer: %s", zName); |
89 return SQLITE_ERROR; | 89 return SQLITE_ERROR; |
90 } | 90 } |
91 | 91 |
92 *pp = p; | 92 *pp = p; |
93 return SQLITE_OK; | 93 return SQLITE_OK; |
94 } | 94 } |
95 | 95 |
96 /* | 96 /* |
97 ** The second argument, argv[], is an array of pointers to nul-terminated | 97 ** The second argument, argv[], is an array of pointers to nul-terminated |
98 ** strings. This function makes a copy of the array and strings into a | 98 ** strings. This function makes a copy of the array and strings into a |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 ** argv[3]: first argument (tokenizer name) | 156 ** argv[3]: first argument (tokenizer name) |
157 */ | 157 */ |
158 static int fts3tokConnectMethod( | 158 static int fts3tokConnectMethod( |
159 sqlite3 *db, /* Database connection */ | 159 sqlite3 *db, /* Database connection */ |
160 void *pHash, /* Hash table of tokenizers */ | 160 void *pHash, /* Hash table of tokenizers */ |
161 int argc, /* Number of elements in argv array */ | 161 int argc, /* Number of elements in argv array */ |
162 const char * const *argv, /* xCreate/xConnect argument array */ | 162 const char * const *argv, /* xCreate/xConnect argument array */ |
163 sqlite3_vtab **ppVtab, /* OUT: New sqlite3_vtab object */ | 163 sqlite3_vtab **ppVtab, /* OUT: New sqlite3_vtab object */ |
164 char **pzErr /* OUT: sqlite3_malloc'd error message */ | 164 char **pzErr /* OUT: sqlite3_malloc'd error message */ |
165 ){ | 165 ){ |
166 Fts3tokTable *pTab; | 166 Fts3tokTable *pTab = 0; |
167 const sqlite3_tokenizer_module *pMod = 0; | 167 const sqlite3_tokenizer_module *pMod = 0; |
168 sqlite3_tokenizer *pTok = 0; | 168 sqlite3_tokenizer *pTok = 0; |
169 int rc; | 169 int rc; |
170 char **azDequote = 0; | 170 char **azDequote = 0; |
171 int nDequote; | 171 int nDequote; |
172 | 172 |
173 rc = sqlite3_declare_vtab(db, FTS3_TOK_SCHEMA); | 173 rc = sqlite3_declare_vtab(db, FTS3_TOK_SCHEMA); |
174 if( rc!=SQLITE_OK ) return rc; | 174 if( rc!=SQLITE_OK ) return rc; |
175 | 175 |
176 nDequote = argc-3; | 176 nDequote = argc-3; |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
445 0, /* xRelease */ | 445 0, /* xRelease */ |
446 0 /* xRollbackTo */ | 446 0 /* xRollbackTo */ |
447 }; | 447 }; |
448 int rc; /* Return code */ | 448 int rc; /* Return code */ |
449 | 449 |
450 rc = sqlite3_create_module(db, "fts3tokenize", &fts3tok_module, (void*)pHash); | 450 rc = sqlite3_create_module(db, "fts3tokenize", &fts3tok_module, (void*)pHash); |
451 return rc; | 451 return rc; |
452 } | 452 } |
453 | 453 |
454 #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) */ | 454 #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) */ |
OLD | NEW |