Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Do not allow virtual table constructors to be called recursively. Cherrypick [0a72726da21581ab] |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | branch-3.7.11 |
Files: | files | file ages | folders |
SHA1: |
0f0694e4245083f6abb4ce104c39add4 |
User & Date: | drh 2015-05-21 01:04:17.693 |
Context
2015-05-21
| ||
02:07 | When parsing the schema, ignore any SQL that does not begin with "CREATE". Cherrypick of [d3c00d61581c] with additional changes. (check-in: 09784f376b user: drh tags: branch-3.7.11) | |
01:04 | Do not allow virtual table constructors to be called recursively. Cherrypick [0a72726da21581ab] (check-in: 0f0694e424 user: drh tags: branch-3.7.11) | |
00:50 | Add the ".open" command to the command-line shell. Cherrypick from [21eccb919441]. (check-in: a71e2a72c5 user: drh tags: branch-3.7.11) | |
2015-04-10
| ||
07:55 | Do not allow virtual table constructors to be called recursively. (check-in: 0a72726da2 user: dan tags: trunk) | |
Changes
Changes to ext/fts3/fts3.c.
︙ | |||
967 968 969 970 971 972 973 | 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 | - + + + + + | */ static int fts3ContentColumns( sqlite3 *db, /* Database handle */ const char *zDb, /* Name of db (i.e. "main", "temp" etc.) */ const char *zTbl, /* Name of content table */ const char ***pazCol, /* OUT: Malloc'd array of column names */ int *pnCol, /* OUT: Size of array *pazCol */ |
︙ | |||
1211 1212 1213 1214 1215 1216 1217 | 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 | - + | sqlite3_free(zCompress); sqlite3_free(zUncompress); zCompress = 0; zUncompress = 0; if( nCol==0 ){ sqlite3_free((void*)aCol); aCol = 0; |
︙ |
Changes to src/vtab.c.
︙ | |||
20 21 22 23 24 25 26 27 28 29 30 31 32 33 | 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | + + | ** this struct allocated on the stack. It is used by the implementation of ** the sqlite3_declare_vtab() and sqlite3_vtab_config() APIs, both of which ** are invoked only from within xCreate and xConnect methods. */ struct VtabCtx { Table *pTab; VTable *pVTable; VtabCtx *pPrior; /* Parent context (if any) */ int bDeclared; /* True after sqlite3_declare_vtab() is called */ }; /* ** The actual function that does the work of creating a new module. ** This function implements the sqlite3_create_module() and ** sqlite3_create_module_v2() interfaces. */ |
︙ | |||
449 450 451 452 453 454 455 | 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 | - + + + + + + + + + + + + + + + - + + - + | ){ VtabCtx sCtx; VTable *pVTable; int rc; const char *const*azArg = (const char *const*)pTab->azModuleArg; int nArg = pTab->nModuleArg; char *zErr = 0; |
︙ | |||
656 657 658 659 660 661 662 663 | 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 | + - - + + | /* ** This function is used to set the schema of a virtual table. It is only ** valid to call this function from within the xCreate() or xConnect() of a ** virtual table module. */ int sqlite3_declare_vtab(sqlite3 *db, const char *zCreateTable){ VtabCtx *pCtx = db->pVtabCtx; Parse *pParse; |
︙ | |||
690 691 692 693 694 695 696 | 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 | - + | ){ if( !pTab->aCol ){ pTab->aCol = pParse->pNewTable->aCol; pTab->nCol = pParse->pNewTable->nCol; pParse->pNewTable->nCol = 0; pParse->pNewTable->aCol = 0; } |
︙ |
Changes to test/fts4content.test.
︙ | |||
42 43 44 45 46 47 48 49 50 51 52 53 54 55 | 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | + + + | # 7.* - Test that if content=xxx is specified and table xxx does not # exist, the FTS table can still be used for INSERT and some # SELECT statements. # # 8.* - Test that if the content=xxx and prefix options are used together, # the 'rebuild' command still works. # # 11.* - Test that circular references (e.g. "t1(content=t1)") are # detected. # do_execsql_test 1.1.1 { CREATE TABLE t1(a, b, c); INSERT INTO t1 VALUES('w x', 'x y', 'y z'); CREATE VIRTUAL TABLE ft1 USING fts4(content=t1); } |
︙ | |||
400 401 402 403 404 405 406 | 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 | - + | } #------------------------------------------------------------------------- # Test cases 6.* test # do_catchsql_test 6.1.1 { CREATE VIRTUAL TABLE ft7 USING fts4(content=t7); |
︙ | |||
427 428 429 430 431 432 433 | 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 | - + | SELECT name FROM sqlite_master WHERE name LIKE '%t7%' } { ft7 ft7_segments ft7_segdir sqlite_autoindex_ft7_segdir_1 ft7_docsize ft7_stat } do_catchsql_test 6.2.4 { SELECT * FROM ft7; |
︙ | |||
517 518 519 520 521 522 523 524 525 | 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | } do_execsql_test 8.2 { SELECT * FROM ft10 WHERE a MATCH 'ab*'; } do_execsql_test 8.3 { INSERT INTO ft10(ft10) VALUES('rebuild'); } do_execsql_test 8.4 { SELECT rowid FROM ft10 WHERE a MATCH 'ab*'; } {1 2 3} do_execsql_test 8.5 { SELECT rowid FROM ft10 WHERE b MATCH 'abav*'; } {3} do_execsql_test 8.6 { SELECT rowid FROM ft10 WHERE ft10 MATCH 'abas*'; } {1} #------------------------------------------------------------------------- # Test cases 9.* # reset_db register_echo_module [sqlite3_connection_pointer db] do_execsql_test 9.1 { CREATE TABLE tbl1(a, b); INSERT INTO tbl1 VALUES('a b', 'c d'); INSERT INTO tbl1 VALUES('e f', 'a b'); CREATE VIRTUAL TABLE e1 USING echo(tbl1); CREATE VIRTUAL TABLE ft1 USING fts4(content=e1); INSERT INTO ft1(ft1) VALUES('rebuild'); } do_execsql_test 9.2 { SELECT rowid, * FROM ft1 WHERE ft1 MATCH 'e' } {2 {e f} {a b}} do_execsql_test 9.3 { SELECT rowid, * FROM ft1 WHERE ft1 MATCH 'a' } {1 {a b} {c d} 2 {e f} {a b}} do_execsql_test 9.4 { DELETE FROM ft1 WHERE docid=1; } do_execsql_test 9.5 { SELECT rowid, * FROM ft1 WHERE ft1 MATCH 'a' } {2 {e f} {a b}} do_execsql_test 9.6 { INSERT INTO ft1(ft1) VALUES('rebuild'); SELECT rowid, * FROM ft1 WHERE ft1 MATCH 'a' } {1 {a b} {c d} 2 {e f} {a b}} #------------------------------------------------------------------------- # Test cases 11.* # reset_db do_catchsql_test 11.1 { CREATE VIRTUAL TABLE x1 USING fts4(content=x1); } {1 {vtable constructor called recursively: x1}} finish_test |