1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-08 14:02:16 +03:00

Make sure the update hook is not invoked for WITHOUT ROWID tables, as

the documentation specifies.  This bug was found while adding requirements
marks, so a few extraneous requirements marks are included in this
check-in.

FossilOrigin-Name: 0978bac6b8aee229d7a0d148546f50d380d06a06
This commit is contained in:
drh
2013-11-26 23:27:07 +00:00
parent 2c7e9bfc50
commit bbbb0e8053
6 changed files with 39 additions and 22 deletions

View File

@@ -4109,20 +4109,11 @@ case OP_Delete: {
i64 iKey;
VdbeCursor *pC;
iKey = 0;
assert( pOp->p1>=0 && pOp->p1<p->nCursor );
pC = p->apCsr[pOp->p1];
assert( pC!=0 );
assert( pC->pCursor!=0 ); /* Only valid for real tables, no pseudotables */
/* If the update-hook will be invoked, set iKey to the rowid of the
** row being deleted.
*/
if( db->xUpdateCallback && pOp->p4.z ){
assert( pC->isTable );
assert( pC->rowidIsValid ); /* lastRowid set by previous OP_NotFound */
iKey = pC->lastRowid;
}
iKey = pC->lastRowid; /* Only used for the update hook */
/* The OP_Delete opcode always follows an OP_NotExists or OP_Last or
** OP_Column on the same table without any intervening operations that
@@ -4140,7 +4131,7 @@ case OP_Delete: {
pC->cacheStatus = CACHE_STALE;
/* Invoke the update-hook if required. */
if( rc==SQLITE_OK && db->xUpdateCallback && pOp->p4.z ){
if( rc==SQLITE_OK && db->xUpdateCallback && pOp->p4.z && pC->isTable ){
const char *zDb = db->aDb[pC->iDb].zName;
const char *zTbl = pOp->p4.z;
db->xUpdateCallback(db->pUpdateArg, SQLITE_DELETE, zDb, zTbl, iKey);