/ Check-in [3bed599e]
Login

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

Overview
Comment:Improved VDBE comments on the constraint checker. Fix a missing write lock in the UPDATE logic.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | omit-rowid
Files: files | file ages | folders
SHA1: 3bed599e74d354bf1513e4fb0e8665376ba44d0b
User & Date: drh 2013-11-01 14:03:20
Context
2013-11-01
17:08
Change the interface to sqlite3GenerateConstraintChecks() for improved lucidity and to fix issues in dealing with UPDATEs for WITHOUT ROWID tables. Make sure iDataCur and iIdxCur are initialized when processing DELETEs of a VIEW. UPDATE processing distinguishes between changes to ROWID and PRIMARY KEY. check-in: c525ac56 user: drh tags: omit-rowid
14:03
Improved VDBE comments on the constraint checker. Fix a missing write lock in the UPDATE logic. check-in: 3bed599e user: drh tags: omit-rowid
12:42
Some UPDATE statements now working in WITHOUT ROWID tables. check-in: 5c0eaea6 user: drh tags: omit-rowid
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/insert.c.

  1431   1431       }
  1432   1432   
  1433   1433       /* Create a record for this index entry as it should appear after
  1434   1434       ** the insert or update. */
  1435   1435       regIdx = sqlite3GetTempRange(pParse, pIdx->nColumn);
  1436   1436       for(i=0; i<pIdx->nColumn; i++){
  1437   1437         int iField = pIdx->aiColumn[i];
         1438  +      int x;
  1438   1439         if( iField<0 || iField==pTab->iPKey ){
  1439         -        iField = regNewData;
         1440  +        x = regNewData;
  1440   1441         }else{
  1441         -        iField += regNewData + 1;
         1442  +        x = iField + regNewData + 1;
  1442   1443         }
  1443         -      sqlite3VdbeAddOp2(v, OP_SCopy, iField, regIdx+i);
         1444  +      sqlite3VdbeAddOp2(v, OP_SCopy, x, regIdx+i);
         1445  +      VdbeComment((v, "%s", iField<0 ? "rowid" : pTab->aCol[iField].zName));
  1444   1446       }
  1445   1447       sqlite3VdbeAddOp3(v, OP_MakeRecord, regIdx, pIdx->nColumn, aRegIdx[ix]);
  1446   1448       sqlite3VdbeChangeP4(v, -1, sqlite3IndexAffinityStr(v, pIdx), P4_TRANSIENT);
  1447   1449       VdbeComment((v, "for %s", pIdx->zName));
  1448   1450       sqlite3ExprCacheAffinityChange(pParse, regIdx, pIdx->nColumn);
  1449   1451   
  1450   1452       /* Find out what action to take in case there is a uniqueness conflict */

Changes to src/update.c.

   383    383       ** index could potentially invoke a REPLACE conflict resolution 
   384    384       ** action, then we need to open all indices because we might need
   385    385       ** to be deleting some records.
   386    386       */
   387    387       if( !okOnePass && HasRowid(pTab) ){
   388    388         sqlite3OpenTable(pParse, iDataCur, iDb, pTab, OP_OpenWrite); 
   389    389       }
          390  +    sqlite3TableLock(pParse, iDb, pTab->tnum, 1, pTab->zName);
   390    391       if( onError==OE_Replace ){
   391    392         openAll = 1;
   392    393       }else{
   393    394         openAll = 0;
   394    395         for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
   395    396           if( pIdx->onError==OE_Replace ){
   396    397             openAll = 1;