Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | In the nextchar.c extension, allow the second argument to the next_char() function to be a subquery. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
59b9fa223681a7329533b350be7bf5a0 |
User & Date: | drh 2013-09-28 13:28:40.044 |
Context
2013-09-28
| ||
16:43 | Add new test file fts3defer3.test. (check-in: a6cd14effe user: dan tags: trunk) | |
13:28 | In the nextchar.c extension, allow the second argument to the next_char() function to be a subquery. (check-in: 59b9fa2236 user: drh tags: trunk) | |
12:40 | Updates to the sqlite3_analyzer utility: Change the names of some labels, especially change "Fragmentation" to "Non-sequential pages". Revise the computation of non-sequential pages so that it ignores itercalated non-leaf pages (overflow and index pages). (check-in: 3e5c7771fa user: drh tags: trunk) | |
Changes
Changes to ext/misc/nextchar.c.
︙ | ︙ | |||
34 35 36 37 38 39 40 41 42 43 44 45 46 47 | ** Further suppose that for user keypad entry, it is desired to disable ** (gray out) keys that are not valid as the next character. If the ** the user has previously entered (say) 'cha' then to find all allowed ** next characters (and thereby determine when keys should not be grayed ** out) run the following query: ** ** SELECT next_char('cha','dictionary','word'); */ #include "sqlite3ext.h" SQLITE_EXTENSION_INIT1 #include <string.h> /* ** A structure to hold context of the next_char() computation across | > > > > > > > > > > > > > | 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | ** Further suppose that for user keypad entry, it is desired to disable ** (gray out) keys that are not valid as the next character. If the ** the user has previously entered (say) 'cha' then to find all allowed ** next characters (and thereby determine when keys should not be grayed ** out) run the following query: ** ** SELECT next_char('cha','dictionary','word'); ** ** IMPLEMENTATION NOTES: ** ** The next_char function is implemented using recursive SQL that makes ** use of the table name and column name as part of a query. If either ** the table name or column name are keywords or contain special characters, ** then they should be escaped. For example: ** ** SELECT next_char('cha','[dictionary]','[word]'); ** ** This also means that the table name can be a subquery: ** ** SELECT next_char('cha','(SELECCT word AS w FROM dictionary)','w'); */ #include "sqlite3ext.h" SQLITE_EXTENSION_INIT1 #include <string.h> /* ** A structure to hold context of the next_char() computation across |
︙ | ︙ | |||
227 228 229 230 231 232 233 | if( zWhereClause[0] ) sqlite3_free(zWhereClause); return; } }else{ zColl = ""; } zSql = sqlite3_mprintf( | | | | | 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 | if( zWhereClause[0] ) sqlite3_free(zWhereClause); return; } }else{ zColl = ""; } zSql = sqlite3_mprintf( "SELECT %s FROM %s" " WHERE %s>=(?1 || ?2) %s" " AND %s<=(?1 || char(1114111)) %s" /* 1114111 == 0x10ffff */ " %s" " ORDER BY 1 %s ASC LIMIT 1", zField, zTable, zField, zColl, zField, zColl, zWhereClause, zColl ); if( zWhereClause[0] ) sqlite3_free(zWhereClause); if( zColl[0] ) sqlite3_free(zColl); if( zSql==0 ){ |
︙ | ︙ |
Changes to test/spellfix.test.
︙ | ︙ | |||
91 92 93 94 95 96 97 98 99 100 101 102 103 104 | CREATE TABLE vocab(w TEXT PRIMARY KEY); INSERT INTO vocab SELECT word FROM t1; } } {} do_execsql_test 1.11 { SELECT next_char('re','vocab','w'); } {a} do_execsql_test 1.12 { SELECT next_char('r','vocab','w'); } {ae} do_execsql_test 1.13 { SELECT next_char('','vocab','w'); } {r} do_test 1.14 { | > > > | 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 | CREATE TABLE vocab(w TEXT PRIMARY KEY); INSERT INTO vocab SELECT word FROM t1; } } {} do_execsql_test 1.11 { SELECT next_char('re','vocab','w'); } {a} do_execsql_test 1.11sub { SELECT next_char('re','(SELECT w AS x FROM vocab)','x'); } {a} do_execsql_test 1.12 { SELECT next_char('r','vocab','w'); } {ae} do_execsql_test 1.13 { SELECT next_char('','vocab','w'); } {r} do_test 1.14 { |
︙ | ︙ |