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

Get triggers working on tables with INTEGER PRIMARY KEYs. Ticket #291.

This may also fix #159.  Still need to add tests so both bugs remain open
for the time being. (CVS 908)

FossilOrigin-Name: 0b996959b8d8bc2c82eab9cccc190befd0056505
This commit is contained in:
drh
2003-04-15 19:22:22 +00:00
parent 048bd5937b
commit 70ce3f0c58
14 changed files with 333 additions and 145 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.91 2003/03/31 02:12:47 drh Exp $
** $Id: expr.c,v 1.92 2003/04/15 19:22:23 drh Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
@@ -547,12 +547,8 @@ int sqliteExprResolveIds(
if( sqliteStrICmp(pTab->aCol[j].zName, zRight)==0 ){
cnt++;
pExpr->iTable = i + base;
if( j==pTab->iPKey ){
/* Substitute the record number for the INTEGER PRIMARY KEY */
pExpr->iColumn = -1;
}else{
pExpr->iColumn = j;
}
/* Substitute the rowid (column -1) for the INTEGER PRIMARY KEY */
pExpr->iColumn = j==pTab->iPKey ? -1 : j;
pExpr->dataType = pTab->aCol[j].sortOrder & SQLITE_SO_TYPEMASK;
}
}
@@ -580,7 +576,7 @@ int sqliteExprResolveIds(
for(j=0; j < pTab->nCol; j++) {
if( sqliteStrICmp(pTab->aCol[j].zName, zRight)==0 ){
cnt++;
pExpr->iColumn = j;
pExpr->iColumn = j==pTab->iPKey ? -1 : j;
pExpr->dataType = pTab->aCol[j].sortOrder & SQLITE_SO_TYPEMASK;
}
}