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

Support for a future ALTER TABLE command to add columns with default values. (CVS 2367)

FossilOrigin-Name: 9d5abc1ddf6da37563c12d5a0401b89bb4e51c59
This commit is contained in:
danielk1977
2005-03-09 12:26:50 +00:00
parent 97ba4c94fc
commit aee18ef8e2
15 changed files with 326 additions and 47 deletions

View File

@@ -12,7 +12,7 @@
** This file contains routines used for analyzing expressions and
** for generating VDBE code that evaluates expressions in SQLite.
**
** $Id: expr.c,v 1.194 2005/02/12 08:59:57 danielk1977 Exp $
** $Id: expr.c,v 1.195 2005/03/09 12:26:51 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
@@ -403,6 +403,7 @@ Expr *sqlite3ExprDup(Expr *p){
pNew->pRight = sqlite3ExprDup(p->pRight);
pNew->pList = sqlite3ExprListDup(p->pList);
pNew->pSelect = sqlite3SelectDup(p->pSelect);
pNew->pTab = p->pTab;
return pNew;
}
void sqlite3TokenCopy(Token *pTo, Token *pFrom){
@@ -847,6 +848,7 @@ static int lookupName(
pExpr->iColumn = j==pTab->iPKey ? -1 : j;
pExpr->affinity = pTab->aCol[j].affinity;
pExpr->pColl = pTab->aCol[j].pColl;
pExpr->pTab = pTab;
break;
}
}
@@ -958,6 +960,9 @@ static int lookupName(
if( cnt==1 ){
assert( pNC!=0 );
sqlite3AuthRead(pParse, pExpr, pNC->pSrcList);
if( pMatch && !pMatch->pSelect ){
pExpr->pTab = pMatch->pTab;
}
}
return cnt!=1;
}
@@ -1385,11 +1390,7 @@ void sqlite3ExprCode(Parse *pParse, Expr *pExpr){
sqlite3VdbeAddOp(v, OP_AggGet, pExpr->iAggCtx, pExpr->iAgg);
}else if( pExpr->iColumn>=0 ){
sqlite3VdbeAddOp(v, OP_Column, pExpr->iTable, pExpr->iColumn);
#ifndef NDEBUG
if( pExpr->span.z && pExpr->span.n>0 && pExpr->span.n<100 ){
VdbeComment((v, "# %T", &pExpr->span));
}
#endif
sqlite3ColumnDefault(v, pExpr->pTab, pExpr->iColumn);
}else{
sqlite3VdbeAddOp(v, OP_Recno, pExpr->iTable, 0);
}