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 17 matching lines...) Expand all Loading... |
28 | 28 |
29 #include "sqlite3.h" | 29 #include "sqlite3.h" |
30 #include "sqlite3ext.h" | 30 #include "sqlite3ext.h" |
31 #ifndef SQLITE_CORE | 31 #ifndef SQLITE_CORE |
32 SQLITE_EXTENSION_INIT1 | 32 SQLITE_EXTENSION_INIT1 |
33 #endif | 33 #endif |
34 | 34 |
35 #include "fts2_hash.h" | 35 #include "fts2_hash.h" |
36 #include "fts2_tokenizer.h" | 36 #include "fts2_tokenizer.h" |
37 #include <assert.h> | 37 #include <assert.h> |
38 #include <stddef.h> | |
39 | 38 |
40 /* | 39 /* |
41 ** Implementation of the SQL scalar function for accessing the underlying | 40 ** Implementation of the SQL scalar function for accessing the underlying |
42 ** hash table. This function may be called as follows: | 41 ** hash table. This function may be called as follows: |
43 ** | 42 ** |
44 ** SELECT <function-name>(<key-name>); | 43 ** SELECT <function-name>(<key-name>); |
45 ** SELECT <function-name>(<key-name>, <pointer>); | 44 ** SELECT <function-name>(<key-name>, <pointer>); |
46 ** | 45 ** |
47 ** where <function-name> is the name passed as the second argument | 46 ** where <function-name> is the name passed as the second argument |
48 ** to the sqlite3Fts2InitHashTable() function (e.g. 'fts2_tokenizer'). | 47 ** to the sqlite3Fts2InitHashTable() function (e.g. 'fts2_tokenizer'). |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 assert( p2==p1 ); | 314 assert( p2==p1 ); |
316 | 315 |
317 sqlite3_result_text(context, "ok", -1, SQLITE_STATIC); | 316 sqlite3_result_text(context, "ok", -1, SQLITE_STATIC); |
318 } | 317 } |
319 | 318 |
320 #endif | 319 #endif |
321 | 320 |
322 /* | 321 /* |
323 ** Set up SQL objects in database db used to access the contents of | 322 ** Set up SQL objects in database db used to access the contents of |
324 ** the hash table pointed to by argument pHash. The hash table must | 323 ** the hash table pointed to by argument pHash. The hash table must |
325 ** been initialised to use string keys, and to take a private copy | 324 ** been initialized to use string keys, and to take a private copy |
326 ** of the key when a value is inserted. i.e. by a call similar to: | 325 ** of the key when a value is inserted. i.e. by a call similar to: |
327 ** | 326 ** |
328 ** sqlite3Fts2HashInit(pHash, FTS2_HASH_STRING, 1); | 327 ** sqlite3Fts2HashInit(pHash, FTS2_HASH_STRING, 1); |
329 ** | 328 ** |
330 ** This function adds a scalar function (see header comment above | 329 ** This function adds a scalar function (see header comment above |
331 ** scalarFunc() in this file for details) and, if ENABLE_TABLE is | 330 ** scalarFunc() in this file for details) and, if ENABLE_TABLE is |
332 ** defined at compilation time, a temporary virtual table (see header | 331 ** defined at compilation time, a temporary virtual table (see header |
333 ** comment above struct HashTableVtab) to the database schema. Both | 332 ** comment above struct HashTableVtab) to the database schema. Both |
334 ** provide read/write access to the contents of *pHash. | 333 ** provide read/write access to the contents of *pHash. |
335 ** | 334 ** |
(...skipping 29 matching lines...) Expand all Loading... |
365 || (rc = sqlite3_create_function(db, zTest2, 0, any, pdb, intTestFunc, 0, 0)) | 364 || (rc = sqlite3_create_function(db, zTest2, 0, any, pdb, intTestFunc, 0, 0)) |
366 #endif | 365 #endif |
367 ); | 366 ); |
368 | 367 |
369 sqlite3_free(zTest); | 368 sqlite3_free(zTest); |
370 sqlite3_free(zTest2); | 369 sqlite3_free(zTest2); |
371 return rc; | 370 return rc; |
372 } | 371 } |
373 | 372 |
374 #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS2) */ | 373 #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS2) */ |
OLD | NEW |