SQLite

Check-in [b141bae3f6]
Login

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

Overview
Comment:Remove code in the round() SQL function that became unreachable due to the optimization of check-in [e95138f5f4febde5]
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: b141bae3f6d16c0ebb59dac9b02086a4370839e71ade34004f647b09b1083d1d
User & Date: drh 2019-06-07 22:51:13.798
Context
2019-06-10
13:46
Do not attempt the LIKE optimization on a column with numeric affinity if the rhs of the operator begins with whitespace. Fix for ticket [fd76310a5e]. (check-in: 94b58ab059 user: dan tags: trunk)
2019-06-07
22:51
Remove code in the round() SQL function that became unreachable due to the optimization of check-in [e95138f5f4febde5] (check-in: b141bae3f6 user: drh tags: trunk)
22:26
When casting string values into numeric and the string has a prefix that looks like a number but total string is not a well-formed number, then take extra care that the result is either integer or real depending on what the prefix looks like. Fix for tickets [e8bedb2a184001] and [4c2d7639f076aa]. (check-in: 67a68af557 user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/func.c.
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
    r = (double)((sqlite_int64)(r+(r<0?-0.5:+0.5)));
  }else{
    zBuf = sqlite3_mprintf("%.*f",n,r);
    if( zBuf==0 ){
      sqlite3_result_error_nomem(context);
      return;
    }
    if( sqlite3AtoF(zBuf, &r, sqlite3Strlen30(zBuf), SQLITE_UTF8)<=0 ){
      assert( sqlite3_strglob("*Inf", zBuf)==0 );
      r = zBuf[0]=='-' ? -HUGE_VAL : +HUGE_VAL;
    } 
    sqlite3_free(zBuf);
  }
  sqlite3_result_double(context, r);
}
#endif

/*







|
<
<
<







393
394
395
396
397
398
399
400



401
402
403
404
405
406
407
    r = (double)((sqlite_int64)(r+(r<0?-0.5:+0.5)));
  }else{
    zBuf = sqlite3_mprintf("%.*f",n,r);
    if( zBuf==0 ){
      sqlite3_result_error_nomem(context);
      return;
    }
    sqlite3AtoF(zBuf, &r, sqlite3Strlen30(zBuf), SQLITE_UTF8);



    sqlite3_free(zBuf);
  }
  sqlite3_result_double(context, r);
}
#endif

/*