/ Check-in [3816bb41]
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:Fix then handling of the (oversized) integer literal -0x8000000000000000.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 3816bb415ecfd4f36430d0fcbc878e382975de60
User & Date: drh 2016-11-30 14:47:37
Context
2016-11-30
16:54
Add the remember(V,PTR) extension function which copies an SQL value into an application variable. check-in: d2d30914 user: drh tags: trunk
16:39
Merge all the latest changes from trunk. check-in: 7ca58a07 user: drh tags: est_count_pragma
14:47
Fix then handling of the (oversized) integer literal -0x8000000000000000. check-in: 3816bb41 user: drh tags: trunk
05:08
Change the OP_DecrJumpZero opcode back to its old behavior of always decrementing, except top the decrementing when it reaches the largest negative number. check-in: 9d0d8c2e user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/expr.c.

  2938   2938       sqlite3VdbeAddOp2(v, OP_Integer, i, iMem);
  2939   2939     }else{
  2940   2940       int c;
  2941   2941       i64 value;
  2942   2942       const char *z = pExpr->u.zToken;
  2943   2943       assert( z!=0 );
  2944   2944       c = sqlite3DecOrHexToI64(z, &value);
  2945         -    if( c==0 || (c==2 && negFlag) ){
  2946         -      if( negFlag ){ value = c==2 ? SMALLEST_INT64 : -value; }
  2947         -      sqlite3VdbeAddOp4Dup8(v, OP_Int64, 0, iMem, 0, (u8*)&value, P4_INT64);
  2948         -    }else{
         2945  +    if( c==1 || (c==2 && !negFlag) || (negFlag && value==SMALLEST_INT64)){
  2949   2946   #ifdef SQLITE_OMIT_FLOATING_POINT
  2950   2947         sqlite3ErrorMsg(pParse, "oversized integer: %s%s", negFlag ? "-" : "", z);
  2951   2948   #else
  2952   2949   #ifndef SQLITE_OMIT_HEX_INTEGER
  2953   2950         if( sqlite3_strnicmp(z,"0x",2)==0 ){
  2954         -        sqlite3ErrorMsg(pParse, "hex literal too big: %s", z);
         2951  +        sqlite3ErrorMsg(pParse, "hex literal too big: %s%s", negFlag?"-":"",z);
  2955   2952         }else
  2956   2953   #endif
  2957   2954         {
  2958   2955           codeReal(v, z, negFlag, iMem);
  2959   2956         }
  2960   2957   #endif
         2958  +    }else{
         2959  +      if( negFlag ){ value = c==2 ? SMALLEST_INT64 : -value; }
         2960  +      sqlite3VdbeAddOp4Dup8(v, OP_Int64, 0, iMem, 0, (u8*)&value, P4_INT64);
  2961   2961       }
  2962   2962     }
  2963   2963   }
  2964   2964   
  2965   2965   /*
  2966   2966   ** Erase column-cache entry number i
  2967   2967   */

Changes to test/hexlit.test.

   108    108   #
   109    109   do_catchsql_test hexlist-400 {
   110    110     SELECT 0x10000000000000000;
   111    111   } {1 {hex literal too big: 0x10000000000000000}}
   112    112   do_catchsql_test hexlist-401 {
   113    113     SELECT DISTINCT 0x10000000000000000;
   114    114   } {1 {hex literal too big: 0x10000000000000000}}
          115  +do_catchsql_test hexlist-402 {
          116  +  SELECT DISTINCT -0x08000000000000000;
          117  +} {1 {hex literal too big: -0x08000000000000000}}
   115    118   do_catchsql_test hexlist-410 {
   116    119     DROP TABLE IF EXISTS t1;
   117    120     CREATE TABLE t1(x);
   118    121     INSERT INTO t1 VALUES(1+0x10000000000000000);
   119    122   } {1 {hex literal too big: 0x10000000000000000}}
   120    123   
   121    124   
   122    125   finish_test