Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Further test cases and fixes for SQLITE_OPEN_SHARED_SCHEMA. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | reuse-schema |
Files: | files | file ages | folders |
SHA3-256: |
ba0ab042f401a9d3b81dc546573214bb |
User & Date: | dan 2019-02-20 18:44:28.122 |
Context
2019-02-22
| ||
17:44 | Merge latest trunk changes into this branch. (check-in: 001771afd0 user: dan tags: reuse-schema) | |
2019-02-20
| ||
18:44 | Further test cases and fixes for SQLITE_OPEN_SHARED_SCHEMA. (check-in: ba0ab042f4 user: dan tags: reuse-schema) | |
17:36 | Add test and fixes for SQLITE_OPEN_SHARED_SCHEMA mode. (check-in: 9a78d89c84 user: dan tags: reuse-schema) | |
Changes
Changes to src/build.c.
︙ | |||
300 301 302 303 304 305 306 | 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 | - + | && DbHasProperty(db, iDb, DB_SchemaLoaded)==0 && (db->init.busy==0 || (iDb!=1 && db->init.iDb==1)) ){ struct sqlite3InitInfo sv = db->init; memset(&db->init, 0, sizeof(struct sqlite3InitInfo)); rc = sqlite3InitOne(db, iDb, pzErr, 0); db->init = sv; |
︙ |
Changes to src/callback.c.
︙ | |||
674 675 676 677 678 679 680 | 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 | - + | } } if( p ) p->nRef++; /* If the SchemaPool contains one or more free schemas at the moment, ** delete one of them. */ |
︙ | |||
703 704 705 706 707 708 709 | 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 | - + - - - + + + - | ** If the bNew parameter is true, then this function may allocate memory. ** If the allocation attempt fails, then SQLITE_NOMEM is returned and the ** schema-pool is not disconnected from. Or, if no OOM error occurs, ** SQLITE_OK is returned. */ int sqlite3SchemaDisconnect(sqlite3 *db, int iDb, int bNew){ int rc = SQLITE_OK; |
︙ | |||
764 765 766 767 768 769 770 | 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 | - - - - - - - - + + + + + + + - | /* ** Extract and return a pointer to a schema object from the SchemaPool passed ** as the only argument, if one is available. If one is not available, return ** NULL. */ Schema *sqlite3SchemaExtract(SchemaPool *pSPool){ Schema *pRet = 0; |
︙ | |||
807 808 809 810 811 812 813 | 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 | - - + - - + + - + + | ** owned by the schema-pool. */ void sqlite3SchemaRelease(sqlite3 *db, int iDb){ Db *pDb = &db->aDb[iDb]; assert( iDb!=1 ); assert_schema_state_ok(db); sqlite3_mutex_enter( sqlite3_mutex_alloc(SQLITE_MUTEX_STATIC_MASTER) ); |
Changes to src/prepare.c.
︙ | |||
136 137 138 139 140 141 142 | 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 | - + + + + | if( SQLITE_OK!=rc ){ if( db->init.orphanTrigger ){ assert( iDb==1 ); }else{ pData->rc = rc; if( rc==SQLITE_NOMEM ){ sqlite3OomFault(db); |
︙ |
Changes to src/vdbe.c.
︙ | |||
3288 3289 3290 3291 3292 3293 3294 | 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 | - - - - - - - + + + + + + + | } } assert( pOp->p5==0 || pOp->p4type==P4_INT32 ); if( pOp->p5 && (iMeta!=pOp->p3 || db->aDb[pOp->p1].pSchema->iGeneration!=pOp->p4.i) ){ |
︙ |
Changes to test/reuse3.test.
︙ | |||
269 270 271 272 273 274 275 276 277 | 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | UPDATE sqlite_master SET sql='CREATE TABLE t3(a,b)' WHERE name = 't3'; } do_test 5.5 { catchsql { SELECT nref,nschema FROM schemapool } db2 } {0 {1 1}} db2 close db close do_test 5.6.1 { forcedelete test.db2 test.db2-wal test.db2-journal forcecopy test.db test.db2 sqlite3 db test.db sqlite3 db2 test.db -shared-schema 1 sqlite3 db3 test.db2 -shared-schema 1 register_schemapool_module db } {} do_execsql_test -db db2 5.6.2 { SELECT * FROM t1 } do_execsql_test -db db3 5.6.3 { SELECT * FROM t1 } do_execsql_test 5.6.4 { SELECT 'nref=' || nRef, 'nschema=' || nSchema FROM schemapool; CREATE TABLE t4(x); DROP TABLE t4; } {nref=2 nschema=1} do_execsql_test -db db2 5.6.5 { SELECT * FROM t1 } do_execsql_test -db db3 5.6.6 { SELECT * FROM t1 } do_execsql_test 5.6.7 { SELECT 'nref=' || nRef, 'nschema=' || nSchema FROM schemapool; ATTACH 'test.db2' AS db2; CREATE TABLE db2.t4(x); DROP TABLE db2.t4; } {nref=1 nschema=1 nref=1 nschema=1} do_execsql_test -db db2 5.6.8 { SELECT * FROM t1 } do_execsql_test -db db3 5.6.9 { SELECT * FROM t1 } do_execsql_test 5.6.10 { SELECT 'nref=' || nRef, 'nschema=' || nSchema FROM schemapool; } {nref=2 nschema=1} finish_test |
Added test/reusefault.test.
|