/ Check-in [a2914d6b]
Login

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

Overview
Comment:Merge in trunk changes.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | sessions
Files: files | file ages | folders
SHA1: a2914d6b17358de05eb39f764c0c13d2d4cf8f3b
User & Date: drh 2013-12-03 20:51:33
Context
2013-12-06
15:49
Update to the 3.8.2 release. check-in: e579661a user: drh tags: sessions
2013-12-03
20:51
Merge in trunk changes. check-in: a2914d6b user: drh tags: sessions
19:49
Remove a branch in STAT4 logic that is no longer reachable after the previous change. check-in: eca7d3f1 user: drh tags: trunk
2013-12-02
21:58
Merge all recent 3.8.2 beta changes from trunk. check-in: 67c34ccf user: drh tags: sessions
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/build.c.

  2786   2786     Db *pDb;             /* The specific table containing the indexed database */
  2787   2787     int iDb;             /* Index of the database that is being written */
  2788   2788     Token *pName = 0;    /* Unqualified name of the index to create */
  2789   2789     struct ExprList_item *pListItem; /* For looping over pList */
  2790   2790     const Column *pTabCol;           /* A column in the table */
  2791   2791     int nExtra = 0;                  /* Space allocated for zExtra[] */
  2792   2792     int nExtraCol;                   /* Number of extra columns needed */
  2793         -  char *zExtra;                    /* Extra space after the Index object */
         2793  +  char *zExtra = 0;                /* Extra space after the Index object */
  2794   2794     Index *pPk = 0;      /* PRIMARY KEY index for WITHOUT ROWID tables */
  2795   2795   
  2796   2796     assert( pParse->nErr==0 );      /* Never called with prior errors */
  2797   2797     if( db->mallocFailed || IN_DECLARE_VTAB ){
  2798   2798       goto exit_create_index;
  2799   2799     }
  2800   2800     if( SQLITE_OK!=sqlite3ReadSchema(pParse) ){

Changes to src/update.c.

   588    588           OPFLAG_ISUPDATE | ((hasFK || chngKey || pPk!=0) ? 0 : OPFLAG_ISNOOP),
   589    589           regNewRowid
   590    590       );
   591    591       if( !pParse->nested ){
   592    592         sqlite3VdbeChangeP4(v, -1, (char*)pTab, P4_TABLE);
   593    593       }
   594    594       if( bReplace || chngKey ){
   595         -      if( sqlite3VdbeCurrentAddr(v)==j1+1 ){
   596         -        sqlite3VdbeChangeToNoop(v, j1);
   597         -      }else{
   598         -        sqlite3VdbeJumpHere(v, j1);
   599         -      }
          595  +      sqlite3VdbeJumpHere(v, j1);
   600    596       }
   601    597   
   602    598       if( hasFK ){
   603    599         sqlite3FkCheck(pParse, pTab, 0, regNewRowid, aXRef, chngKey);
   604    600       }
   605    601     
   606    602       /* Insert the new index entries and the new record. */

Changes to src/vdbeaux.c.

  3112   3112     */
  3113   3113     /*  mem1.u.i = 0;  // not needed, here to silence compiler warning */
  3114   3114     
  3115   3115     idx1 = getVarint32(aKey1, szHdr1);
  3116   3116     d1 = szHdr1;
  3117   3117     assert( pKeyInfo->nField+pKeyInfo->nXField>=pPKey2->nField || CORRUPT_DB );
  3118   3118     assert( pKeyInfo->aSortOrder!=0 );
  3119         -  assert( (idx1<=szHdr1 && i<pPKey2->nField) || CORRUPT_DB );
         3119  +  assert( pKeyInfo->nField>0 );
         3120  +  assert( idx1<=szHdr1 || CORRUPT_DB );
  3120   3121     do{
  3121   3122       u32 serial_type1;
  3122   3123   
  3123   3124       /* Read the serial types for the next element in each key. */
  3124   3125       idx1 += getVarint32( aKey1+idx1, serial_type1 );
  3125   3126   
  3126   3127       /* Verify that there is enough key space remaining to avoid

Changes to src/vdbemem.c.

  1012   1012   
  1013   1013       if( pRec==0 ){
  1014   1014         Index *pIdx = p->pIdx;      /* Index being probed */
  1015   1015         int nByte;                  /* Bytes of space to allocate */
  1016   1016         int i;                      /* Counter variable */
  1017   1017         int nCol = pIdx->nColumn;   /* Number of index columns including rowid */
  1018   1018     
  1019         -      nByte = sizeof(Mem) * nCol + sizeof(UnpackedRecord);
         1019  +      nByte = sizeof(Mem) * nCol + ROUND8(sizeof(UnpackedRecord));
  1020   1020         pRec = (UnpackedRecord*)sqlite3DbMallocZero(db, nByte);
  1021   1021         if( pRec ){
  1022   1022           pRec->pKeyInfo = sqlite3KeyInfoOfIndex(p->pParse, pIdx);
  1023   1023           if( pRec->pKeyInfo ){
  1024   1024             assert( pRec->pKeyInfo->nField+pRec->pKeyInfo->nXField==nCol );
  1025   1025             assert( pRec->pKeyInfo->enc==ENC(db) );
  1026   1026             pRec->flags = UNPACKED_PREFIX_MATCH;
  1027         -          pRec->aMem = (Mem *)&pRec[1];
         1027  +          pRec->aMem = (Mem *)((u8*)pRec + ROUND8(sizeof(UnpackedRecord)));
  1028   1028             for(i=0; i<nCol; i++){
  1029   1029               pRec->aMem[i].flags = MEM_Null;
  1030   1030               pRec->aMem[i].type = SQLITE_NULL;
  1031   1031               pRec->aMem[i].db = db;
  1032   1032             }
  1033   1033           }else{
  1034   1034             sqlite3DbFree(db, pRec);
................................................................................
  1074   1074     int rc = SQLITE_OK;
  1075   1075   
  1076   1076     if( !pExpr ){
  1077   1077       *ppVal = 0;
  1078   1078       return SQLITE_OK;
  1079   1079     }
  1080   1080     op = pExpr->op;
  1081         -
  1082         -  /* op can only be TK_REGISTER if we have compiled with SQLITE_ENABLE_STAT4.
  1083         -  ** The ifdef here is to enable us to achieve 100% branch test coverage even
  1084         -  ** when SQLITE_ENABLE_STAT4 is omitted.
  1085         -  */
  1086         -#ifdef SQLITE_ENABLE_STAT3_OR_STAT4
  1087         -  if( op==TK_REGISTER ) op = pExpr->op2;
  1088         -#else
  1089   1081     if( NEVER(op==TK_REGISTER) ) op = pExpr->op2;
  1090         -#endif
  1091   1082   
  1092   1083     /* Handle negative integers in a single step.  This is needed in the
  1093   1084     ** case when the value is -9223372036854775808.
  1094   1085     */
  1095   1086     if( op==TK_UMINUS
  1096   1087      && (pExpr->pLeft->op==TK_INTEGER || pExpr->pLeft->op==TK_FLOAT) ){
  1097   1088       pExpr = pExpr->pLeft;
................................................................................
  1302   1293     /* Skip over any TK_COLLATE nodes */
  1303   1294     pExpr = sqlite3ExprSkipCollate(pExpr);
  1304   1295   
  1305   1296     if( !pExpr ){
  1306   1297       pVal = valueNew(db, &alloc);
  1307   1298       if( pVal ){
  1308   1299         sqlite3VdbeMemSetNull((Mem*)pVal);
  1309         -      *pbOk = 1;
  1310   1300       }
  1311   1301     }else if( pExpr->op==TK_VARIABLE
  1312         -        || (pExpr->op==TK_REGISTER && pExpr->op2==TK_VARIABLE)
         1302  +        || NEVER(pExpr->op==TK_REGISTER && pExpr->op2==TK_VARIABLE)
  1313   1303     ){
  1314   1304       Vdbe *v;
  1315   1305       int iBindVar = pExpr->iColumn;
  1316   1306       sqlite3VdbeSetVarmask(pParse->pVdbe, iBindVar);
  1317   1307       if( (v = pParse->pReprepare)!=0 ){
  1318   1308         pVal = valueNew(db, &alloc);
  1319   1309         if( pVal ){
  1320   1310           rc = sqlite3VdbeMemCopy((Mem*)pVal, &v->aVar[iBindVar-1]);
  1321   1311           if( rc==SQLITE_OK ){
  1322   1312             sqlite3ValueApplyAffinity(pVal, affinity, ENC(db));
  1323   1313           }
  1324   1314           pVal->db = pParse->db;
  1325         -        *pbOk = 1;
  1326   1315           sqlite3VdbeMemStoreType((Mem*)pVal);
  1327   1316         }
  1328         -    }else{
  1329         -      *pbOk = 0;
  1330   1317       }
  1331   1318     }else{
  1332   1319       rc = valueFromExpr(db, pExpr, ENC(db), affinity, &pVal, &alloc);
  1333         -    *pbOk = (pVal!=0);
  1334   1320     }
         1321  +  *pbOk = (pVal!=0);
  1335   1322   
  1336   1323     assert( pVal==0 || pVal->db==db );
  1337   1324     return rc;
  1338   1325   }
  1339   1326   
  1340   1327   /*
  1341   1328   ** Unless it is NULL, the argument must be an UnpackedRecord object returned

Changes to src/where.c.

  1901   1901     int i = pIdx->nSample;      /* Smallest sample larger than or equal to pRec */
  1902   1902     int iTest;                  /* Next sample to test */
  1903   1903     int res;                    /* Result of comparison operation */
  1904   1904   
  1905   1905   #ifndef SQLITE_DEBUG
  1906   1906     UNUSED_PARAMETER( pParse );
  1907   1907   #endif
  1908         -  assert( pRec!=0 || pParse->db->mallocFailed );
  1909         -  if( pRec==0 ) return;
         1908  +  assert( pRec!=0 );
  1910   1909     iCol = pRec->nField - 1;
  1911   1910     assert( pIdx->nSample>0 );
  1912   1911     assert( pRec->nField>0 && iCol<pIdx->nSampleCol );
  1913   1912     do{
  1914   1913       iTest = (iMin+i)/2;
  1915   1914       res = sqlite3VdbeRecordCompare(aSample[iTest].n, aSample[iTest].p, pRec);
  1916   1915       if( res<0 ){

Changes to test/conflict2.test.

   301    301    11 ROLLBACK {UPDATE OR IGNORE}      0 {6 7 3 9}  1 0 0
   302    302    12 {}       {UPDATE OR IGNORE}      0 {6 7 3 9}  1 0 0
   303    303    13 {}       {UPDATE OR REPLACE}     0 {7 6 9}    1 0 1
   304    304    14 {}       {UPDATE OR FAIL}        1 {6 7 3 4}  1 0 0
   305    305    15 {}       {UPDATE OR ABORT}       1 {1 2 3 4}  1 0 1
   306    306    16 {}       {UPDATE OR ROLLBACK}    1 {1 2 3 4}  0 0 0
   307    307   } {
          308  +
          309  +  # When using in-memory journals, no temporary files are required for
          310  +  # statement journals.
          311  +  if {[permutation] == "inmemory_journal"} { set t4 0 }
          312  +
   308    313     if {$t0} {set t1 {UNIQUE constraint failed: t1.a}}
   309    314     if {[info exists TEMP_STORE] && $TEMP_STORE==3} {
   310    315       set t3 0
   311    316     } else {
   312    317       set t3 [expr {$t3+$t4}]
   313    318     }
   314    319     do_test conflict2-6.$i {

Changes to test/fts3varint.test.

     6      6   #
     7      7   #***********************************************************************
     8      8   # This file runs all tests.
     9      9   #
    10     10   # $Id: fts3.test,v 1.2 2008/07/23 18:17:32 drh Exp $
    11     11   
    12     12   set testdir [file dirname $argv0]
    13         -source $testdir/permutations.test
           13  +source $testdir/tester.tcl
    14     14   set testprefix fts3varint
    15     15   
    16     16   ifcapable !fts3 {
    17     17     finish_test
    18     18     return
    19     19   }
    20     20   

Changes to test/fuzz3.test.

    14     14   # bytes.
    15     15   #
    16     16   # $Id: fuzz3.test,v 1.3 2009/01/05 17:19:03 drh Exp $
    17     17   
    18     18   set testdir [file dirname $argv0]
    19     19   source $testdir/tester.tcl
    20     20   
           21  +# These tests deal with corrupt database files
           22  +#
           23  +database_may_be_corrupt
    21     24   
    22     25   expr srand(123)
    23     26   
    24     27   proc rstring {n} {
    25     28     set str s
    26     29     while {[string length $str] < $n} {
    27     30       append str [expr rand()]