OLD | NEW |
1 /* | 1 /* |
2 ** 2007 June 22 | 2 ** 2007 June 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 10 matching lines...) Expand all Loading... |
21 ** (in which case SQLITE_CORE is not defined), or | 21 ** (in which case SQLITE_CORE is not defined), or |
22 ** | 22 ** |
23 ** * The FTS2 module is being built into the core of | 23 ** * The FTS2 module is being built into the core of |
24 ** SQLite (in which case SQLITE_ENABLE_FTS2 is defined). | 24 ** SQLite (in which case SQLITE_ENABLE_FTS2 is defined). |
25 */ | 25 */ |
26 #if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS2) | 26 #if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS2) |
27 | 27 |
28 | 28 |
29 #include "sqlite3.h" | 29 #include "sqlite3.h" |
30 #include "sqlite3ext.h" | 30 #include "sqlite3ext.h" |
31 SQLITE_EXTENSION_INIT1 | 31 SQLITE_EXTENSION_INIT3 |
32 | 32 |
33 #include "fts2_hash.h" | 33 #include "fts2_hash.h" |
34 #include "fts2_tokenizer.h" | 34 #include "fts2_tokenizer.h" |
35 #include <assert.h> | 35 #include <assert.h> |
36 | 36 |
37 /* | 37 /* |
38 ** Implementation of the SQL scalar function for accessing the underlying | 38 ** Implementation of the SQL scalar function for accessing the underlying |
39 ** hash table. This function may be called as follows: | 39 ** hash table. This function may be called as follows: |
40 ** | 40 ** |
41 ** SELECT <function-name>(<key-name>); | 41 ** SELECT <function-name>(<key-name>); |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 assert( p2==p1 ); | 312 assert( p2==p1 ); |
313 | 313 |
314 sqlite3_result_text(context, "ok", -1, SQLITE_STATIC); | 314 sqlite3_result_text(context, "ok", -1, SQLITE_STATIC); |
315 } | 315 } |
316 | 316 |
317 #endif | 317 #endif |
318 | 318 |
319 /* | 319 /* |
320 ** Set up SQL objects in database db used to access the contents of | 320 ** Set up SQL objects in database db used to access the contents of |
321 ** the hash table pointed to by argument pHash. The hash table must | 321 ** the hash table pointed to by argument pHash. The hash table must |
322 ** been initialised to use string keys, and to take a private copy | 322 ** been initialized to use string keys, and to take a private copy |
323 ** of the key when a value is inserted. i.e. by a call similar to: | 323 ** of the key when a value is inserted. i.e. by a call similar to: |
324 ** | 324 ** |
325 ** sqlite3Fts2HashInit(pHash, FTS2_HASH_STRING, 1); | 325 ** sqlite3Fts2HashInit(pHash, FTS2_HASH_STRING, 1); |
326 ** | 326 ** |
327 ** This function adds a scalar function (see header comment above | 327 ** This function adds a scalar function (see header comment above |
328 ** scalarFunc() in this file for details) and, if ENABLE_TABLE is | 328 ** scalarFunc() in this file for details) and, if ENABLE_TABLE is |
329 ** defined at compilation time, a temporary virtual table (see header | 329 ** defined at compilation time, a temporary virtual table (see header |
330 ** comment above struct HashTableVtab) to the database schema. Both | 330 ** comment above struct HashTableVtab) to the database schema. Both |
331 ** provide read/write access to the contents of *pHash. | 331 ** provide read/write access to the contents of *pHash. |
332 ** | 332 ** |
(...skipping 29 matching lines...) Expand all Loading... |
362 || (rc = sqlite3_create_function(db, zTest2, 0, any, pdb, intTestFunc, 0, 0)) | 362 || (rc = sqlite3_create_function(db, zTest2, 0, any, pdb, intTestFunc, 0, 0)) |
363 #endif | 363 #endif |
364 ); | 364 ); |
365 | 365 |
366 sqlite3_free(zTest); | 366 sqlite3_free(zTest); |
367 sqlite3_free(zTest2); | 367 sqlite3_free(zTest2); |
368 return rc; | 368 return rc; |
369 } | 369 } |
370 | 370 |
371 #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS2) */ | 371 #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS2) */ |
OLD | NEW |