Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Ensure fts4aux can handle a table name in single or double quotes as a constructor argument. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
929d62e496bb36a3ee0e19ec4609329d |
User & Date: | dan 2011-02-05 15:47:12.471 |
Context
2011-02-07
| ||
15:12 | Change blocking-checkpoint tests so that they run once using "PRAGMA wal_checkpoint" and once using calls to sqlite3_wal_checkpoint_v2(). Also fix edge cases surrounding the output variables set by wal_checkpoint_v2(). (check-in: 5a4b6652cf user: dan tags: trunk) | |
2011-02-05
| ||
15:47 | Ensure fts4aux can handle a table name in single or double quotes as a constructor argument. (check-in: 929d62e496 user: dan tags: trunk) | |
14:37 | Add test cases for fts4aux. Fix a bug affecting fts3 tables with multiple columns. (check-in: dc511e60a6 user: dan tags: trunk) | |
Changes
Changes to ext/fts3/fts3_aux.c.
︙ | ︙ | |||
93 94 95 96 97 98 99 100 101 102 103 104 105 106 | p->pFts3Tab = (Fts3Table *)&p[1]; p->pFts3Tab->zDb = (char *)&p->pFts3Tab[1]; p->pFts3Tab->zName = &p->pFts3Tab->zDb[nDb+1]; p->pFts3Tab->db = db; memcpy((char *)p->pFts3Tab->zDb, zDb, nDb); memcpy((char *)p->pFts3Tab->zName, zFts3, nFts3); *ppVtab = (sqlite3_vtab *)p; return SQLITE_OK; } /* ** This function does the work for both the xDisconnect and xDestroy methods. | > | 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 | p->pFts3Tab = (Fts3Table *)&p[1]; p->pFts3Tab->zDb = (char *)&p->pFts3Tab[1]; p->pFts3Tab->zName = &p->pFts3Tab->zDb[nDb+1]; p->pFts3Tab->db = db; memcpy((char *)p->pFts3Tab->zDb, zDb, nDb); memcpy((char *)p->pFts3Tab->zName, zFts3, nFts3); sqlite3Fts3Dequote((char *)p->pFts3Tab->zName); *ppVtab = (sqlite3_vtab *)p; return SQLITE_OK; } /* ** This function does the work for both the xDisconnect and xDestroy methods. |
︙ | ︙ |
Changes to test/fts3aux1.test.
︙ | ︙ | |||
377 378 379 380 381 382 383 384 385 386 387 388 389 390 | } {1 {table terms may not be modified}} do_catchsql_test 3.3.3 { UPDATE terms set documents = documents+1; } {1 {table terms may not be modified}} #------------------------------------------------------------------------- # db close forcedelete test.db sqlite3 db test.db do_execsql_test 4.1 { CREATE VIRTUAL TABLE x1 USING fts4(x); CREATE VIRTUAL TABLE terms USING fts4aux(x1); | > > > | 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 | } {1 {table terms may not be modified}} do_catchsql_test 3.3.3 { UPDATE terms set documents = documents+1; } {1 {table terms may not be modified}} #------------------------------------------------------------------------- # The following tests - fts4aux-4.* - test that joins work with fts4aux # tables. And that fts4aux provides reasonably sane cost information via # xBestIndex to the query planner. # db close forcedelete test.db sqlite3 db test.db do_execsql_test 4.1 { CREATE VIRTUAL TABLE x1 USING fts4(x); CREATE VIRTUAL TABLE terms USING fts4aux(x1); |
︙ | ︙ | |||
399 400 401 402 403 404 405 | INSERT INTO x2 SELECT term FROM terms WHERE col = '*'; INSERT INTO x3 SELECT term FROM terms WHERE col = '*'; } proc do_plansql_test {tn sql r} { uplevel do_execsql_test $tn [list "EXPLAIN QUERY PLAN $sql ; $sql"] [list $r] } | < | 402 403 404 405 406 407 408 409 410 411 412 413 414 415 | INSERT INTO x2 SELECT term FROM terms WHERE col = '*'; INSERT INTO x3 SELECT term FROM terms WHERE col = '*'; } proc do_plansql_test {tn sql r} { uplevel do_execsql_test $tn [list "EXPLAIN QUERY PLAN $sql ; $sql"] [list $r] } do_plansql_test 4.2 { SELECT y FROM x2, terms WHERE y = term AND col = '*' } { 0 0 0 {SCAN TABLE x2 (~1000000 rows)} 0 1 1 {SCAN TABLE terms VIRTUAL TABLE INDEX 1: (~0 rows)} a b c d e f g h i j k l |
︙ | ︙ | |||
432 433 434 435 436 437 438 439 440 441 | do_plansql_test 4.5 { SELECT y FROM terms, x3 WHERE y = term AND occurrences>1 AND col = '*' } { 0 0 0 {SCAN TABLE terms VIRTUAL TABLE INDEX 0: (~0 rows)} 0 1 1 {SEARCH TABLE x3 USING COVERING INDEX i1 (y=?) (~10 rows)} a k l } finish_test | > > > > > > > > > > > > > > > > > > > | 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 | do_plansql_test 4.5 { SELECT y FROM terms, x3 WHERE y = term AND occurrences>1 AND col = '*' } { 0 0 0 {SCAN TABLE terms VIRTUAL TABLE INDEX 0: (~0 rows)} 0 1 1 {SEARCH TABLE x3 USING COVERING INDEX i1 (y=?) (~10 rows)} a k l } #------------------------------------------------------------------------- # The following tests check that fts4aux can handle an fts table with an # odd name (one that requires quoting for use in SQL statements). And that # the argument to the fts4aux constructor is properly dequoted before use. # # do_execsql_test 5.1 { CREATE VIRTUAL TABLE "abc '!' def" USING fts4(x, y); INSERT INTO "abc '!' def" VALUES('XX', 'YY'); CREATE VIRTUAL TABLE terms3 USING fts4aux("abc '!' def"); SELECT * FROM terms3; } {xx * 1 1 xx 0 1 1 yy * 1 1 yy 1 1 1} do_execsql_test 5.2 { CREATE VIRTUAL TABLE "%%^^%%" USING fts4aux('abc ''!'' def'); SELECT * FROM "%%^^%%"; } {xx * 1 1 xx 0 1 1 yy * 1 1 yy 1 1 1} finish_test |