/ Check-in [28d1eb40]
Login

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

Overview
Comment:Changes to facilitate full test coverage.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 28d1eb40bfc4c993010ce670ee10780ca2ae5c9c
User & Date: drh 2012-10-08 23:25:07
Context
2012-10-09
01:23
Replace an always-false conditional with an assert(). check-in: 981b9943 user: drh tags: trunk
2012-10-08
23:25
Changes to facilitate full test coverage. check-in: 28d1eb40 user: drh tags: trunk
21:51
Merge ORDER BY optimization refactoring and repair into trunk. check-in: c027a9af user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/build.c.

  2573   2573           sqlite3FixSrcList(&sFix, pTblName)
  2574   2574       ){
  2575   2575         /* Because the parser constructs pTblName from a single identifier,
  2576   2576         ** sqlite3FixSrcList can never fail. */
  2577   2577         assert(0);
  2578   2578       }
  2579   2579       pTab = sqlite3LocateTableItem(pParse, 0, &pTblName->a[0]);
  2580         -    if( !pTab || db->mallocFailed ) goto exit_create_index;
         2580  +    assert( db->mallocFailed==0 || pTab==0 );
         2581  +    if( pTab==0 ) goto exit_create_index;
  2581   2582       assert( db->aDb[iDb].pSchema==pTab->pSchema );
  2582   2583     }else{
  2583   2584       assert( pName==0 );
  2584   2585       assert( pStart==0 );
  2585   2586       pTab = pParse->pNewTable;
  2586   2587       if( !pTab ) goto exit_create_index;
  2587   2588       iDb = sqlite3SchemaToIndex(db, pTab->pSchema);

Changes to src/insert.c.

  1271   1271     if( pTab->pCheck && (db->flags & SQLITE_IgnoreChecks)==0 ){
  1272   1272       ExprList *pCheck = pTab->pCheck;
  1273   1273       pParse->ckBase = regData;
  1274   1274       onError = overrideError!=OE_Default ? overrideError : OE_Abort;
  1275   1275       for(i=0; i<pCheck->nExpr; i++){
  1276   1276         int allOk = sqlite3VdbeMakeLabel(v);
  1277   1277         Expr *pDup = sqlite3ExprDup(db, pCheck->a[i].pExpr, 0);
  1278         -      if( pDup==0 ) break;
  1279         -      sqlite3ExprIfTrue(pParse, pDup, allOk, SQLITE_JUMPIFNULL);
  1280         -      if( onError==OE_Ignore ){
  1281         -        sqlite3VdbeAddOp2(v, OP_Goto, 0, ignoreDest);
  1282         -      }else{
  1283         -        char *zConsName = pCheck->a[i].zName;
  1284         -        if( onError==OE_Replace ) onError = OE_Abort; /* IMP: R-15569-63625 */
  1285         -        if( zConsName ){
  1286         -          zConsName = sqlite3MPrintf(db, "constraint %s failed", zConsName);
         1278  +      if( !db->mallocFailed ){
         1279  +        assert( pDup!=0 );
         1280  +        sqlite3ExprIfTrue(pParse, pDup, allOk, SQLITE_JUMPIFNULL);
         1281  +        if( onError==OE_Ignore ){
         1282  +          sqlite3VdbeAddOp2(v, OP_Goto, 0, ignoreDest);
  1287   1283           }else{
  1288         -          zConsName = 0;
         1284  +          char *zConsName = pCheck->a[i].zName;
         1285  +          if( onError==OE_Replace ) onError = OE_Abort; /* IMP: R-15569-63625 */
         1286  +          if( zConsName ){
         1287  +            zConsName = sqlite3MPrintf(db, "constraint %s failed", zConsName);
         1288  +          }else{
         1289  +            zConsName = 0;
         1290  +          }
         1291  +          sqlite3HaltConstraint(pParse, onError, zConsName, P4_DYNAMIC);
  1289   1292           }
  1290         -        sqlite3HaltConstraint(pParse, onError, zConsName, P4_DYNAMIC);
         1293  +        sqlite3VdbeResolveLabel(v, allOk);
  1291   1294         }
  1292         -      sqlite3VdbeResolveLabel(v, allOk);
  1293   1295         sqlite3ExprDelete(db, pDup);
  1294   1296       }
  1295   1297     }
  1296   1298   #endif /* !defined(SQLITE_OMIT_CHECK) */
  1297   1299   
  1298   1300     /* If we have an INTEGER PRIMARY KEY, make sure the primary key
  1299   1301     ** of the new record does not previously exist.  Except, if this