From: drh Date: Fri, 26 Jun 2009 15:14:55 +0000 (+0000) Subject: Remove the priorNewRowid field from the sqlite3 structure. Use the X-Git-Tag: cvs-to-fossil-cutover~148 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9ed7a9953e6d2e4e67159df8bdc2a60d9642fea3;p=thirdparty%2Fsqlite.git Remove the priorNewRowid field from the sqlite3 structure. Use the last_insert_rowid as the initial value when searching for a new random rowid in the OP_NewRowid opcode. (CVS 6824) FossilOrigin-Name: 96729b2d499f029bfaec6648a592e8ec697d9521 --- diff --git a/manifest b/manifest index 596b310d26..0acd4bb61f 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Skip\sa\scouple\stests\srequiring\sworking\s64bit\sint\ssupport\son\splatforms\swithout\sthat\ssupport.\s\sTest\scode\schange\sonly.\s(CVS\s6823) -D 2009-06-26T14:17:47 +C Remove\sthe\spriorNewRowid\sfield\sfrom\sthe\ssqlite3\sstructure.\s\sUse\sthe\nlast_insert_rowid\sas\sthe\sinitial\svalue\swhen\ssearching\sfor\sa\snew\srandom\nrowid\sin\sthe\sOP_NewRowid\sopcode.\s(CVS\s6824) +D 2009-06-26T15:14:55 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0 F Makefile.in 8b8fb7823264331210cddf103831816c286ba446 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654 @@ -125,7 +125,7 @@ F src/insert.c 94e51344e01aea6be43e95cd24e8baa014d8c3d6 F src/journal.c e00df0c0da8413ab6e1bb7d7cab5665d4a9000d0 F src/legacy.c 9a56cf126ceee332b56061bf16bd0fb4ff9e26c0 F src/loadext.c 0e88a335665db0b2fb4cece3e49dcb65d832635a -F src/main.c db6b0aeb37d345c5cd037e6b218bd726b8d76230 +F src/main.c 9f6d91815233b517c1bdf16fd8fa838d10d2c015 F src/malloc.c 7b3b6423f5b355e5d649b91e16ef252d610bcf19 F src/mem0.c f2f84062d1f35814d6535c9f9e33de3bfb3b132c F src/mem1.c e6d5c23941288df8191b8a98c28e3f57771e2270 @@ -162,7 +162,7 @@ F src/select.c 71748b8e244112cf73df9446c4246c192276c30d F src/shell.c db2643650b9268df89a4bedca3f1c6d9e786f1bb F src/sqlite.h.in ccc67f14d5661240d05eadb8ab308aa637b0630c F src/sqlite3ext.h 1db7d63ab5de4b3e6b83dd03d1a4e64fef6d2a17 -F src/sqliteInt.h 47a5178da39774da8f452f1e90cff1edcd69dced +F src/sqliteInt.h 7f6ab3d1c8aaedc64dc046dc413d9bbe187adf00 F src/sqliteLimit.h ffe93f5a0c4e7bd13e70cd7bf84cfb5c3465f45d F src/status.c 237b193efae0cf6ac3f0817a208de6c6c6ef6d76 F src/table.c cc86ad3d6ad54df7c63a3e807b5783c90411a08d @@ -203,7 +203,7 @@ F src/update.c b58db45e40f11082281d6f94137cd3b5657771d9 F src/utf.c 9541d28f40441812c0b40f00334372a0542c00ff F src/util.c 861d5b5c58be4921f0a254489ea94cb15f550ef8 F src/vacuum.c 0e14f371ea3326c6b8cfba257286d798cd20db59 -F src/vdbe.c e7831536ddb11b14ce29f62a17e0e3860944d570 +F src/vdbe.c e16028ce7912f9b4d9fc61de16aa79a40d156408 F src/vdbe.h 35a648bc3279a120da24f34d9a25213ec15daf8a F src/vdbeInt.h 831c254a6eef237ef4664c8381a0137586567007 F src/vdbeapi.c 0ab8ada7260b32031ca97f338caecf0812460624 @@ -511,7 +511,7 @@ F test/rdonly.test bd054831f8a3078e765a0657e247182486f0cb47 F test/reindex.test 44edd3966b474468b823d481eafef0c305022254 F test/rollback.test 73355ad4492ff9a3a31e61c7e5eb5e01a1de94ca F test/rowhash.test 97f56043ba11f0679920416c0cdbc72e5272267b -F test/rowid.test 1c8fc43c60d273e6ea44dfb992db587f3164312c +F test/rowid.test e58e0acef38b527ed1b0b70d3ada588f804af287 F test/rtree.test 55466a200af3591946c5da77ad5dbfbc1e5e05f9 F test/safety.test b69e2b2dd5d52a3f78e216967086884bbc1a09c6 F test/savepoint.test 4fc56354c7cd9c6be40d6f18e06ee90d92be0cd9 @@ -737,7 +737,7 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e F tool/vdbe-compress.tcl 672f81d693a03f80f5ae60bfefacd8a349e76746 -P fe02339cb2f61c1e8a356e2d0ce9c3aef6e6cd8d -R 92cc4c02fcd24b5a032b486d8397232b -U shane -Z 87a80b68d62d7270dfc0ea1f6aa7e44a +P d8c8145c9d28d014eb9218b3f1312b957ccc72b7 +R b613a9e2d1e2527d50aacbf4a4df984d +U drh +Z 0ac77250d84f1a18186fb1470ccac0a3 diff --git a/manifest.uuid b/manifest.uuid index bdcbad9136..bb3bf4242a 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -d8c8145c9d28d014eb9218b3f1312b957ccc72b7 \ No newline at end of file +96729b2d499f029bfaec6648a592e8ec697d9521 \ No newline at end of file diff --git a/src/main.c b/src/main.c index 273ea06346..fab33ffddd 100644 --- a/src/main.c +++ b/src/main.c @@ -14,7 +14,7 @@ ** other files are for internal use by SQLite and should not be ** accessed by users of the library. ** -** $Id: main.c,v 1.559 2009/06/25 01:47:12 drh Exp $ +** $Id: main.c,v 1.560 2009/06/26 15:14:55 drh Exp $ */ #include "sqliteInt.h" @@ -1562,7 +1562,6 @@ static int openDatabase( } sqlite3_mutex_enter(db->mutex); db->errMask = 0xff; - db->priorNewRowid = 0; db->nDb = 2; db->magic = SQLITE_MAGIC_BUSY; db->aDb = db->aDbStatic; diff --git a/src/sqliteInt.h b/src/sqliteInt.h index 1da0d04880..80510da2e3 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -11,7 +11,7 @@ ************************************************************************* ** Internal interface definitions for SQLite. ** -** @(#) $Id: sqliteInt.h,v 1.889 2009/06/24 11:08:14 drh Exp $ +** @(#) $Id: sqliteInt.h,v 1.890 2009/06/26 15:14:55 drh Exp $ */ #ifndef _SQLITEINT_H_ #define _SQLITEINT_H_ @@ -790,7 +790,6 @@ struct sqlite3 { int nTable; /* Number of tables in the database */ CollSeq *pDfltColl; /* The default collating sequence (BINARY) */ i64 lastRowid; /* ROWID of most recent insert (see above) */ - i64 priorNewRowid; /* Last randomly generated ROWID */ u32 magic; /* Magic number for detect library misuse */ int nChange; /* Value returned by sqlite3_changes() */ int nTotalChange; /* Value returned by sqlite3_total_changes() */ diff --git a/src/vdbe.c b/src/vdbe.c index 62f4946580..02bbb48c43 100644 --- a/src/vdbe.c +++ b/src/vdbe.c @@ -43,7 +43,7 @@ ** in this file for details. If in doubt, do not deviate from existing ** commenting and indentation practices when changing or adding code. ** -** $Id: vdbe.c,v 1.864 2009/06/25 01:47:12 drh Exp $ +** $Id: vdbe.c,v 1.865 2009/06/26 15:14:55 drh Exp $ */ #include "sqliteInt.h" #include "vdbeInt.h" @@ -3649,7 +3649,7 @@ case OP_NewRowid: { /* out2-prerelease */ if( pC->useRandomRowid ){ assert( pOp->p3==0 ); /* We cannot be in random rowid mode if this is ** an AUTOINCREMENT table. */ - v = db->priorNewRowid; + v = db->lastRowid; cnt = 0; do{ if( cnt==0 && (v&0xffffff)==v ){ @@ -3661,7 +3661,6 @@ case OP_NewRowid: { /* out2-prerelease */ rc = sqlite3BtreeMovetoUnpacked(pC->pCursor, 0, (u64)v, 0, &res); cnt++; }while( cnt<100 && rc==SQLITE_OK && res==0 ); - db->priorNewRowid = v; if( rc==SQLITE_OK && res==0 ){ rc = SQLITE_FULL; goto abort_due_to_error; diff --git a/test/rowid.test b/test/rowid.test index 24dcd2a657..4a9404defb 100644 --- a/test/rowid.test +++ b/test/rowid.test @@ -12,7 +12,7 @@ # focus of this file is testing the magic ROWID column that is # found on all tables. # -# $Id: rowid.test,v 1.20 2008/01/19 20:11:26 drh Exp $ +# $Id: rowid.test,v 1.21 2009/06/26 15:14:55 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -666,6 +666,7 @@ do_test rowid-11.4 { do_test rowid-12.1 { execsql { CREATE TABLE t7(x INTEGER PRIMARY KEY, y); + CREATE TABLE t7temp(a INTEGER PRIMARY KEY); INSERT INTO t7 VALUES(9223372036854775807,'a'); SELECT y FROM t7; } @@ -680,17 +681,18 @@ do_test rowid-12.2 { } } {1 b 9223372036854775807 a} execsql {INSERT INTO t7 VALUES(2,'y');} -for {set i 1} {$i<=101} {incr i} { +for {set i 1} {$i<100} {incr i} { do_test rowid-12.3.$i { + db eval {DELETE FROM t7temp; INSERT INTO t7temp VALUES(1);} restore_prng_state execsql { INSERT INTO t7 VALUES(NULL,'x'); - INSERT OR IGNORE INTO t7 VALUES(last_insert_rowid()+1,'y'); SELECT count(*) FROM t7 WHERE y=='x'; } } $i } do_test rowid-12.4 { + db eval {DELETE FROM t7temp; INSERT INTO t7temp VALUES(1);} restore_prng_state catchsql { INSERT INTO t7 VALUES(NULL,'x');