Omit the Vdbe.runOnlyOnce flag (simplifying the prepared statement

implementation) and accomplish the same result by adding an "OP_Expire 1 1"
opcode to prepared statements that would normally have runOnlyOnce set.

FossilOrigin-Name: 6e20e1c46d17ac6aba21e02b57649af51cfa415d83d0c001b30677d2fd1f1dc1
This commit is contained in:
drh 2022-04-03 19:13:40 +00:00
parent 8ee75f7c3a
commit 18bcfb999a
4 changed files with 16 additions and 12 deletions

View File

@ -1,5 +1,5 @@
C Performance\soptimization\sand\sslight\ssize\sreduction\sin\sthe\sOP_Transaction\nopcode.
D 2022-04-03T10:42:06.846
C Omit\sthe\sVdbe.runOnlyOnce\sflag\s(simplifying\sthe\sprepared\sstatement\nimplementation)\sand\saccomplish\sthe\ssame\sresult\sby\sadding\san\s"OP_Expire\s1\s1"\nopcode\sto\sprepared\sstatements\sthat\swould\snormally\shave\srunOnlyOnce\sset.
D 2022-04-03T19:13:40.130
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@ -626,9 +626,9 @@ F src/util.c 602fe229f32a96ceccae4f40824129669582096f7c355f53dbac156c9fecef23
F src/vacuum.c 6c38ddc52f0619865c91dae9c441d4d48bf3040d7dc1bc5b22da1e45547ed0b3
F src/vdbe.c 17c49fe3d853ca458dbf681ea462f8095b4cab86beaca57be3483f8aa0394ca4
F src/vdbe.h a1d0e3b934e835e73edd146f2e7c4eadb711b5c9875c18159a57483fd78e550e
F src/vdbeInt.h 88c11169ac35488764e6275017610ddbaaa0e51acd260ea61638f9ccce578d7c
F src/vdbeInt.h 5f3d0abcf30c2b7a6672ad4386f18be0fca9c9b2cefe18f85a2e3df74f2613bf
F src/vdbeapi.c 5c498998c99667f16cac2519f2fa439fe46acf99a332b0caa73637fc2ab35c22
F src/vdbeaux.c d928cca15c31da201e0198b10fe29ffc001a0d1dfcffdcee6c6acce2360f0053
F src/vdbeaux.c 7769be4cff457f8d52732c7b1c7772100dace9cb8aff070c74cd6b956a1a94e2
F src/vdbeblob.c 5e61ce31aca17db8fb60395407457a8c1c7fb471dde405e0cd675974611dcfcd
F src/vdbemem.c 062cd58c54f887dc2eeb865686251c17237f791f0e6394e9c6f7a6f3c1a7e206
F src/vdbesort.c 43756031ca7430f7aec3ef904824a7883c4ede783e51f280d99b9b65c0796e35
@ -1945,8 +1945,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
P cd4fe34b98bf5ce26f3596c717edb73932f3b46ad6e9b4934d06b7b3c176a0d6
R cceae0bcc38787bdf816e721690684a9
P 7bee8c195f3fc27aaab13e493ad446a4f19201de3ac064ed6d8a3cbda7c69ee1
R 15ed6d8a2e61bcb1b52a461e4c596e08
U drh
Z 9618a426f045ebdd433022eacdc71e54
Z c2f5051216c01ebf5c6b4028b126912b
# Remove this line to create a well-formed Fossil manifest.

View File

@ -1 +1 @@
7bee8c195f3fc27aaab13e493ad446a4f19201de3ac064ed6d8a3cbda7c69ee1
6e20e1c46d17ac6aba21e02b57649af51cfa415d83d0c001b30677d2fd1f1dc1

View File

@ -459,7 +459,6 @@ struct Vdbe {
bft expired:2; /* 1: recompile VM immediately 2: when convenient */
bft explain:2; /* True if EXPLAIN present on SQL command */
bft changeCntOn:1; /* True to update the change-counter */
bft runOnlyOnce:1; /* Automatically expire on reset */
bft usesStmtJournal:1; /* True if uses a statement journal */
bft readOnly:1; /* True for statements that do not write */
bft bIsReader:1; /* True for statements that read */

View File

@ -588,14 +588,20 @@ void sqlite3VdbeResolveLabel(Vdbe *v, int x){
** Mark the VDBE as one that can only be run one time.
*/
void sqlite3VdbeRunOnlyOnce(Vdbe *p){
p->runOnlyOnce = 1;
sqlite3VdbeAddOp2(p, OP_Expire, 1, 1);
}
/*
** Mark the VDBE as one that can only be run multiple times.
*/
void sqlite3VdbeReusable(Vdbe *p){
p->runOnlyOnce = 0;
int i;
for(i=1; ALWAYS(i<p->nOp); i++){
if( p->aOp[i].opcode==OP_Expire ){
p->aOp[1].opcode = OP_Noop;
break;
}
}
}
#ifdef SQLITE_DEBUG /* sqlite3AssertMayAbort() logic */
@ -3314,7 +3320,6 @@ int sqlite3VdbeReset(Vdbe *p){
}else{
db->errCode = p->rc;
}
if( p->runOnlyOnce ) p->expired = 1;
}
/* Reset register contents and reclaim error message memory.