Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Have the rtree module close any open blob-handle within the xSavepoint method. This prevents such an open blob handle from interfering with DROP TABLE operations. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
fa4416adc2a9a3a80db1d5befc0b95c3 |
User & Date: | dan 2017-04-08 13:52:41.332 |
Context
2017-04-08
| ||
14:11 | Expand on the comment above OP_Destroy to explain why it throws an error if there are any active reader VMs. (check-in: b9a8c2b9be user: dan tags: trunk) | |
13:52 | Have the rtree module close any open blob-handle within the xSavepoint method. This prevents such an open blob handle from interfering with DROP TABLE operations. (check-in: fa4416adc2 user: dan tags: trunk) | |
13:42 | Fix the quoting mechanism for ".dump" so that it is not applied for the ".mode quote" output. (check-in: 78c1e90305 user: drh tags: trunk) | |
Changes
Changes to ext/rtree/rtree.c.
︙ | ︙ | |||
3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 | nodeBlobReset(pRtree); rc = sqlite3_exec(pRtree->db, zSql, 0, 0, 0); sqlite3_free(zSql); } return rc; } /* ** This function populates the pRtree->nRowEst variable with an estimate ** of the number of rows in the virtual table. If possible, this is based ** on sqlite_stat1 data. Otherwise, use RTREE_DEFAULT_ROWEST. */ static int rtreeQueryStat1(sqlite3 *db, Rtree *pRtree){ | > > > > > > > > > > > > > > > > > > > > > > | 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 | nodeBlobReset(pRtree); rc = sqlite3_exec(pRtree->db, zSql, 0, 0, 0); sqlite3_free(zSql); } return rc; } /* ** The xSavepoint method. ** ** This module does not need to do anything to support savepoints. However, ** it uses this hook to close any open blob handle. This is done because a ** DROP TABLE command - which fortunately always opens a savepoint - cannot ** succeed if there are any open blob handles. i.e. if the blob handle were ** not closed here, the following would fail: ** ** BEGIN; ** INSERT INTO rtree... ** DROP TABLE <tablename>; -- Would fail with SQLITE_LOCKED ** COMMIT; */ static int rtreeSavepoint(sqlite3_vtab *pVtab, int iSavepoint){ Rtree *pRtree = (Rtree *)pVtab; int iwt = pRtree->inWrTrans; pRtree->inWrTrans = 0; nodeBlobReset(pRtree); pRtree->inWrTrans = iwt; return SQLITE_OK; } /* ** This function populates the pRtree->nRowEst variable with an estimate ** of the number of rows in the virtual table. If possible, this is based ** on sqlite_stat1 data. Otherwise, use RTREE_DEFAULT_ROWEST. */ static int rtreeQueryStat1(sqlite3 *db, Rtree *pRtree){ |
︙ | ︙ | |||
3247 3248 3249 3250 3251 3252 3253 | sqlite3_free(zSql); } return rc; } static sqlite3_module rtreeModule = { | | | | 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 | sqlite3_free(zSql); } return rc; } static sqlite3_module rtreeModule = { 2, /* iVersion */ rtreeCreate, /* xCreate - create a table */ rtreeConnect, /* xConnect - connect to an existing table */ rtreeBestIndex, /* xBestIndex - Determine search strategy */ rtreeDisconnect, /* xDisconnect - Disconnect from a table */ rtreeDestroy, /* xDestroy - Drop a table */ rtreeOpen, /* xOpen - open a cursor */ rtreeClose, /* xClose - close a cursor */ rtreeFilter, /* xFilter - configure scan constraints */ rtreeNext, /* xNext - advance a cursor */ rtreeEof, /* xEof */ rtreeColumn, /* xColumn - read data */ rtreeRowid, /* xRowid - read data */ rtreeUpdate, /* xUpdate - write data */ rtreeBeginTransaction, /* xBegin - begin transaction */ rtreeEndTransaction, /* xSync - sync transaction */ rtreeEndTransaction, /* xCommit - commit transaction */ rtreeEndTransaction, /* xRollback - rollback transaction */ 0, /* xFindFunction - function overloading */ rtreeRename, /* xRename - rename the table */ rtreeSavepoint, /* xSavepoint */ 0, /* xRelease */ 0, /* xRollbackTo */ }; static int rtreeSqlInit( Rtree *pRtree, sqlite3 *db, |
︙ | ︙ |
Changes to ext/rtree/rtree1.test.
︙ | ︙ | |||
35 36 37 38 39 40 41 42 43 44 45 46 47 48 | # rtree-12.*: Test that on-conflict clauses are supported. # rtree-13.*: Test that bug [d2889096e7bdeac6d] has been fixed. # rtree-14.*: Test if a non-integer is inserted into the PK column of an # r-tree table, it is converted to an integer before being # inserted. Also that if a non-numeric is inserted into one # of the min/max dimension columns, it is converted to the # required type before being inserted. # ifcapable !rtree { finish_test return } | > > | 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | # rtree-12.*: Test that on-conflict clauses are supported. # rtree-13.*: Test that bug [d2889096e7bdeac6d] has been fixed. # rtree-14.*: Test if a non-integer is inserted into the PK column of an # r-tree table, it is converted to an integer before being # inserted. Also that if a non-numeric is inserted into one # of the min/max dimension columns, it is converted to the # required type before being inserted. # rtree-15.*: Check that DROP TABLE works within a transaction that # writes to an r-tree table. # ifcapable !rtree { finish_test return } |
︙ | ︙ | |||
587 588 589 590 591 592 593 594 595 | do_execsql_test 14.5 { SELECT * FROM t10; } { 1 0 0 2 52 81 3 42 49 } finish_test | > > > > > > > > > > > > > > > > | 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 | do_execsql_test 14.5 { SELECT * FROM t10; } { 1 0 0 2 52 81 3 42 49 } #------------------------------------------------------------------------- # do_execsql_test 15.0 { CREATE VIRTUAL TABLE rt USING rtree(id, x1,x2, y1,y2); CREATE TEMP TABLE t13(a, b, c); } do_execsql_test 15.1 { BEGIN; INSERT INTO rt VALUES(1,2,3,4,5); } breakpoint do_execsql_test 15.2 { DROP TABLE t13; COMMIT; } finish_test |