Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Merge trunk changes into the mptest branch. The mptest needs the SQLITE_MAX_SCHEMA_RETRY fix in particular. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | mptest |
Files: | files | file ages | folders |
SHA1: |
fb7a7773965697855c12193408cb7530 |
User & Date: | drh 2013-04-06 18:10:27.166 |
Context
2013-04-06
| ||
18:35 | Fix the --source command so that its argument is relative to the script. Verify that the SQLite header and library match. Print SQLite version and compile-time configuration information on startup. (check-in: 15cb0db758 user: drh tags: mptest) | |
18:10 | Merge trunk changes into the mptest branch. The mptest needs the SQLITE_MAX_SCHEMA_RETRY fix in particular. (check-in: fb7a777396 user: drh tags: mptest) | |
18:06 | Increase the default SQLITE_MAX_SCHEMA_RETRY to 50. Make sure that macro covers every case where a prepared statement might need to be reprepared due to a schema change. The sqlite3_exec() interface now uses sqlite3_prepare_v2(). (check-in: c1d7304c80 user: drh tags: trunk) | |
14:30 | Add SQLITE_CONFIG_LOG error logging to the mptest program. (check-in: 716c25bd12 user: drh tags: mptest) | |
Changes
Changes to src/legacy.c.
︙ | ︙ | |||
34 35 36 37 38 39 40 | void *pArg, /* First argument to xCallback() */ char **pzErrMsg /* Write error messages here */ ){ int rc = SQLITE_OK; /* Return code */ const char *zLeftover; /* Tail of unprocessed SQL */ sqlite3_stmt *pStmt = 0; /* The current SQL statement */ char **azCols = 0; /* Names of result columns */ | < | | | 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 | void *pArg, /* First argument to xCallback() */ char **pzErrMsg /* Write error messages here */ ){ int rc = SQLITE_OK; /* Return code */ const char *zLeftover; /* Tail of unprocessed SQL */ sqlite3_stmt *pStmt = 0; /* The current SQL statement */ char **azCols = 0; /* Names of result columns */ int callbackIsInit; /* True if callback data is initialized */ if( !sqlite3SafetyCheckOk(db) ) return SQLITE_MISUSE_BKPT; if( zSql==0 ) zSql = ""; sqlite3_mutex_enter(db->mutex); sqlite3Error(db, SQLITE_OK, 0); while( rc==SQLITE_OK && zSql[0] ){ int nCol; char **azVals = 0; pStmt = 0; rc = sqlite3_prepare_v2(db, zSql, -1, &pStmt, &zLeftover); assert( rc==SQLITE_OK || pStmt==0 ); if( rc!=SQLITE_OK ){ continue; } if( !pStmt ){ /* this happens for a comment or white-space */ zSql = zLeftover; |
︙ | ︙ | |||
104 105 106 107 108 109 110 | goto exec_out; } } if( rc!=SQLITE_ROW ){ rc = sqlite3VdbeFinalize((Vdbe *)pStmt); pStmt = 0; | < < | | < | 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | goto exec_out; } } if( rc!=SQLITE_ROW ){ rc = sqlite3VdbeFinalize((Vdbe *)pStmt); pStmt = 0; zSql = zLeftover; while( sqlite3Isspace(zSql[0]) ) zSql++; break; } } sqlite3DbFree(db, azCols); azCols = 0; } |
︙ | ︙ |
Changes to src/prepare.c.
︙ | ︙ | |||
650 651 652 653 654 655 656 | for(i=iFirst; i<mx; i++){ sqlite3VdbeSetColName(pParse->pVdbe, i-iFirst, COLNAME_NAME, azColName[i], SQLITE_STATIC); } } #endif | < | 650 651 652 653 654 655 656 657 658 659 660 661 662 663 | for(i=iFirst; i<mx; i++){ sqlite3VdbeSetColName(pParse->pVdbe, i-iFirst, COLNAME_NAME, azColName[i], SQLITE_STATIC); } } #endif if( db->init.busy==0 ){ Vdbe *pVdbe = pParse->pVdbe; sqlite3VdbeSetSql(pVdbe, zSql, (int)(pParse->zTail-zSql), saveSqlFlag); } if( pParse->pVdbe && (rc!=SQLITE_OK || db->mallocFailed) ){ sqlite3VdbeFinalize(pParse->pVdbe); assert(!(*ppStmt)); |
︙ | ︙ |
Changes to src/vdbeInt.h.
︙ | ︙ | |||
14 15 16 17 18 19 20 21 22 23 24 25 26 27 | ** source code file "vdbe.c". When that file became too big (over ** 6000 lines long) it was split up into several smaller files and ** this header information was factored out. */ #ifndef _VDBEINT_H_ #define _VDBEINT_H_ /* ** SQL is translated into a sequence of instructions to be ** executed by a virtual machine. Each instruction is an instance ** of the following structure. */ typedef struct VdbeOp Op; | > > > > > > > > | 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | ** source code file "vdbe.c". When that file became too big (over ** 6000 lines long) it was split up into several smaller files and ** this header information was factored out. */ #ifndef _VDBEINT_H_ #define _VDBEINT_H_ /* ** The maximum number of times that a statement will try to reparse ** itself before giving up and returning SQLITE_SCHEMA. */ #ifndef SQLITE_MAX_SCHEMA_RETRY # define SQLITE_MAX_SCHEMA_RETRY 50 #endif /* ** SQL is translated into a sequence of instructions to be ** executed by a virtual machine. Each instruction is an instance ** of the following structure. */ typedef struct VdbeOp Op; |
︙ | ︙ |
Changes to src/vdbeapi.c.
︙ | ︙ | |||
449 450 451 452 453 454 455 | ** caller. Set the error code in the database handle to the same value. */ rc = sqlite3VdbeTransferError(p); } return (rc&db->errMask); } | < < < < < < < < | 449 450 451 452 453 454 455 456 457 458 459 460 461 462 | ** caller. Set the error code in the database handle to the same value. */ rc = sqlite3VdbeTransferError(p); } return (rc&db->errMask); } /* ** This is the top-level implementation of sqlite3_step(). Call ** sqlite3Step() to do most of the work. If a schema error occurs, ** call sqlite3Reprepare() and try again. */ int sqlite3_step(sqlite3_stmt *pStmt){ int rc = SQLITE_OK; /* Result from sqlite3Step() */ |
︙ | ︙ |
Changes to src/vdbeblob.c.
︙ | ︙ | |||
309 310 311 312 313 314 315 | pBlob->db = db; sqlite3BtreeLeaveAll(db); if( db->mallocFailed ){ goto blob_open_out; } sqlite3_bind_int64(pBlob->pStmt, 1, iRow); rc = blobSeekToRow(pBlob, iRow, &zErr); | | | 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 | pBlob->db = db; sqlite3BtreeLeaveAll(db); if( db->mallocFailed ){ goto blob_open_out; } sqlite3_bind_int64(pBlob->pStmt, 1, iRow); rc = blobSeekToRow(pBlob, iRow, &zErr); } while( (++nAttempt)<SQLITE_MAX_SCHEMA_RETRY && rc==SQLITE_SCHEMA ); blob_open_out: if( rc==SQLITE_OK && db->mallocFailed==0 ){ *ppBlob = (sqlite3_blob *)pBlob; }else{ if( pBlob && pBlob->pStmt ) sqlite3VdbeFinalize((Vdbe *)pBlob->pStmt); sqlite3DbFree(db, pBlob); |
︙ | ︙ |
Changes to test/pager1.test.
︙ | ︙ | |||
2241 2242 2243 2244 2245 2246 2247 | SAVEPOINT abc; CREATE TABLE t1(a, b); ROLLBACK TO abc; COMMIT; } db close } {} | < | 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 | SAVEPOINT abc; CREATE TABLE t1(a, b); ROLLBACK TO abc; COMMIT; } db close } {} do_test pager1-25-2 { faultsim_delete_and_reopen execsql { SAVEPOINT abc; CREATE TABLE t1(a, b); ROLLBACK TO abc; COMMIT; |
︙ | ︙ | |||
2539 2540 2541 2542 2543 2544 2545 | reset_db db func a_string a_string db eval $pragma do_execsql_test 34.$tn.1 { CREATE TABLE t1(a, b); INSERT INTO t1 VALUES(1, 2); } | < | 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 | reset_db db func a_string a_string db eval $pragma do_execsql_test 34.$tn.1 { CREATE TABLE t1(a, b); INSERT INTO t1 VALUES(1, 2); } do_execsql_test 34.$tn.2 { BEGIN; INSERT INTO t1 VALUES(2, a_string($strsize)); DELETE FROM t1 WHERE oid=2; COMMIT; PRAGMA integrity_check; } {ok} |
︙ | ︙ | |||
2601 2602 2603 2604 2605 2606 2607 | 2 {file:one?mode=memory&cache=shared} 3 {file:test1?cache=shared} 4 {file:test2?another=parameter&yet=anotherone} } { do_test 37.$tn { catch { db close } sqlite3_shutdown | | | > > > > > > > | 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 | 2 {file:one?mode=memory&cache=shared} 3 {file:test1?cache=shared} 4 {file:test2?another=parameter&yet=anotherone} } { do_test 37.$tn { catch { db close } sqlite3_shutdown sqlite3_config_uri 1 sqlite3 db $uri db eval { CREATE TABLE t1(x); INSERT INTO t1 VALUES(1); SELECT * FROM t1; } } {1} do_execsql_test 37.$tn.2 { VACUUM; SELECT * FROM t1; } {1} db close sqlite3_shutdown sqlite3_config_uri 0 } do_test 38.1 { catch { db close } |
︙ | ︙ | |||
2726 2727 2728 2729 2730 2731 2732 2733 | sqlite3 db test.db execsql { PRAGMA cache_size = 1; DELETE FROM t1 WHERE rowid%4; PRAGMA integrity_check; } } {ok} | > > > > > > > > > > > > > > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 | sqlite3 db test.db execsql { PRAGMA cache_size = 1; DELETE FROM t1 WHERE rowid%4; PRAGMA integrity_check; } } {ok} db close tv delete set pending_prev [sqlite3_test_control_pending_byte 0x1000000] do_test 42.1 { reset_db execsql { CREATE TABLE t1(x, y); INSERT INTO t1 VALUES(randomblob(200), randomblob(200)); INSERT INTO t1 SELECT randomblob(200), randomblob(200) FROM t1; INSERT INTO t1 SELECT randomblob(200), randomblob(200) FROM t1; INSERT INTO t1 SELECT randomblob(200), randomblob(200) FROM t1; INSERT INTO t1 SELECT randomblob(200), randomblob(200) FROM t1; INSERT INTO t1 SELECT randomblob(200), randomblob(200) FROM t1; INSERT INTO t1 SELECT randomblob(200), randomblob(200) FROM t1; INSERT INTO t1 SELECT randomblob(200), randomblob(200) FROM t1; INSERT INTO t1 SELECT randomblob(200), randomblob(200) FROM t1; INSERT INTO t1 SELECT randomblob(200), randomblob(200) FROM t1; } db close sqlite3_test_control_pending_byte 0x0010000 sqlite3 db test.db db eval { PRAGMA mmap_limit = 0 } catchsql { SELECT sum(length(y)) FROM t1 } } {1 {database disk image is malformed}} do_test 42.2 { reset_db execsql { CREATE TABLE t1(x, y); INSERT INTO t1 VALUES(randomblob(200), randomblob(200)); INSERT INTO t1 SELECT randomblob(200), randomblob(200) FROM t1; INSERT INTO t1 SELECT randomblob(200), randomblob(200) FROM t1; INSERT INTO t1 SELECT randomblob(200), randomblob(200) FROM t1; INSERT INTO t1 SELECT randomblob(200), randomblob(200) FROM t1; INSERT INTO t1 SELECT randomblob(200), randomblob(200) FROM t1; INSERT INTO t1 SELECT randomblob(200), randomblob(200) FROM t1; INSERT INTO t1 SELECT randomblob(200), randomblob(200) FROM t1; INSERT INTO t1 SELECT randomblob(200), randomblob(200) FROM t1; } db close testvfs tv -default 1 tv sectorsize 16384; tv devchar [list] sqlite3 db test.db -vfs tv execsql { UPDATE t1 SET x = randomblob(200) } } {} db close tv delete sqlite3_test_control_pending_byte $pending_prev do_test 43.1 { reset_db execsql { CREATE TABLE t1(x, y); INSERT INTO t1 VALUES(1, 2); CREATE TABLE t2(x, y); INSERT INTO t2 VALUES(1, 2); CREATE TABLE t3(x, y); INSERT INTO t3 VALUES(1, 2); } db close sqlite3 db test.db db eval { PRAGMA mmap_limit = 0 } db eval { SELECT * FROM t1 } sqlite3_db_status db CACHE_MISS 0 } {0 2 0} do_test 43.2 { db eval { SELECT * FROM t2 } sqlite3_db_status db CACHE_MISS 1 } {0 3 0} do_test 43.3 { db eval { SELECT * FROM t3 } sqlite3_db_status db CACHE_MISS 0 } {0 1 0} finish_test |
Changes to test/pager2.test.
︙ | ︙ | |||
114 115 116 117 118 119 120 | } } db close tv delete #------------------------------------------------------------------------- | < | 114 115 116 117 118 119 120 121 122 123 124 125 126 127 | } } db close tv delete #------------------------------------------------------------------------- # pager2-2.1: Test a ROLLBACK with journal_mode=off. # pager2-2.2: Test shrinking the database (auto-vacuum) with # journal_mode=off # do_test pager2-2.1 { faultsim_delete_and_reopen execsql { |
︙ | ︙ | |||
143 144 145 146 147 148 149 150 151 | CREATE TABLE t1(a, b); INSERT INTO t1 VALUES(zeroblob(5000), zeroblob(5000)); DELETE FROM t1; PRAGMA incremental_vacuum; } file size test.db } {3072} finish_test | > > > > > > > > > > > > > > > > > > | 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 | CREATE TABLE t1(a, b); INSERT INTO t1 VALUES(zeroblob(5000), zeroblob(5000)); DELETE FROM t1; PRAGMA incremental_vacuum; } file size test.db } {3072} #------------------------------------------------------------------------- # Test that shared in-memory databases seem to work. # db close do_test pager2-3.1 { forcedelete test.db sqlite3_shutdown sqlite3_config_uri 1 sqlite3 db1 {file:test.db?mode=memory&cache=shared} sqlite3 db2 {file:test.db?mode=memory&cache=shared} sqlite3 db3 test.db db1 eval { CREATE TABLE t1(a, b) } db2 eval { INSERT INTO t1 VALUES(1, 2) } list [catch { db3 eval { INSERT INTO t1 VALUES(3, 4) } } msg] $msg } {1 {no such table: t1}} finish_test |
Changes to test/pagerfault.test.
︙ | ︙ | |||
1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 | } } -body { execsql COMMIT } -test { faultsim_test_result {0 {}} } finish_test | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 | } } -body { execsql COMMIT } -test { faultsim_test_result {0 {}} } do_test pagerfault-35-pre { faultsim_delete_and_reopen execsql { CREATE TABLE t1(x PRIMARY KEY, y); INSERT INTO t1 VALUES(randomblob(200), randomblob(200)); INSERT INTO t1 SELECT randomblob(200), randomblob(200) FROM t1; INSERT INTO t1 SELECT randomblob(200), randomblob(200) FROM t1; INSERT INTO t1 SELECT randomblob(200), randomblob(200) FROM t1; } faultsim_save_and_close } {} testvfs tv -default 1 tv sectorsize 8192; tv devchar [list] do_faultsim_test pagerfault-35 -prep { faultsim_restore_and_reopen } -body { execsql { UPDATE t1 SET x=randomblob(200) } } -test { faultsim_test_result {0 {}} } catch {db close} tv delete sqlite3_shutdown sqlite3_config_uri 1 do_test pagerfault-36-pre { faultsim_delete_and_reopen execsql { CREATE TABLE t1(x PRIMARY KEY, y); INSERT INTO t1 VALUES(randomblob(200), randomblob(200)); INSERT INTO t1 SELECT randomblob(200), randomblob(200) FROM t1; INSERT INTO t1 SELECT randomblob(200), randomblob(200) FROM t1; INSERT INTO t1 SELECT randomblob(200), randomblob(200) FROM t1; } faultsim_save_and_close } {} do_faultsim_test pagerfault-36 -prep { faultsim_restore sqlite3 db file:test.db?cache=shared sqlite3 db2 file:test.db?cache=shared db2 eval { BEGIN; SELECT count(*) FROM sqlite_master; } db eval { PRAGMA cache_size = 1; BEGIN; UPDATE t1 SET x = randomblob(200); } } -body { execsql ROLLBACK db } -test { catch { db eval {UPDATE t1 SET x = randomblob(200)} } faultsim_test_result {0 {}} catch { db close } catch { db2 close } } sqlite3_shutdown sqlite3_config_uri 0 finish_test |