Change the coding of PRAGMA count_changes so that it uses memory cells
of the VM rather than the stack, to avoid problems with leftovers on the stack interfering with other operations. Ticket #2217. (CVS 3632) FossilOrigin-Name: 2bd4b62a20219f939ac2ac22440dc7fc0449f766
This commit is contained in:
parent
3438ea3b9e
commit
53a677749f
16
manifest
16
manifest
@ -1,5 +1,5 @@
|
||||
C http://www.sqlite.org/cvstrac/tktview?tn=2219\n\nWhen\screating\sfts\stables\sin\san\sattached\sdatabase,\sthe\sbacking\stables\nare\screated\sin\sdatabase\s'main'.\s\sThis\schange\spropagates\sthe\nappropriate\sdatabase\sname\sto\sthe\sroutines\swhich\sbuild\ssql\sstatements.\n\nNote\sthat\sI\spropagate\sthe\sdatabase\sname\sand\stable\sname\sseparately.\s\sI\nbriefly\sconsidered\sjust\smaking\sthe\stable\sname\sbe\s"db.table",\sbut\sit\ndidn't\sfit\sso\swell\sin\sthe\smodel\sused\sto\sstore\sthe\stable\sname\sand\sother\ninformation,\sand\shaving\sthe\sdb\sname\spassed\sseparately\sseemed\sa\sbit\nmore\stransparent.\s(CVS\s3631)
|
||||
D 2007-02-07T01:01:17
|
||||
C Change\sthe\scoding\sof\sPRAGMA\scount_changes\sso\sthat\sit\suses\smemory\scells\nof\sthe\sVM\srather\sthan\sthe\sstack,\sto\savoid\sproblems\swith\sleftovers\son\sthe\nstack\sinterfering\swith\sother\soperations.\s\sTicket\s#2217.\s(CVS\s3632)
|
||||
D 2007-02-07T01:06:53
|
||||
F Makefile.in 7fa74bf4359aa899da5586e394d17735f221315f
|
||||
F Makefile.linux-gcc 2d8574d1ba75f129aba2019f0b959db380a90935
|
||||
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
|
||||
@ -63,7 +63,7 @@ F src/build.c 6bd68dc730b01c1727738f8e4b5c730eb0ddb421
|
||||
F src/callback.c 31d22b4919c7645cbcbb1591ce2453e8c677c558
|
||||
F src/complete.c 7d1a44be8f37de125fcafd3d3a018690b3799675
|
||||
F src/date.c 393c73fc027597e008dcd81454544659e978b05c
|
||||
F src/delete.c 804384761144fe1a5035b99f4bd7d706976831bd
|
||||
F src/delete.c 151d08386bf9c9e7f92f6b9106c71efec2def184
|
||||
F src/experimental.c 1b2d1a6cd62ecc39610e97670332ca073c50792b
|
||||
F src/expr.c 8cf28815fd3207ca99b5d755b1c8b662c263b29b
|
||||
F src/func.c b7e1e220a6795ecae7649815145ea5f8644dfa5f
|
||||
@ -117,7 +117,7 @@ F src/test_server.c a6460daed0b92ecbc2531b6dc73717470e7a648c
|
||||
F src/test_tclvar.c 315e77c17f128ff8c06b38c08617fd07c825a95b
|
||||
F src/tokenize.c bb1732ef2b6fc2143f93ff28a45d3dcb04c1d396
|
||||
F src/trigger.c 8c55d31876013ed4e97ee7ce24478fbe00db49bb
|
||||
F src/update.c 951f95ef044cf6d28557c48dc35cb0711a0b9129
|
||||
F src/update.c bdfcf3600f129bd5f06094781ab41cd7b7f5ab25
|
||||
F src/utf.c 67ecb1032bc0b42c105e88d65ef9d9f626eb0e1f
|
||||
F src/util.c 91d4cb189476906639ae611927d939691d1365f6
|
||||
F src/vacuum.c b4569b08aaa5afb141af3f76d0315745db4e9e4b
|
||||
@ -431,7 +431,7 @@ F www/tclsqlite.tcl bb0d1357328a42b1993d78573e587c6dcbc964b9
|
||||
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
|
||||
F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
|
||||
F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513
|
||||
P ecb1f2fd7b96797459287eaab95693ae17ec2079
|
||||
R 1584b834a23f13b852b265197c23db47
|
||||
U shess
|
||||
Z 3a97d1cfa72fc8326e11ebbeaf0b1200
|
||||
P 283385d20724f0144f38de89bd179715ee5e738b
|
||||
R 5393121f9f6ea7c588d140b3d91538be
|
||||
U drh
|
||||
Z f104f701ef9aaf65b7572ce40741f8c1
|
||||
|
@ -1 +1 @@
|
||||
283385d20724f0144f38de89bd179715ee5e738b
|
||||
2bd4b62a20219f939ac2ac22440dc7fc0449f766
|
13
src/delete.c
13
src/delete.c
@ -12,7 +12,7 @@
|
||||
** This file contains C code routines that are called by the parser
|
||||
** in order to generate code for DELETE FROM statements.
|
||||
**
|
||||
** $Id: delete.c,v 1.127 2006/06/19 03:05:10 danielk1977 Exp $
|
||||
** $Id: delete.c,v 1.128 2007/02/07 01:06:53 drh Exp $
|
||||
*/
|
||||
#include "sqliteInt.h"
|
||||
|
||||
@ -106,7 +106,8 @@ void sqlite3DeleteFrom(
|
||||
AuthContext sContext; /* Authorization context */
|
||||
int oldIdx = -1; /* Cursor for the OLD table of AFTER triggers */
|
||||
NameContext sNC; /* Name context to resolve expressions in */
|
||||
int iDb;
|
||||
int iDb; /* Database number */
|
||||
int memCnt = 0; /* Memory cell used for change counting */
|
||||
|
||||
#ifndef SQLITE_OMIT_TRIGGER
|
||||
int isView; /* True if attempting to delete from a view */
|
||||
@ -204,7 +205,8 @@ void sqlite3DeleteFrom(
|
||||
** we are counting rows.
|
||||
*/
|
||||
if( db->flags & SQLITE_CountRows ){
|
||||
sqlite3VdbeAddOp(v, OP_Integer, 0, 0);
|
||||
memCnt = pParse->nMem++;
|
||||
sqlite3VdbeAddOp(v, OP_MemInt, 0, memCnt);
|
||||
}
|
||||
|
||||
/* Special case: A DELETE without a WHERE clause deletes everything.
|
||||
@ -221,7 +223,7 @@ void sqlite3DeleteFrom(
|
||||
sqlite3OpenTable(pParse, iCur, iDb, pTab, OP_OpenRead);
|
||||
}
|
||||
sqlite3VdbeAddOp(v, OP_Rewind, iCur, sqlite3VdbeCurrentAddr(v)+2);
|
||||
addr2 = sqlite3VdbeAddOp(v, OP_AddImm, 1, 0);
|
||||
addr2 = sqlite3VdbeAddOp(v, OP_MemIncr, 1, memCnt);
|
||||
sqlite3VdbeAddOp(v, OP_Next, iCur, addr2);
|
||||
sqlite3VdbeResolveLabel(v, endOfLoop);
|
||||
sqlite3VdbeAddOp(v, OP_Close, iCur, 0);
|
||||
@ -251,7 +253,7 @@ void sqlite3DeleteFrom(
|
||||
sqlite3VdbeAddOp(v, IsVirtual(pTab) ? OP_VRowid : OP_Rowid, iCur, 0);
|
||||
sqlite3VdbeAddOp(v, OP_FifoWrite, 0, 0);
|
||||
if( db->flags & SQLITE_CountRows ){
|
||||
sqlite3VdbeAddOp(v, OP_AddImm, 1, 0);
|
||||
sqlite3VdbeAddOp(v, OP_MemIncr, 1, memCnt);
|
||||
}
|
||||
|
||||
/* End the database scan loop.
|
||||
@ -354,6 +356,7 @@ void sqlite3DeleteFrom(
|
||||
** invoke the callback function.
|
||||
*/
|
||||
if( db->flags & SQLITE_CountRows && pParse->nested==0 && !pParse->trigStack ){
|
||||
sqlite3VdbeAddOp(v, OP_MemLoad, memCnt, 0);
|
||||
sqlite3VdbeAddOp(v, OP_Callback, 1, 0);
|
||||
sqlite3VdbeSetNumCols(v, 1);
|
||||
sqlite3VdbeSetColName(v, 0, COLNAME_NAME, "rows deleted", P3_STATIC);
|
||||
|
@ -12,7 +12,7 @@
|
||||
** This file contains C code routines that are called by the parser
|
||||
** to handle UPDATE statements.
|
||||
**
|
||||
** $Id: update.c,v 1.133 2006/06/27 13:20:21 drh Exp $
|
||||
** $Id: update.c,v 1.134 2007/02/07 01:06:53 drh Exp $
|
||||
*/
|
||||
#include "sqliteInt.h"
|
||||
|
||||
@ -103,6 +103,7 @@ void sqlite3Update(
|
||||
AuthContext sContext; /* The authorization context */
|
||||
NameContext sNC; /* The name-context to resolve expressions in */
|
||||
int iDb; /* Database containing the table being updated */
|
||||
int memCnt = 0; /* Memory cell used for counting rows changed */
|
||||
|
||||
#ifndef SQLITE_OMIT_TRIGGER
|
||||
int isView; /* Trying to update a view */
|
||||
@ -311,7 +312,8 @@ void sqlite3Update(
|
||||
/* Initialize the count of updated rows
|
||||
*/
|
||||
if( db->flags & SQLITE_CountRows && !pParse->trigStack ){
|
||||
sqlite3VdbeAddOp(v, OP_Integer, 0, 0);
|
||||
memCnt = pParse->nMem++;
|
||||
sqlite3VdbeAddOp(v, OP_MemInt, 0, memCnt);
|
||||
}
|
||||
|
||||
if( triggers_exist ){
|
||||
@ -469,7 +471,7 @@ void sqlite3Update(
|
||||
/* Increment the row counter
|
||||
*/
|
||||
if( db->flags & SQLITE_CountRows && !pParse->trigStack){
|
||||
sqlite3VdbeAddOp(v, OP_AddImm, 1, 0);
|
||||
sqlite3VdbeAddOp(v, OP_MemIncr, 1, memCnt);
|
||||
}
|
||||
|
||||
/* If there are triggers, close all the cursors after each iteration
|
||||
@ -514,6 +516,7 @@ void sqlite3Update(
|
||||
** invoke the callback function.
|
||||
*/
|
||||
if( db->flags & SQLITE_CountRows && !pParse->trigStack && pParse->nested==0 ){
|
||||
sqlite3VdbeAddOp(v, OP_MemLoad, memCnt, 0);
|
||||
sqlite3VdbeAddOp(v, OP_Callback, 1, 0);
|
||||
sqlite3VdbeSetNumCols(v, 1);
|
||||
sqlite3VdbeSetColName(v, 0, COLNAME_NAME, "rows updated", P3_STATIC);
|
||||
|
Loading…
Reference in New Issue
Block a user