SQLite

Check-in [5caa4a2b05]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Add a missing OP_Close opcode to VDBE programs that check for FK constraint violations.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 5caa4a2b050d5743b1407485cf419aa36cf16ac6
User & Date: dan 2009-10-07 16:04:47.000
Context
2009-10-07
18:41
Add some tests of statements in foreignkeys.html. (check-in: 8382867956 user: dan tags: trunk)
16:04
Add a missing OP_Close opcode to VDBE programs that check for FK constraint violations. (check-in: 5caa4a2b05 user: dan tags: trunk)
11:29
Update the header comment for sqlite3_blob_open to note that it is not possible to write to a column that is indexed, part of a primary key or, if foreign key support is enabled, part of a foreign key. (check-in: 2fd487fdb6 user: dan tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/fkey.c.
419
420
421
422
423
424
425

426
427
428
429
430
431
432
    if( nIncr>0 && pFKey->isDeferred==0 ){
      sqlite3ParseToplevel(pParse)->mayAbort = 1;
    }
    sqlite3VdbeAddOp2(v, OP_FkCounter, pFKey->isDeferred, nIncr);
  }

  sqlite3VdbeResolveLabel(v, iOk);

}

/*
** This function is called to generate code executed when a row is deleted
** from the parent table of foreign key constraint pFKey and, if pFKey is 
** deferred, when a row is inserted into the same table. When generating
** code for an SQL UPDATE operation, this function may be called twice -







>







419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
    if( nIncr>0 && pFKey->isDeferred==0 ){
      sqlite3ParseToplevel(pParse)->mayAbort = 1;
    }
    sqlite3VdbeAddOp2(v, OP_FkCounter, pFKey->isDeferred, nIncr);
  }

  sqlite3VdbeResolveLabel(v, iOk);
  sqlite3VdbeAddOp1(v, OP_Close, iCur);
}

/*
** This function is called to generate code executed when a row is deleted
** from the parent table of foreign key constraint pFKey and, if pFKey is 
** deferred, when a row is inserted into the same table. When generating
** code for an SQL UPDATE operation, this function may be called twice -