Ignore leading spaces on text to numeric conversions. Ticket #1662.

Fixes to test cases broken by the recent changes to round(). (CVS 3118)

FossilOrigin-Name: cdca3383c54b33aeafbbdbbb4ae7c90796cf66e5
This commit is contained in:
drh 2006-03-03 19:12:29 +00:00
parent 41714d6f83
commit 57bacb2282
7 changed files with 33 additions and 21 deletions

View File

@ -1,5 +1,5 @@
C Allow\sWHERE\sclause\sterms\son\sthe\sleft\stable\sof\sa\sLEFT\sOUTER\sJOIN\sto\ncontain\saggregate\ssubqueries.\s\sTicket\s#1697.\s(CVS\s3117)
D 2006-03-02T04:44:24
C Ignore\sleading\sspaces\son\stext\sto\snumeric\sconversions.\s\sTicket\s#1662.\nFixes\sto\stest\scases\sbroken\sby\sthe\srecent\schanges\sto\sround().\s(CVS\s3118)
D 2006-03-03T19:12:30
F Makefile.in 5d8dff443383918b700e495de42ec65bc1c8865b
F Makefile.linux-gcc 74ba0eadf88748a9ce3fd03d2a3ede2e6715baec
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
@ -87,7 +87,7 @@ F src/tokenize.c 382b3bb0ca26eb9153b5d20b246ef512a114a24f
F src/trigger.c bdead679e3688fa9e3d690ac83e471e1b5358318
F src/update.c 34add66fcd3301b33b6e4c4c813f4e408f7ee4a0
F src/utf.c 1d51225bce1ea8d1978e8ab28e862a0c12c7a8e8
F src/util.c f3f004c2b6ac6b1f8fd275f96efe040c5b0aa102
F src/util.c 59389ed717f0fa9d8023b3f482ba09dcf41343a8
F src/vacuum.c 5b37d0f436f8e1ffacd17934e44720b38d2247f9
F src/vdbe.c 5fb9d3e64ed18f82e71bd2ff94c3e5f07384c7d4
F src/vdbe.h 80ba1c391ec28180dd07a630577f50b22c2062da
@ -135,7 +135,7 @@ F test/busy.test 0271c854738e23ad76e10d4096a698e5af29d211
F test/capi2.test cddd151c7b687e9e00fde408b9547ec93c2146a4
F test/capi3.test 6553fb89a4d6918e42b5f953c1d880bacb6917fe
F test/capi3b.test 5f0bc94b104e11086b1103b20277e1910f59c7f4
F test/cast.test aabdcb3873bb2f40d855bf63950f6d99a5a196c7
F test/cast.test f88e7b6946e9a467cf4bb142d92bb65a83747fc2
F test/check.test 55ad950d7ad24d6eb3328c54149f90d38a39a962
F test/collate1.test add9454cef160677bb8b34148b8f277ce7f9f1c4
F test/collate2.test 224a632ba04907c049804b08162efd234aa7871f
@ -162,14 +162,14 @@ F test/distinctagg.test 2b89d1c5220d966a30ba4b40430338669301188b
F test/enc.test 7a03417a1051fe8bc6c7641cf4c8c3f7e0066d52
F test/enc2.test 9f15cb7adc745fbb93d083ae1cf5a2deaa04d25f
F test/enc3.test 890508efff6677345e93bf2a8adb0489b30df030
F test/expr.test 4e65cade931e14a0194eee41e33707e7af5f397a
F test/expr.test 7b4b349abdb05ab1862c1cfcf7607e3731efc5d2
F test/fkey1.test 153004438d51e6769fb1ce165f6313972d6263ce
F test/format4.test 9f31d41d4f926cab97b2ebe6be00a6ab12dece87
F test/func.test 0996e47cb5bb24007cec76f1a4cac9f4417360be
F test/hook.test 7e7645fd9a033f79cce8fdff151e32715e7ec50a
F test/in.test 40feeebc7e38576255051aad428322be1545e0f1
F test/index.test c478459611ded74745fee57f99f424da8a5f5fbd
F test/index2.test 9ad98243fd7fe833795a9cc662f371f0eed4ff4f
F test/index2.test ee83c6b5e3173a3d7137140d945d9a5d4fdfb9d6
F test/index3.test f66718cd92ce1216819d47e6a156755e4b2c4ca1
F test/insert.test b4d43f8e75e203fe51bc06cacf3636081903dcd1
F test/insert2.test 5a20e1ace5fa0800b58d28284212290189b49aed
@ -186,7 +186,7 @@ F test/journal1.test 36f2d1bb9bf03f790f43fbdb439e44c0657fab19
F test/lastinsert.test 9d7241f562d7adcf61730de83176417d7e30d76b
F test/laststmtchanges.test 19a6d0c11f7a31dc45465b495f7b845a62cbec17
F test/like.test 1665284b66060934568e2b4a69ad4f9033ecb5dd
F test/limit.test f593d0ff02b3ab657d08e4ffbf14081bda763393
F test/limit.test 1d5a45f21f26553676a7f97aea871fc465a47fbb
F test/lock.test 9b7afcb24f53d24da502abb33daaad2cd6d44107
F test/lock2.test d83ba79d3c4fffdb5b926c7d8ca7a36c34288a55
F test/lock3.test 615111293cf32aa2ed16d01c6611737651c96fb9
@ -355,7 +355,7 @@ F www/tclsqlite.tcl bb0d1357328a42b1993d78573e587c6dcbc964b9
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
F www/version3.tcl a99cf5f6d8bd4d5537584a2b342f0fb9fa601d8b
F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513
P 9dbadfb2111f7d7f971e1832db3992ed5851d8b1
R 5d4d777adb4a6491f27099755fa5e993
P a286e54e26f9a364127649eeea160d5fa8928faf
R c9a2f008c3cee760cce6c3ef34cac338
U drh
Z 8b78e5445d0958fbc886976c3af969ba
Z b4caf361fbef538733ed381452cd4483

View File

@ -1 +1 @@
a286e54e26f9a364127649eeea160d5fa8928faf
cdca3383c54b33aeafbbdbbb4ae7c90796cf66e5

View File

@ -14,7 +14,7 @@
** This file contains functions for allocating memory, comparing
** strings, and stuff like that.
**
** $Id: util.c,v 1.186 2006/02/24 02:53:50 drh Exp $
** $Id: util.c,v 1.187 2006/03/03 19:12:30 drh Exp $
*/
#include "sqliteInt.h"
#include "os.h"
@ -971,6 +971,7 @@ int sqlite3AtoF(const char *z, double *pResult){
int sign = 1;
const char *zBegin = z;
LONGDOUBLE_TYPE v1 = 0.0;
while( isspace(*z) ) z++;
if( *z=='-' ){
sign = -1;
z++;
@ -1038,6 +1039,7 @@ int sqlite3atoi64(const char *zNum, i64 *pNum){
i64 v = 0;
int neg;
int i, c;
while( isspace(*zNum) ) zNum++;
if( *zNum=='-' ){
neg = 1;
zNum++;

View File

@ -11,7 +11,7 @@
# This file implements regression tests for SQLite library. The
# focus of this file is testing the CAST operator.
#
# $Id: cast.test,v 1.4 2006/01/16 16:24:25 danielk1977 Exp $
# $Id: cast.test,v 1.5 2006/03/03 19:12:30 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@ -183,4 +183,14 @@ do_test cast-1.53 {
execsql {SELECT CAST('123.5abc' AS integer)}
} 123
# Ticket #1662. Ignore leading spaces in numbers when casting.
#
do_test cast-2.1 {
execsql {SELECT CAST(' 123' AS integer)}
} 123
do_test cast-2.2 {
execsql {SELECT CAST(' -123.456' AS real)}
} -123.456
finish_test

View File

@ -11,7 +11,7 @@
# This file implements regression tests for SQLite library. The
# focus of this file is testing expressions.
#
# $Id: expr.test,v 1.50 2006/01/21 12:08:54 danielk1977 Exp $
# $Id: expr.test,v 1.51 2006/03/03 19:12:30 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@ -620,7 +620,7 @@ set sqlite_current_time 0
do_test expr-9.1 {
execsql {SELECT round(-('-'||'123'))}
} 123
} 123.0
# Test an error message that can be generated by the LIKE expression
do_test expr-10.1 {

View File

@ -11,7 +11,7 @@
# This file implements regression tests for SQLite library. The
# focus of this file is testing the CREATE INDEX statement.
#
# $Id: index2.test,v 1.2 2005/01/20 02:17:02 danielk1977 Exp $
# $Id: index2.test,v 1.3 2006/03/03 19:12:30 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@ -52,7 +52,7 @@ do_test index2-1.4 {
} 101
do_test index2-1.5 {
execsql {SELECT round(sum(c1000)) FROM t1}
} {50601000}
} {50601000.0}
# Create indices with many columns
#

View File

@ -12,7 +12,7 @@
# focus of this file is testing the LIMIT ... OFFSET ... clause
# of SELECT statements.
#
# $Id: limit.test,v 1.27 2006/01/17 09:35:02 danielk1977 Exp $
# $Id: limit.test,v 1.28 2006/03/03 19:12:30 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@ -335,17 +335,17 @@ do_test limit-7.12 {
#
do_test limit-8.1 {
execsql {
SELECT DISTINCT round(x/100) FROM t3 LIMIT 5;
SELECT DISTINCT cast(round(x/100) as integer) FROM t3 LIMIT 5;
}
} {0 1 2 3 4}
do_test limit-8.2 {
execsql {
SELECT DISTINCT round(x/100) FROM t3 LIMIT 5 OFFSET 5;
SELECT DISTINCT cast(round(x/100) as integer) FROM t3 LIMIT 5 OFFSET 5;
}
} {5 6 7 8 9}
do_test limit-8.3 {
execsql {
SELECT DISTINCT round(x/100) FROM t3 LIMIT 5 OFFSET 25;
SELECT DISTINCT cast(round(x/100) as integer) FROM t3 LIMIT 5 OFFSET 25;
}
} {25 26 27 28 29}