1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-06 15:49:35 +03:00

Get rid of the special RowSet processing in where.c and move that into

clients.  Added the WHERE_DUPLICATES_OK option to eliminate an unnecessary
RowSet during DELETE with a WHERE clause containing ORs. (CVS 6546)

FossilOrigin-Name: 98606bee9e41b8969fb639fc43864e230185ca43
This commit is contained in:
drh
2009-04-24 15:46:21 +00:00
parent 46619d6787
commit 336a5300de
7 changed files with 58 additions and 94 deletions

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.198 2009/03/05 03:48:07 shane Exp $
** $Id: delete.c,v 1.199 2009/04/24 15:46:22 drh Exp $
*/
#include "sqliteInt.h"
@@ -393,13 +393,15 @@ void sqlite3DeleteFrom(
{
int iRowid = ++pParse->nMem; /* Used for storing rowid values. */
int iRowSet = ++pParse->nMem; /* Register for rowset of rows to delete */
int regRowid; /* Actual register containing rowids */
/* Collect rowids of every row to be deleted.
*/
sqlite3VdbeAddOp2(v, OP_Null, 0, iRowSet);
pWInfo = sqlite3WhereBegin(pParse, pTabList, pWhere, 0,
WHERE_FILL_ROWSET, iRowSet);
pWInfo = sqlite3WhereBegin(pParse, pTabList, pWhere,0,WHERE_DUPLICATES_OK);
if( pWInfo==0 ) goto delete_from_cleanup;
regRowid = sqlite3ExprCodeGetColumn(pParse, pTab, -1, iCur, iRowid, 0);
sqlite3VdbeAddOp2(v, OP_RowSetAdd, iRowSet, regRowid);
if( db->flags & SQLITE_CountRows ){
sqlite3VdbeAddOp2(v, OP_AddImm, memCnt, 1);
}