From: drh Date: Wed, 31 Mar 2010 17:47:44 +0000 (+0000) Subject: Clarification of the implementation of SQLITE_STMTSTATUS_FULLSCAN_STEP. X-Git-Tag: version-3.7.2~505 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=afc266a76ae04c54131ec16ca11110b403c7cff2;p=thirdparty%2Fsqlite.git Clarification of the implementation of SQLITE_STMTSTATUS_FULLSCAN_STEP. No logical code changes - just commenting and layout changes to improve readability. FossilOrigin-Name: 06b9ca32255572a699dc51f46f848d0bf01255e1 --- diff --git a/manifest b/manifest index 4774955f8c..d98b27f90c 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,8 @@ -C Clear\sthe\scolumn\scache\sbefore\spopulating\saggregate\saccumulator\sregisters.\sFix\sfo\nr\s[883034dcb5]. -D 2010-03-31T15:02:56 +-----BEGIN PGP SIGNED MESSAGE----- +Hash: SHA1 + +C Clarification\sof\sthe\simplementation\sof\sSQLITE_STMTSTATUS_FULLSCAN_STEP.\nNo\slogical\scode\schanges\s-\sjust\scommenting\sand\slayout\schanges\sto\simprove\nreadability. +D 2010-03-31T17:47:44 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0 F Makefile.in 4f2f967b7e58a35bb74fb7ec8ae90e0f4ca7868b F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654 @@ -211,7 +214,7 @@ F src/update.c c0dc6b75ad28b76b619042d934f337b02acee208 F src/utf.c 1baeeac91707a4df97ccc6141ec0f808278af685 F src/util.c 32aebf04c10e51ad3977a928b7416bed671b620b F src/vacuum.c b1d542c8919d4d11119f78069e1906a1ad07e0ee -F src/vdbe.c afd58607e70bca91da8c5f9effeef0065862d0d0 +F src/vdbe.c 760a0857cdcc000759bd3a5b8e2907dd351072bc F src/vdbe.h 471f6a3dcec4817ca33596fe7f6654d56c0e75f3 F src/vdbeInt.h ae1e6ba0dd3fb4a886898d2829d748be701b01f8 F src/vdbeapi.c 74c25680046a116b24b95393914d3669c23305dc @@ -221,7 +224,7 @@ F src/vdbemem.c 2a82f455f6ca6f78b59fb312f96054c04ae0ead1 F src/vdbetrace.c 864cef96919323482ebd9986f2132435115e9cc2 F src/vtab.c 606adf51cd6d4ba51a8c6dccede06a6f7b0dd72d F src/walker.c 3112bb3afe1d85dc52317cb1d752055e9a781f8f -F src/where.c 71ef4e89715740f7af49e6f15a3fd987e040800a +F src/where.c 8bbb34e8a836165d92a7d60b80f60be2da9615f9 F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2 F test/alias.test 4529fbc152f190268a15f9384a5651bbbabc9d87 F test/all.test 14165b3e32715b700b5f0cbf8f6e3833dda0be45 @@ -794,7 +797,14 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f -P ba13a11108d7852c61f959cc8a5fc39c25202cae -R a7012d4c6b5a7b7569f946e644ce711a -U dan -Z 1ad98db4671ea4d80ce9c3a38a2ae9ea +P ffc23409c7fb45dc5a8722fad26e26d207bb3213 +R fb70f81c55ea2f57d23ae93c53ee104a +U drh +Z 2e6efba5751b6f848c3f2e5e8db9d371 +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.4.6 (GNU/Linux) + +iD8DBQFLs4rDoxKgR168RlERAiZYAJ0TZfEDkV0dVbYdvmxs5u4E7UpfBgCfXR5e +/ISKZh0zZtpX5zEYwcAlUEA= +=n9oV +-----END PGP SIGNATURE----- diff --git a/manifest.uuid b/manifest.uuid index d0235c12fb..7e6af2b664 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -ffc23409c7fb45dc5a8722fad26e26d207bb3213 \ No newline at end of file +06b9ca32255572a699dc51f46f848d0bf01255e1 \ No newline at end of file diff --git a/src/vdbe.c b/src/vdbe.c index 2e666abd17..d038902fb2 100644 --- a/src/vdbe.c +++ b/src/vdbe.c @@ -4190,7 +4190,7 @@ case OP_Rewind: { /* jump */ break; } -/* Opcode: Next P1 P2 * * * +/* Opcode: Next P1 P2 * * P5 ** ** Advance cursor P1 so that it points to the next key/data pair in its ** table or index. If there are no more key/value pairs then fall through @@ -4199,9 +4199,12 @@ case OP_Rewind: { /* jump */ ** ** The P1 cursor must be for a real table, not a pseudo-table. ** +** If P5 is positive and the jump is taken, then event counter +** number P5-1 in the prepared statement is incremented. +** ** See also: Prev */ -/* Opcode: Prev P1 P2 * * * +/* Opcode: Prev P1 P2 * * P5 ** ** Back up cursor P1 so that it points to the previous key/data pair in its ** table or index. If there is no previous key/value pairs then fall through @@ -4209,6 +4212,9 @@ case OP_Rewind: { /* jump */ ** jump immediately to P2. ** ** The P1 cursor must be for a real table, not a pseudo-table. +** +** If P5 is positive and the jump is taken, then event counter +** number P5-1 in the prepared statement is incremented. */ case OP_Prev: /* jump */ case OP_Next: { /* jump */ @@ -4218,6 +4224,7 @@ case OP_Next: { /* jump */ CHECK_FOR_INTERRUPT; assert( pOp->p1>=0 && pOp->p1nCursor ); + assert( pOp->p5<=ArraySize(p->aCounter) ); pC = p->apCsr[pOp->p1]; if( pC==0 ){ break; /* See ticket #2273 */ diff --git a/src/where.c b/src/where.c index 3ed7d3d8e0..bd82bb01d3 100644 --- a/src/where.c +++ b/src/where.c @@ -2998,7 +2998,11 @@ static Bitmask codeOneLoopStart( pLevel->op = bRev ? OP_Prev : OP_Next; pLevel->p1 = iCur; pLevel->p2 = start; - pLevel->p5 = (pStart==0 && pEnd==0) ?1:0; + if( pStart==0 && pEnd==0 ){ + pLevel->p5 = SQLITE_STMTSTATUS_FULLSCAN_STEP; + }else{ + assert( pLevel->p5==0 ); + } if( testOp!=OP_Noop ){ iRowidReg = iReleaseReg = sqlite3GetTempReg(pParse); sqlite3VdbeAddOp2(v, OP_Rowid, iCur, iRowidReg);