/ Check-in [ce554a39]
Login

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

Overview
Comment:Use sqlite3FkOldmask() in delete.c instead of assuming that foreign key constraints always require all columns of the deleted row to be stored in registers.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: ce554a393401fc2fb9b5be049ddd383070102934
User & Date: dan 2009-09-24 10:42:10
Context
2009-09-24
11:31
Ensure foreign key related processing takes place when rows are deleted from the database by REPLACE conflict handling. check-in: 3f40c142 user: dan tags: trunk
10:42
Use sqlite3FkOldmask() in delete.c instead of assuming that foreign key constraints always require all columns of the deleted row to be stored in registers. check-in: ce554a39 user: dan tags: trunk
09:05
Remove unused parameter from sqlite3CodeRowTrigger(). Fix header comments for this function and CodeRowTriggerDirect(). check-in: 0443f7c9 user: dan tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/delete.c.

   495    495     if( sqlite3FkRequired(pParse, pTab, 0) || pTrigger ){
   496    496       u32 mask;                     /* Mask of OLD.* columns in use */
   497    497       int iCol;                     /* Iterator used while populating OLD.* */
   498    498   
   499    499       /* TODO: Could use temporary registers here. Also could attempt to
   500    500       ** avoid copying the contents of the rowid register.  */
   501    501       mask = sqlite3TriggerOldmask(pParse, pTrigger, 0, pTab, onconf);
          502  +    mask |= sqlite3FkOldmask(pParse, pTab, 0);
   502    503       iOld = pParse->nMem+1;
   503    504       pParse->nMem += (1 + pTab->nCol);
   504    505   
   505    506       /* Populate the OLD.* pseudo-table register array. These values will be 
   506    507       ** used by any BEFORE and AFTER triggers that exist.  */
   507    508       sqlite3VdbeAddOp2(v, OP_Copy, iRowid, iOld);
   508    509       for(iCol=0; iCol<pTab->nCol; iCol++){
   509         -      if( 1 || mask==0xffffffff || mask&(1<<iCol) ){
          510  +      if( mask==0xffffffff || mask&(1<<iCol) ){
   510    511           int iTarget = iOld + iCol + 1;
   511    512           sqlite3VdbeAddOp3(v, OP_Column, iCur, iCol, iTarget);
   512    513           sqlite3ColumnDefault(v, pTab, iCol, iTarget);
   513    514         }
   514    515       }
   515    516   
   516    517       /* Invoke BEFORE DELETE trigger programs. */