/ Check-in [2c54aba5]
Login
SQLite training in Houston TX on 2019-11-05 (details)
Part of the 2019 Tcl Conference

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

Overview
Comment:Propagate detected database corruption up through the call stack. (CVS 2279)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 2c54aba5ba781f4da1f14ed7a3986b6dc17728d7
User & Date: drh 2005-01-26 21:55:32
Context
2005-01-27
00:22
Have REINDEX handle missing collation sequences correctly. (CVS 2280) check-in: 1c1904f4 user: danielk1977 tags: trunk
2005-01-26
21:55
Propagate detected database corruption up through the call stack. (CVS 2279) check-in: 2c54aba5 user: drh tags: trunk
17:47
An optimization to sqlite3VdbeSerialType(). (CVS 2278) check-in: db367738 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/vdbe.c.

    39     39   **
    40     40   ** Various scripts scan this source file in order to generate HTML
    41     41   ** documentation, headers files, or other derived files.  The formatting
    42     42   ** of the code in this file is, therefore, important.  See other comments
    43     43   ** in this file for details.  If in doubt, do not deviate from existing
    44     44   ** commenting and indentation practices when changing or adding code.
    45     45   **
    46         -** $Id: vdbe.c,v 1.446 2005/01/24 10:25:59 danielk1977 Exp $
           46  +** $Id: vdbe.c,v 1.447 2005/01/26 21:55:32 drh Exp $
    47     47   */
    48     48   #include "sqliteInt.h"
    49     49   #include "os.h"
    50     50   #include <ctype.h>
    51     51   #include "vdbeInt.h"
    52     52   
    53     53   /*
................................................................................
  1734   1734       zRec = pRec->z;
  1735   1735       assert( pCnt>=p->aStack );
  1736   1736       assert( pCnt->flags & MEM_Int );
  1737   1737       nField = pCnt->i;
  1738   1738       pCrsr = 0;
  1739   1739     }else if( (pC = p->apCsr[p1])->pCursor!=0 ){
  1740   1740       /* The record is stored in a B-Tree */
  1741         -    sqlite3VdbeCursorMoveto(pC);
         1741  +    rc = sqlite3VdbeCursorMoveto(pC);
         1742  +    if ( rc ) return rc;
  1742   1743       zRec = 0;
  1743   1744       pCrsr = pC->pCursor;
  1744   1745       if( pC->nullRow ){
  1745   1746         payloadSize = 0;
  1746   1747       }else if( pC->cacheValid ){
  1747   1748         payloadSize = pC->payloadSize;
  1748   1749         zRec = pC->aRow;
................................................................................
  3079   3080   case OP_Delete: {
  3080   3081     int i = pOp->p1;
  3081   3082     Cursor *pC;
  3082   3083     assert( i>=0 && i<p->nCursor );
  3083   3084     pC = p->apCsr[i];
  3084   3085     assert( pC!=0 );
  3085   3086     if( pC->pCursor!=0 ){
  3086         -    sqlite3VdbeCursorMoveto(pC);
         3087  +    rc = sqlite3VdbeCursorMoveto(pC);
         3088  +    if ( rc ) return rc;
  3087   3089       rc = sqlite3BtreeDelete(pC->pCursor);
  3088   3090       pC->nextRowidValid = 0;
  3089   3091       pC->cacheValid = 0;
  3090   3092     }
  3091   3093     if( pOp->p2 & OPFLAG_NCHANGE ) p->nChange++;
  3092   3094     break;
  3093   3095   }
................................................................................
  3152   3154     assert( i>=0 && i<p->nCursor );
  3153   3155     pC = p->apCsr[i];
  3154   3156     assert( pC!=0 );
  3155   3157     if( pC->nullRow ){
  3156   3158       pTos->flags = MEM_Null;
  3157   3159     }else if( pC->pCursor!=0 ){
  3158   3160       BtCursor *pCrsr = pC->pCursor;
  3159         -    sqlite3VdbeCursorMoveto(pC);
         3161  +    rc = sqlite3VdbeCursorMoveto(pC);
         3162  +    if ( rc ) return rc;
  3160   3163       if( pC->nullRow ){
  3161   3164         pTos->flags = MEM_Null;
  3162   3165         break;
  3163   3166       }else if( pC->keyAsData || pOp->opcode==OP_RowKey ){
  3164   3167         i64 n64;
  3165   3168         assert( !pC->intKey );
  3166   3169         sqlite3BtreeKeySize(pCrsr, &n64);
................................................................................
  3207   3210     int i = pOp->p1;
  3208   3211     Cursor *pC;
  3209   3212     i64 v;
  3210   3213   
  3211   3214     assert( i>=0 && i<p->nCursor );
  3212   3215     pC = p->apCsr[i];
  3213   3216     assert( pC!=0 );
  3214         -  sqlite3VdbeCursorMoveto(pC);
         3217  +  rc = sqlite3VdbeCursorMoveto(pC);
         3218  +  if ( rc ) return rc;
  3215   3219     pTos++;
  3216   3220     if( pC->recnoIsValid ){
  3217   3221       v = pC->lastRecno;
  3218   3222     }else if( pC->pseudoTable ){
  3219   3223       v = keyToInt(pC->iKey);
  3220   3224     }else if( pC->nullRow || pC->pCursor==0 ){
  3221   3225       pTos->flags = MEM_Null;
................................................................................
  3253   3257     assert( !p->apCsr[i]->pseudoTable );
  3254   3258     pTos++;
  3255   3259     pTos->flags = MEM_Null;
  3256   3260     if( (pCrsr = (pC = p->apCsr[i])->pCursor)!=0 ){
  3257   3261       i64 amt;
  3258   3262       char *z;
  3259   3263   
  3260         -    sqlite3VdbeCursorMoveto(pC);
         3264  +    rc = sqlite3VdbeCursorMoveto(pC);
         3265  +    if ( rc ) return rc;
  3261   3266       assert( pC->intKey==0 );
  3262   3267       sqlite3BtreeKeySize(pCrsr, &amt);
  3263   3268       if( amt<=0 ){
  3264   3269         rc = SQLITE_CORRUPT;
  3265   3270         goto abort_due_to_error;
  3266   3271       }
  3267   3272       if( amt>NBFS ){

Changes to src/vdbeaux.c.

  1424   1424   /*
  1425   1425   ** If a MoveTo operation is pending on the given cursor, then do that
  1426   1426   ** MoveTo now.  Return an error code.  If no MoveTo is pending, this
  1427   1427   ** routine does nothing and returns SQLITE_OK.
  1428   1428   */
  1429   1429   int sqlite3VdbeCursorMoveto(Cursor *p){
  1430   1430     if( p->deferredMoveto ){
  1431         -    int res;
         1431  +    int res, rc;
  1432   1432       extern int sqlite3_search_count;
  1433   1433       assert( p->intKey );
  1434   1434       if( p->intKey ){
  1435         -      sqlite3BtreeMoveto(p->pCursor, 0, p->movetoTarget, &res);
         1435  +      rc = sqlite3BtreeMoveto(p->pCursor, 0, p->movetoTarget, &res);
  1436   1436       }else{
  1437         -      sqlite3BtreeMoveto(p->pCursor,(char*)&p->movetoTarget,sizeof(i64),&res);
         1437  +      rc = sqlite3BtreeMoveto(p->pCursor,(char*)&p->movetoTarget,
         1438  +                              sizeof(i64),&res);
  1438   1439       }
         1440  +    if( rc ) return rc;
  1439   1441       *p->pIncrKey = 0;
  1440   1442       p->lastRecno = keyToInt(p->movetoTarget);
  1441   1443       p->recnoIsValid = res==0;
  1442   1444       if( res<0 ){
  1443         -      sqlite3BtreeNext(p->pCursor, &res);
         1445  +      rc = sqlite3BtreeNext(p->pCursor, &res);
         1446  +      if( rc ) return rc;
  1444   1447       }
  1445   1448       sqlite3_search_count++;
  1446   1449       p->deferredMoveto = 0;
  1447   1450       p->cacheValid = 0;
  1448   1451     }
  1449   1452     return SQLITE_OK;
  1450   1453   }