------BEGIN PGP SIGNED MESSAGE-----
-Hash: SHA1
-
-C Fix\scomment\stypos\sin\sbtreeInt.h.
-D 2009-10-16T13:23:33
+C Experimental\sfix\sfor\s[f777251dc7].\sThis\smay\sbe\schanged\syet.
+D 2009-10-16T14:55:03
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
F Makefile.in 4ca3f1dd6efa2075bcb27f4dc43eef749877740d
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
F src/backup.c 6f1c2d9862c8a3feb7739dfcca02c1f5352e37f3
F src/bitvec.c ed215b95734045e58358c3b3e16448f8fe6a235a
F src/btmutex.c 0f43a75bb5b8147b386e8e1c3e71ba734e3863b7
-F src/btree.c 9c425425784c5d569bc0309c22251698ba906451
+F src/btree.c 953ad6635e39df97bcd5ff6983128622c634e9f6
F src/btree.h 577448a890c2ab9b21e6ab74f073526184bceebe
F src/btreeInt.h cce1c3360cd5549ffa79f981951dfae93118ad79
F src/build.c 3c5762687d0554ebe8844dfaddb828fcc15fe16d
F src/update.c 2c8a64237e4fae604468d14380b877d169545b63
F src/utf.c 99cf927eabb104621ba889ac0dd075fc1657ad30
F src/util.c 59d4e9456bf1fe581f415a783fa0cee6115c8f35
-F src/vacuum.c 869d08eaab64e2a4eaf4ef9ea34b851892b65a75
-F src/vdbe.c 93fb0b490db0e27291d5240b00320a378199e0b8
+F src/vacuum.c f2347520907ee4ec867c9b804d24456b0fd912a7
+F src/vdbe.c b00293fa34fe0e065610f355fd95988fa357068a
F src/vdbe.h 7d5075e3fa4e5587a9be8d5e503857c825490cef
F src/vdbeInt.h 7afb76c0296f9a2310e565803fa66798ef47e9d5
F src/vdbeapi.c 524d79eb17bbcbe31c37c908b8e01edc5c684a90
F test/tkt-2ea2425d34.test 1cf13e6f75d149b3209a0cb32927a82d3d79fb28
F test/tkt-4a03edc4c8.test 2865e4edbc075b954daa82f8da7cc973033ec76e
F test/tkt-5ee23731f.test 3581260f2a71e51db94e1506ba6b0f7311d002a9
+F test/tkt-f777251dc7a.test 6f24c053bc5cdb7e1e19be9a72c8887cf41d5e87
F test/tkt1435.test f8c52c41de6e5ca02f1845f3a46e18e25cadac00
F test/tkt1443.test bacc311da5c96a227bf8c167e77a30c99f8e8368
F test/tkt1444.test a9d72f9e942708bd82dde6c707da61c489e213e9
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
-P c1d499afc50d54b376945b4efb65c56c787a073d
-R cf7ba44c45be9336ed7c2a5c9b298530
-U drh
-Z 27563b519474558dd6b5547423b5bb90
------BEGIN PGP SIGNATURE-----
-Version: GnuPG v1.4.6 (GNU/Linux)
-
-iD8DBQFK2HPYoxKgR168RlERAkZuAJ92TotoUKoCIhNfm2FWCGunPPZHjQCfVF36
-HyFlyXF9kYuWkApFgboU+4c=
-=hlwq
------END PGP SIGNATURE-----
+P 550566a75fc79e3662431ba493af853b522d8850
+R 778bb64a8b1c35d3d0457babdafdb276
+U dan
+Z b88fc6ff2b43f8e3419b27ff47f04190
-550566a75fc79e3662431ba493af853b522d8850
\ No newline at end of file
+174477bca05d019e663fd2b7cd031189ab2e010a
\ No newline at end of file
*/
static void btreeEndTransaction(Btree *p){
BtShared *pBt = p->pBt;
- BtCursor *pCsr;
assert( sqlite3BtreeHoldsMutex(p) );
- /* Search for a cursor held open by this b-tree connection. If one exists,
- ** then the transaction will be downgraded to a read-only transaction
- ** instead of actually concluded. A subsequent call to CommitPhaseTwo()
- ** or Rollback() will finish the transaction and unlock the database. */
- for(pCsr=pBt->pCursor; pCsr && pCsr->pBtree!=p; pCsr=pCsr->pNext);
- assert( pCsr==0 || p->inTrans>TRANS_NONE );
-
btreeClearHasContent(pBt);
- if( pCsr ){
+ if( p->inTrans>TRANS_NONE && p->db->activeVdbeCnt>1 ){
+ /* If there are other active statements that belong to this database
+ ** handle, downgrade to a read-only transaction. The other statements
+ ** may still be reading from the database. */
downgradeAllSharedCacheTableLocks(p);
p->inTrans = TRANS_READ;
}else{
assert( strcmp(db->aDb[db->nDb-1].zName,"vacuum_db")==0 );
pTemp = db->aDb[db->nDb-1].pBt;
+ /* The call to execSql() to attach the temp database has left the file
+ ** locked (as there was more than one active statement when the transaction
+ ** to read the schema was concluded. Unlock it here so that this doesn't
+ ** cause problems for the call to BtreeSetPageSize() below. */
+ sqlite3BtreeCommit(pTemp);
+
nRes = sqlite3BtreeGetReserve(pMain);
/* A VACUUM cannot change the pagesize of an encrypted database. */
/* Invalidate all prepared statements whenever the TEMP database
** schema is changed. Ticket #1644 */
sqlite3ExpirePreparedStatements(db);
+ p->expired = 0;
}
break;
}
VdbeCursor *pCur;
Db *pDb;
+ if( p->expired ){
+ rc = SQLITE_ABORT;
+ break;
+ }
+
nField = 0;
pKeyInfo = 0;
p2 = pOp->p2;
--- /dev/null
+# 2009 October 16
+#
+# The author disclaims copyright to this source code. In place of
+# a legal notice, here is a blessing:
+#
+# May you do good and not evil.
+# May you find forgiveness for yourself and forgive others.
+# May you share freely, never taking more than you give.
+#
+#***********************************************************************
+# This file implements regression tests for SQLite library.
+#
+# This file implements tests to verify that ticket [f777251dc7a] has been
+# fixed.
+#
+
+set testdir [file dirname $argv0]
+source $testdir/tester.tcl
+
+do_test tkt-f7772-1.1 {
+ execsql {
+ CREATE TEMP TABLE t1(x UNIQUE);
+ INSERT INTO t1 VALUES(1);
+ CREATE TABLE t2(x, y);
+ INSERT INTO t2 VALUES(1, 2);
+ CREATE TEMP TABLE t3(w, z);
+ }
+} {}
+
+proc force_rollback {} {
+ catch {db eval {INSERT OR ROLLBACK INTO t1 VALUES(1)}}
+}
+db function force_rollback force_rollback
+
+do_test tkt-f7772-1.2 {
+ catchsql {
+ BEGIN IMMEDIATE;
+ SELECT x, force_rollback(), EXISTS(SELECT 1 FROM t3 WHERE w=x) FROM t2;
+ }
+} {1 {callback requested query abort}}
+do_test tkt-f7772-1.3 {
+ sqlite3_get_autocommit db
+} {1}
+
+do_test tkt-f7772-2.1 {
+ execsql {
+ DROP TABLE IF EXISTS t1;
+ DROP TABLE IF EXISTS t2;
+ DROP TABLE IF EXISTS t3;
+
+ CREATE TEMP TABLE t1(x UNIQUE);
+ INSERT INTO t1 VALUES(1);
+ CREATE TABLE t2(x, y);
+ INSERT INTO t2 VALUES(1, 2);
+ }
+} {}
+do_test tkt-f7772-2.2 {
+ execsql {
+ BEGIN IMMEDIATE;
+ CREATE TEMP TABLE t3(w, z);
+ }
+ catchsql {
+ SELECT x, force_rollback(), EXISTS(SELECT 1 FROM t3 WHERE w=x) FROM t2
+ }
+} {1 {callback requested query abort}}
+do_test tkt-f7772-2.3 {
+ sqlite3_get_autocommit db
+} {1}
+
+do_test tkt-f7772-3.1 {
+ execsql {
+ DROP TABLE IF EXISTS t1;
+ DROP TABLE IF EXISTS t2;
+ DROP TABLE IF EXISTS t3;
+
+ CREATE TEMP TABLE t1(x);
+ CREATE TABLE t2(x);
+ CREATE TABLE t3(x);
+
+ INSERT INTO t1 VALUES(1);
+ INSERT INTO t1 VALUES(2);
+ INSERT INTO t2 VALUES(1);
+ INSERT INTO t2 VALUES(2);
+ }
+} {}
+
+proc ins {} { db eval {INSERT INTO t3 VALUES('hello')} }
+db function ins ins
+
+do_test tkt-f7772-3.2 {
+ execsql {
+ SELECT ins() AS x FROM t2 UNION ALL SELECT ins() AS x FROM t1
+ }
+} {{} {} {} {}}
+do_test tkt-f7772-3.3 {
+ execsql { SELECT * FROM t3 }
+} {hello hello hello hello}
+
+finish_test