1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-14 00:22:38 +03:00

Fix a VDBE stack leak in LEFT OUTER JOIN. Fix a bug in the code generator

for JOIN ... USING(...). (CVS 638)

FossilOrigin-Name: d861489e1f7dffd1105c271fe8597f73e5b1703c
This commit is contained in:
drh
2002-06-24 12:20:23 +00:00
parent f46f905a1e
commit bf5cd97ed7
4 changed files with 17 additions and 17 deletions

View File

@@ -12,7 +12,7 @@
** This file contains C code routines that are called by the parser
** to handle SELECT statements in SQLite.
**
** $Id: select.c,v 1.97 2002/06/22 02:33:38 drh Exp $
** $Id: select.c,v 1.98 2002/06/24 12:20:23 drh Exp $
*/
#include "sqliteInt.h"
@@ -244,14 +244,14 @@ static int sqliteProcessJoin(Parse *pParse, Select *p){
assert( i<pSrc->nSrc-1 );
pList = pTerm->pUsing;
for(j=0; j<pList->nId; j++){
if( columnIndex(pTerm->pTab, pList->a[i].zName)<0 ||
columnIndex(pOther->pTab, pList->a[i].zName)<0 ){
if( columnIndex(pTerm->pTab, pList->a[j].zName)<0 ||
columnIndex(pOther->pTab, pList->a[j].zName)<0 ){
sqliteSetString(&pParse->zErrMsg, "cannot join using column ",
pList->a[i].zName, " - column not present in both tables", 0);
pList->a[j].zName, " - column not present in both tables", 0);
pParse->nErr++;
return 1;
}
addWhereTerm(pList->a[i].zName, pTerm->pTab, pOther->pTab, &p->pWhere);
addWhereTerm(pList->a[j].zName, pTerm->pTab, pOther->pTab, &p->pWhere);
}
}
}
@@ -1745,14 +1745,14 @@ int sqliteSelect(
}else{
int iMem = pParse->nMem++;
sqliteVdbeAddOp(v, OP_Integer, -p->nLimit, 0);
sqliteVdbeAddOp(v, OP_MemStore, iMem, 0);
sqliteVdbeAddOp(v, OP_MemStore, iMem, 1);
p->nLimit = iMem;
if( p->nOffset<=0 ){
p->nOffset = 0;
}else{
iMem = pParse->nMem++;
sqliteVdbeAddOp(v, OP_Integer, -p->nOffset, 0);
sqliteVdbeAddOp(v, OP_MemStore, iMem, 0);
sqliteVdbeAddOp(v, OP_MemStore, iMem, 1);
p->nOffset = iMem;
}
}