Remove an always-true test from delete.c. Move the sqlite3OpenTable()

routine from delete.c to insert.c since it is not used in delete.c. (CVS 6571)

FossilOrigin-Name: 71756dc870910665ef5fdbc7343bc3eedbe3ce65
This commit is contained in:
drh 2009-04-30 00:11:09 +00:00
parent a3628d14d7
commit bbb5e4e073
4 changed files with 33 additions and 35 deletions

View File

@ -1,5 +1,5 @@
C Fixed\scompile\sfor\sMSVC;\s\sremoved\scompiler\swarnings;\schanges\sfor\sNDEBUG\sbuild;\sminor\scode\stweaks.\s(CVS\s6570)
D 2009-04-29T18:12:00
C Remove\san\salways-true\stest\sfrom\sdelete.c.\s\sMove\sthe\ssqlite3OpenTable()\nroutine\sfrom\sdelete.c\sto\sinsert.c\ssince\sit\sis\snot\sused\sin\sdelete.c.\s(CVS\s6571)
D 2009-04-30T00:11:10
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
F Makefile.in 583e87706abc3026960ed759aff6371faf84c211
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@ -113,7 +113,7 @@ F src/build.c dca0ad77c88cb00f6a11cc080a4f3285672cfa37
F src/callback.c 73016376d6848ba987709e8c9048d4f0e0776036
F src/complete.c 5ad5c6cd4548211867c204c41a126d73a9fbcea0
F src/date.c d327ec7bb2f64b08d32b1035de82b9ba8675de91
F src/delete.c becfff86a6d1a3606b7215cd79e2e033e3a66225
F src/delete.c 5416059acea6e9f9798feb9588d474ec86bf7b3e
F src/expr.c dd763d6dc8f8329e895440d436c28aa7b5b3595e
F src/fault.c dc88c821842157460750d2d61a8a8b4197d047ff
F src/func.c f667fe886309707c7178542073bb0ced00a9fae7
@ -121,7 +121,7 @@ F src/global.c 448419c44ce0701104c2121b0e06919b44514c0c
F src/hash.c 0caea57f020226903cd8591125732e1e19f17f14
F src/hash.h 457e230c3b2bd3c56742824d43b16618ff30d7c0
F src/hwtime.h 4a1d45f4cae1f402ea19686acf24acf4f0cb53cb
F src/insert.c 71286d081a919a27ef22eaeccbe2718f93dc6aa9
F src/insert.c cdb0f64e53c3d84949b96d50090cc31646fc2857
F src/journal.c e00df0c0da8413ab6e1bb7d7cab5665d4a9000d0
F src/legacy.c 2ad5b52df322d0f132f66817095e0e79c8942611
F src/loadext.c 3f96631089fc4f3871a67f02f2e4fc7ea4d51edc
@ -725,7 +725,7 @@ F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81
F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
P 7ec42e989f1d4abdc6d52f8feebf51985f36b2bd
R 650f490b514ba52c11005770056d7df0
U shane
Z 14c530093810df3e24600cbed8dbd4c1
P e98b12425ff036b36165dfd2002e0530ca27a677
R a6d07a06b17de8ff7ad0ad9540ec3399
U drh
Z 6e17c819e35c23345cfca093c0739713

View File

@ -1 +1 @@
e98b12425ff036b36165dfd2002e0530ca27a677
71756dc870910665ef5fdbc7343bc3eedbe3ce65

View File

@ -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.199 2009/04/24 15:46:22 drh Exp $
** $Id: delete.c,v 1.200 2009/04/30 00:11:10 drh Exp $
*/
#include "sqliteInt.h"
@ -62,26 +62,6 @@ int sqlite3IsReadOnly(Parse *pParse, Table *pTab, int viewOk){
return 0;
}
/*
** Generate code that will open a table for reading.
*/
void sqlite3OpenTable(
Parse *p, /* Generate code into this VDBE */
int iCur, /* The cursor number of the table */
int iDb, /* The database index in sqlite3.aDb[] */
Table *pTab, /* The table to be opened */
int opcode /* OP_OpenRead or OP_OpenWrite */
){
Vdbe *v;
if( IsVirtual(pTab) ) return;
v = sqlite3GetVdbe(p);
assert( opcode==OP_OpenWrite || opcode==OP_OpenRead );
sqlite3TableLock(p, iDb, pTab->tnum, (opcode==OP_OpenWrite)?1:0, pTab->zName);
sqlite3VdbeAddOp3(v, opcode, iCur, pTab->tnum, iDb);
sqlite3VdbeChangeP4(v, -1, SQLITE_INT_TO_PTR(pTab->nCol), P4_INT32);
VdbeComment((v, "%s", pTab->zName));
}
#if !defined(SQLITE_OMIT_VIEW) && !defined(SQLITE_OMIT_TRIGGER)
/*
@ -377,10 +357,8 @@ void sqlite3DeleteFrom(
*/
if( rcauth==SQLITE_OK && pWhere==0 && !pTrigger && !IsVirtual(pTab) ){
assert( !isView );
sqlite3VdbeAddOp3(v, OP_Clear, pTab->tnum, iDb, memCnt);
if( !pParse->nested ){
sqlite3VdbeChangeP4(v, -1, pTab->zName, P4_STATIC);
}
sqlite3VdbeAddOp4(v, OP_Clear, pTab->tnum, iDb, memCnt,
pTab->zName, P4_STATIC);
for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
assert( pIdx->pSchema==pTab->pSchema );
sqlite3VdbeAddOp2(v, OP_Clear, pIdx->tnum, iDb);

View File

@ -12,10 +12,30 @@
** This file contains C code routines that are called by the parser
** to handle INSERT statements in SQLite.
**
** $Id: insert.c,v 1.260 2009/02/28 10:47:42 danielk1977 Exp $
** $Id: insert.c,v 1.261 2009/04/30 00:11:10 drh Exp $
*/
#include "sqliteInt.h"
/*
** Generate code that will open a table for reading.
*/
void sqlite3OpenTable(
Parse *p, /* Generate code into this VDBE */
int iCur, /* The cursor number of the table */
int iDb, /* The database index in sqlite3.aDb[] */
Table *pTab, /* The table to be opened */
int opcode /* OP_OpenRead or OP_OpenWrite */
){
Vdbe *v;
if( IsVirtual(pTab) ) return;
v = sqlite3GetVdbe(p);
assert( opcode==OP_OpenWrite || opcode==OP_OpenRead );
sqlite3TableLock(p, iDb, pTab->tnum, (opcode==OP_OpenWrite)?1:0, pTab->zName);
sqlite3VdbeAddOp3(v, opcode, iCur, pTab->tnum, iDb);
sqlite3VdbeChangeP4(v, -1, SQLITE_INT_TO_PTR(pTab->nCol), P4_INT32);
VdbeComment((v, "%s", pTab->zName));
}
/*
** Set P4 of the most recently inserted opcode to a column affinity
** string for index pIdx. A column affinity string has one character