mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-01 06:27:03 +03:00
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. FossilOrigin-Name: fa4416adc2a9a3a80db1d5befc0b95c3d0fc41affe38f7f2f45cdfae3f1b49eb
This commit is contained in:
@ -3205,6 +3205,28 @@ static int rtreeRename(sqlite3_vtab *pVtab, const char *zNewName){
|
|||||||
return rc;
|
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
|
** This function populates the pRtree->nRowEst variable with an estimate
|
||||||
@ -3251,7 +3273,7 @@ static int rtreeQueryStat1(sqlite3 *db, Rtree *pRtree){
|
|||||||
}
|
}
|
||||||
|
|
||||||
static sqlite3_module rtreeModule = {
|
static sqlite3_module rtreeModule = {
|
||||||
0, /* iVersion */
|
2, /* iVersion */
|
||||||
rtreeCreate, /* xCreate - create a table */
|
rtreeCreate, /* xCreate - create a table */
|
||||||
rtreeConnect, /* xConnect - connect to an existing table */
|
rtreeConnect, /* xConnect - connect to an existing table */
|
||||||
rtreeBestIndex, /* xBestIndex - Determine search strategy */
|
rtreeBestIndex, /* xBestIndex - Determine search strategy */
|
||||||
@ -3271,7 +3293,7 @@ static sqlite3_module rtreeModule = {
|
|||||||
rtreeEndTransaction, /* xRollback - rollback transaction */
|
rtreeEndTransaction, /* xRollback - rollback transaction */
|
||||||
0, /* xFindFunction - function overloading */
|
0, /* xFindFunction - function overloading */
|
||||||
rtreeRename, /* xRename - rename the table */
|
rtreeRename, /* xRename - rename the table */
|
||||||
0, /* xSavepoint */
|
rtreeSavepoint, /* xSavepoint */
|
||||||
0, /* xRelease */
|
0, /* xRelease */
|
||||||
0, /* xRollbackTo */
|
0, /* xRollbackTo */
|
||||||
};
|
};
|
||||||
|
@ -39,6 +39,8 @@ set testprefix rtree1
|
|||||||
# inserted. Also that if a non-numeric is inserted into one
|
# inserted. Also that if a non-numeric is inserted into one
|
||||||
# of the min/max dimension columns, it is converted to the
|
# of the min/max dimension columns, it is converted to the
|
||||||
# required type before being inserted.
|
# required type before being inserted.
|
||||||
|
# rtree-15.*: Check that DROP TABLE works within a transaction that
|
||||||
|
# writes to an r-tree table.
|
||||||
#
|
#
|
||||||
|
|
||||||
ifcapable !rtree {
|
ifcapable !rtree {
|
||||||
@ -592,4 +594,20 @@ do_execsql_test 14.5 {
|
|||||||
3 42 49
|
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
|
finish_test
|
||||||
|
16
manifest
16
manifest
@ -1,5 +1,5 @@
|
|||||||
C Fix\sthe\squoting\smechanism\sfor\s".dump"\sso\sthat\sit\sis\snot\sapplied\sfor\sthe\n".mode\squote"\soutput.
|
C Have\sthe\srtree\smodule\sclose\sany\sopen\sblob-handle\swithin\sthe\sxSavepoint\smethod.\nThis\sprevents\ssuch\san\sopen\sblob\shandle\sfrom\sinterfering\swith\sDROP\sTABLE\noperations.
|
||||||
D 2017-04-08T13:42:55.616
|
D 2017-04-08T13:52:41.332
|
||||||
F Makefile.in 1cc758ce3374a32425e4d130c2fe7b026b20de5b8843243de75f087c0a2661fb
|
F Makefile.in 1cc758ce3374a32425e4d130c2fe7b026b20de5b8843243de75f087c0a2661fb
|
||||||
F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
|
F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
|
||||||
F Makefile.msc a4c0613a18663bda56d8cf76079ab6590a7c3602e54befb4bbdef76bcaa38b6a
|
F Makefile.msc a4c0613a18663bda56d8cf76079ab6590a7c3602e54befb4bbdef76bcaa38b6a
|
||||||
@ -271,9 +271,9 @@ F ext/rbu/sqlite3rbu.c 2a89efba9eeba8e6c89a498dc195e8efbdde2694
|
|||||||
F ext/rbu/sqlite3rbu.h 6fb6294c34a9ca93b5894a33bca530c6f08decba
|
F ext/rbu/sqlite3rbu.h 6fb6294c34a9ca93b5894a33bca530c6f08decba
|
||||||
F ext/rbu/test_rbu.c 5aa22616afac6f71ebd3d9bc9bf1006cfabcca88
|
F ext/rbu/test_rbu.c 5aa22616afac6f71ebd3d9bc9bf1006cfabcca88
|
||||||
F ext/rtree/README 6315c0d73ebf0ec40dedb5aa0e942bc8b54e3761
|
F ext/rtree/README 6315c0d73ebf0ec40dedb5aa0e942bc8b54e3761
|
||||||
F ext/rtree/rtree.c fb7c0e62ccbbbd6951ddb1f52feaa2c1a53b7ac1c6f2d5d5e2bbd31c33e57186
|
F ext/rtree/rtree.c 37c603c6b8aed1a760661ceb5a025bd36bac14cf56d59949bd8de14b2a17e9ed
|
||||||
F ext/rtree/rtree.h 834dbcb82dc85b2481cde6a07cdadfddc99e9b9e
|
F ext/rtree/rtree.h 834dbcb82dc85b2481cde6a07cdadfddc99e9b9e
|
||||||
F ext/rtree/rtree1.test 42dadfc7b44a436cd74a1bebc0b9b689e4eaf7ec
|
F ext/rtree/rtree1.test d5f0ba215b3bd1d05269ada86e74073b8445852aa0d33a63e10ec63a09c39473
|
||||||
F ext/rtree/rtree2.test acbb3a4ce0f4fbc2c304d2b4b784cfa161856bba
|
F ext/rtree/rtree2.test acbb3a4ce0f4fbc2c304d2b4b784cfa161856bba
|
||||||
F ext/rtree/rtree3.test 2cafe8265d1ff28f206fce88d114f208349df482
|
F ext/rtree/rtree3.test 2cafe8265d1ff28f206fce88d114f208349df482
|
||||||
F ext/rtree/rtree4.test c8fe384f60ebd49540a5fecc990041bf452eb6e0
|
F ext/rtree/rtree4.test c8fe384f60ebd49540a5fecc990041bf452eb6e0
|
||||||
@ -1570,7 +1570,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
|
|||||||
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
|
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
|
||||||
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
|
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
|
||||||
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
|
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
|
||||||
P a921ada89050ce1d162fd1b0056939573635e2cec7ac0c2a99ae924b3ae593f7
|
P 78c1e90305d48917d9423d8e50a7dfd15ec27aa93cb421610062229c7ede13a6
|
||||||
R 82737b36216e366238632e12de53d03d
|
R 0c38afb8d28742bfd99c862428490c09
|
||||||
U drh
|
U dan
|
||||||
Z 97234581d28b10577d1d04c415271f72
|
Z 475b2e97335280e83d36c7e778a71dcc
|
||||||
|
@ -1 +1 @@
|
|||||||
78c1e90305d48917d9423d8e50a7dfd15ec27aa93cb421610062229c7ede13a6
|
fa4416adc2a9a3a80db1d5befc0b95c3d0fc41affe38f7f2f45cdfae3f1b49eb
|
Reference in New Issue
Block a user