Better testing of the ON CONFLICT logic. (CVS 358)

FossilOrigin-Name: 9bbddb8e013b47547164f71f2d7abd995f8d7385
This commit is contained in:
drh
2002-01-30 04:32:00 +00:00
parent bb37fdc782
commit ef6764a1d9
6 changed files with 645 additions and 20 deletions
+2 -6
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.39 2002/01/22 14:11:29 drh Exp $
** $Id: expr.c,v 1.40 2002/01/30 04:32:01 drh Exp $
*/
#include "sqliteInt.h"
@@ -573,16 +573,12 @@ void sqliteExprCode(Parse *pParse, Expr *pExpr){
}
break;
}
case TK_FLOAT:
case TK_INTEGER: {
sqliteVdbeAddOp(v, OP_String, 0, 0);
sqliteVdbeChangeP3(v, -1, pExpr->token.z, pExpr->token.n);
break;
}
case TK_FLOAT: {
int addr = sqliteVdbeAddOp(v, OP_String, 0, 0);
sqliteVdbeChangeP3(v, addr, pExpr->token.z, pExpr->token.n);
break;
}
case TK_STRING: {
int addr = sqliteVdbeAddOp(v, OP_String, 0, 0);
sqliteVdbeChangeP3(v, addr, pExpr->token.z, pExpr->token.n);
+5 -4
View File
@@ -12,7 +12,7 @@
** This file contains C code routines that are called by the parser
** to handle INSERT statements in SQLite.
**
** $Id: insert.c,v 1.36 2002/01/30 00:54:56 drh Exp $
** $Id: insert.c,v 1.37 2002/01/30 04:32:01 drh Exp $
*/
#include "sqliteInt.h"
@@ -409,8 +409,8 @@ void sqliteGenerateConstraintChecks(
if( onError==OE_Replace && pTab->aCol[i].zDflt==0 ){
onError = OE_Abort;
}
addr = sqliteVdbeAddOp(v, OP_Dup, nCol-i, 1);
sqliteVdbeAddOp(v, OP_NotNull, 0, addr+1+(onError!=OE_Abort));
sqliteVdbeAddOp(v, OP_Dup, nCol-1-i, 1);
addr = sqliteVdbeAddOp(v, OP_NotNull, 0, 0);
switch( onError ){
case OE_Abort: {
sqliteVdbeAddOp(v, OP_Halt, SQLITE_CONSTRAINT, 0);
@@ -429,6 +429,7 @@ void sqliteGenerateConstraintChecks(
}
default: assert(0);
}
sqliteVdbeChangeP2(v, addr, sqliteVdbeCurrentAddr(v));
}
/* Test all CHECK constraints
@@ -498,7 +499,7 @@ void sqliteGenerateConstraintChecks(
case OE_Replace: {
sqliteGenerateRowDelete(v, pTab, base);
if( isUpdate ){
sqliteVdbeAddOp(v, OP_Dup, nCol+extra+recnoChng, 1);
sqliteVdbeAddOp(v, OP_Dup, nCol+extra+1+recnoChng, 1);
sqliteVdbeAddOp(v, OP_MoveTo, base, 0);
}
seenReplace = 1;