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

Allow INDEXED BY and NOT INDEXED to be used in UPDATE and DELETE statements. (CVS 5772)

FossilOrigin-Name: 83a7e446b2d4846a6f92bd831a2adaa265f5a786
This commit is contained in:
danielk1977
2008-10-06 16:18:39 +00:00
parent 6ef7f85801
commit b1c685b0c8
8 changed files with 131 additions and 56 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.176 2008/10/06 05:32:19 danielk1977 Exp $
** $Id: delete.c,v 1.177 2008/10/06 16:18:40 danielk1977 Exp $
*/
#include "sqliteInt.h"
@@ -22,16 +22,17 @@
** are found, return a pointer to the last table.
*/
Table *sqlite3SrcListLookup(Parse *pParse, SrcList *pSrc){
Table *pTab = 0;
int i;
struct SrcList_item *pItem;
for(i=0, pItem=pSrc->a; i<pSrc->nSrc; i++, pItem++){
pTab = sqlite3LocateTable(pParse, 0, pItem->zName, pItem->zDatabase);
sqlite3DeleteTable(pItem->pTab);
pItem->pTab = pTab;
if( pTab ){
pTab->nRef++;
}
struct SrcList_item *pItem = pSrc->a;
Table *pTab;
assert( pItem && pSrc->nSrc==1 );
pTab = sqlite3LocateTable(pParse, 0, pItem->zName, pItem->zDatabase);
sqlite3DeleteTable(pItem->pTab);
pItem->pTab = pTab;
if( pTab ){
pTab->nRef++;
}
if( sqlite3IndexedByLookup(pParse, pItem) ){
pTab = 0;
}
return pTab;
}
@@ -106,7 +107,7 @@ void sqlite3MaterializeView(
pWhere = sqlite3ExprDup(db, pWhere);
viewName.z = (u8*)pView->zName;
viewName.n = (unsigned int)strlen((const char*)viewName.z);
pFrom = sqlite3SrcListAppendFromTerm(pParse, 0, 0, 0, &viewName,0,pDup,0,0);
pFrom = sqlite3SrcListAppendFromTerm(pParse, 0, 0, 0, &viewName, pDup, 0,0);
pDup = sqlite3SelectNew(pParse, 0, pFrom, pWhere, 0, 0, 0, 0, 0, 0);
}
sqlite3SelectDestInit(&dest, SRT_EphemTab, iCur);