/ Check-in [2d4458af]
Login

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

Overview
Comment:Pull the last-minute fixes for 3.7.7 into the apple-osx branch.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | apple-osx
Files: files | file ages | folders
SHA1: 2d4458af59c697ad453996815d14442230654670
User & Date: drh 2011-06-23 17:42:45
Context
2011-06-24
20:47
Merging local changes to apple-osx check-in: 34f0efa2 user: adam tags: apple-osx
2011-06-23
17:42
Pull the last-minute fixes for 3.7.7 into the apple-osx branch. check-in: 2d4458af user: drh tags: apple-osx
17:29
Add a bit to the SQLITE_TESTCTRL_OPTIMIZATIONS setting that will disable affinity when writing to any index, regardless of whether or not the index is on a manifestation of a view. This allows better testing of the fix for ticket [91e2e8ba6ff2e2]. check-in: b61a76a5 user: drh tags: trunk
02:30
Pull the latest changes from trunk into the apple-osx branch. check-in: b5acda04 user: drh tags: apple-osx
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/delete.c.

   632    632         sqlite3VdbeAddOp2(v, OP_SCopy, regBase+nCol, regBase+j);
   633    633       }else{
   634    634         sqlite3VdbeAddOp3(v, OP_Column, iCur, idx, regBase+j);
   635    635         sqlite3ColumnDefault(v, pTab, idx, -1);
   636    636       }
   637    637     }
   638    638     if( doMakeRec ){
          639  +    const char *zAff;
          640  +    if( pTab->pSelect || (pParse->db->flags & SQLITE_IdxRealAsInt)!=0 ){
          641  +      zAff = 0;
          642  +    }else{
          643  +      zAff = sqlite3IndexAffinityStr(v, pIdx);
          644  +    }
   639    645       sqlite3VdbeAddOp3(v, OP_MakeRecord, regBase, nCol+1, regOut);
   640         -    sqlite3VdbeChangeP4(v, -1, sqlite3IndexAffinityStr(v, pIdx), P4_TRANSIENT);
          646  +    sqlite3VdbeChangeP4(v, -1, zAff, P4_TRANSIENT);
   641    647     }
   642    648     sqlite3ReleaseTempRange(pParse, regBase, nCol+1);
   643    649     return regBase;
   644    650   }

Changes to src/sqliteInt.h.

   951    951   #define SQLITE_QueryFlattener 0x01        /* Disable query flattening */
   952    952   #define SQLITE_ColumnCache    0x02        /* Disable the column cache */
   953    953   #define SQLITE_IndexSort      0x04        /* Disable indexes for sorting */
   954    954   #define SQLITE_IndexSearch    0x08        /* Disable indexes for searching */
   955    955   #define SQLITE_IndexCover     0x10        /* Disable index covering table */
   956    956   #define SQLITE_GroupByOrder   0x20        /* Disable GROUPBY cover of ORDERBY */
   957    957   #define SQLITE_FactorOutConst 0x40        /* Disable factoring out constants */
          958  +#define SQLITE_IdxRealAsInt   0x80        /* Store REAL as INT in indices */
   958    959   #define SQLITE_OptMask        0xff        /* Mask of all disablable opts */
   959    960   
   960    961   /*
   961    962   ** Possible values for the sqlite.magic field.
   962    963   ** The numbers are obtained at random and have no special meaning, other
   963    964   ** than being distinct from one another.
   964    965   */

Changes to src/test1.c.

  5710   5710       { "query-flattener",  SQLITE_QueryFlattener },
  5711   5711       { "column-cache",     SQLITE_ColumnCache    },
  5712   5712       { "index-sort",       SQLITE_IndexSort      },
  5713   5713       { "index-search",     SQLITE_IndexSearch    },
  5714   5714       { "index-cover",      SQLITE_IndexCover     },
  5715   5715       { "groupby-order",    SQLITE_GroupByOrder   },
  5716   5716       { "factor-constants", SQLITE_FactorOutConst },
         5717  +    { "real-as-int",      SQLITE_IdxRealAsInt   },
  5717   5718     };
  5718   5719   
  5719   5720     if( objc!=4 ){
  5720   5721       Tcl_WrongNumArgs(interp, 1, objv, "DB OPT BOOLEAN");
  5721   5722       return TCL_ERROR;
  5722   5723     }
  5723   5724     if( getDbPointer(interp, Tcl_GetString(objv[1]), &db) ) return TCL_ERROR;

Added test/tkt-91e2e8ba6f.test.

            1  +# 2011 June 23
            2  +#
            3  +#    May you do good and not evil.
            4  +#    May you find forgiveness for yourself and forgive others.
            5  +#    May you share freely, never taking more than you give.
            6  +#
            7  +#***********************************************************************
            8  +#
            9  +# This file contains tests for SQLite. Specifically, it tests that SQLite
           10  +# does not crash and an error is returned if localhost() fails. This 
           11  +# is the problem reported by ticket 91e2e8ba6f.
           12  +#
           13  +
           14  +set testdir [file dirname $argv0]
           15  +source $testdir/tester.tcl
           16  +
           17  +set testprefix tkt-91e2e8ba6f
           18  +
           19  +
           20  +do_execsql_test 1.1 {
           21  +  CREATE TABLE t1(x INTEGER, y REAL);
           22  +  INSERT INTO t1 VALUES(11, 11);
           23  +} {}
           24  +
           25  +do_execsql_test 1.2 {
           26  +  SELECT x/10, y/10 FROM t1;
           27  +} {1 1.1}
           28  +
           29  +do_execsql_test 1.3 {
           30  +  SELECT x/10, y/10 FROM (SELECT * FROM t1);
           31  +} {1 1.1}
           32  +
           33  +do_execsql_test 1.4 {
           34  +  SELECT x/10, y/10 FROM (SELECT * FROM t1 LIMIT 5 OFFSET 0);
           35  +} {1 1.1}
           36  +
           37  +do_execsql_test 1.5 {
           38  +  SELECT x/10, y/10 FROM (SELECT * FROM t1 LIMIT 5 OFFSET 0) LIMIT 5 OFFSET 0;
           39  +} {1 1.1}
           40  +
           41  +do_execsql_test 1.6 {
           42  +  SELECT a.x/10, a.y/10 FROM 
           43  +    (SELECT * FROM t1 LIMIT 5 OFFSET 0) AS a, t1 AS b WHERE a.x = b.x
           44  +  LIMIT 5 OFFSET 0;
           45  +} {1 1.1}
           46  +
           47  +do_execsql_test 1.7 {
           48  +  CREATE VIEW v1 AS SELECT * FROM t1 LIMIT 5;
           49  +  SELECT a.x/10, a.y/10 FROM v1 AS a, t1 AS b WHERE a.x = b.x LIMIT 5 OFFSET 0;
           50  +} {1 1.1}
           51  +
           52  +finish_test