-C Add\smore\stests.
-D 2013-03-11T06:24:46.255
+C Increase\sstrictness\sof\sthe\snew\sexperimental\sfunctions\sand\sadd\smore\stests.
+D 2013-03-12T09:07:25.371
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in 9a804abbd3cae82d196e4d33aba13239e32522a5
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
F src/expr.c a23b4aac2a455b2e76b55bef5dcfbe62b665375c
F src/fault.c 160a0c015b6c2629d3899ed2daf63d75754a32bb
F src/fkey.c e16942bd5c8a868ac53287886464a5ed0e72b179
-F src/func.c 82dfd6b6744bd583cb52157ee1496af351ec9d49
+F src/func.c cdf7b604909be1feca6e928ceb4c511b79c085f3
F src/global.c e59ecd2c553ad0d4bfbc84ca71231336f8993a7a
F src/hash.c ac3470bbf1ca4ae4e306a8ecb0fdf1731810ffe4
F src/hash.h 2894c932d84d9f892d4b4023a75e501f83050970
F src/sqlite.h.in 31045976254225e6bf046a96e87b40fa4c1d55e4
F src/sqlite3.rc fea433eb0a59f4c9393c8e6d76a6e2596b1fe0c0
F src/sqlite3ext.h 7183ab832e23db0f934494f16928da127a571d75
-F src/sqliteInt.h 601c887f6d9c92e75551873c0a34711fff745bed
+F src/sqliteInt.h 4d3c88acd03a6c480c52ad1324aecb8b4059a909
F src/sqliteLimit.h 164b0e6749d31e0daa1a4589a169d31c0dec7b3d
F src/status.c bedc37ec1a6bb9399944024d63f4c769971955a9
F src/table.c 2cd62736f845d82200acfa1287e33feb3c15d62e
F test/func.test b058483c17952eff7797b837bbb61e27e6b05606
F test/func2.test 772d66227e4e6684b86053302e2d74a2500e1e0f
F test/func3.test 001021e5b88bd02a3b365a5c5fd8f6f49d39744a
-F test/func4.test 86f48cf1982a47001447a1924f5573d3c1e17ccf
+F test/func4.test 161f051a028d8347cdf044ba84b3cb353980b01f
F test/fuzz-oss1.test 4912e528ec9cf2f42134456933659d371c9e0d74
F test/fuzz.test 77fd50afc12847af50fcf1941679d90adebadde6
F test/fuzz2.test 207d0f9d06db3eaf47a6b7bfc835b8e2fc397167
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381
F tool/win/sqlite.vsix 97894c2790eda7b5bce3cc79cb2a8ec2fde9b3ac
-P 465fd853d3e3544cb06b15ffa32ce25774d816c7
-R de601f18e2d7c1d69cbd21be32cf69bf
+P f9468e334d6086b8a80c6a4204ec4e03fe59cf96
+R 4e552e5f44d1389ed4af9199ab9f91b5
U mistachkin
-Z 349394d9a983439850a7e1f0ab403301
+Z 362f229b782fa4883f52597e4e59d3e0
#include "sqliteInt.h"
#include <stdlib.h>
#include <assert.h>
+#ifndef SQLITE_OMIT_FLOATING_POINT
+# include <math.h>
+#endif
#include "vdbeInt.h"
/*
UNUSED_PARAMETER(argc);
switch( sqlite3_value_type(argv[0]) ){
case SQLITE_FLOAT:
+#ifndef SQLITE_OMIT_FLOATING_POINT
+ {
+ double rVal = sqlite3_value_double(argv[0]);
+ double rIntVal = 0.0;
+ if( !sqlite3IsNaN(rVal) && modf(rVal, &rIntVal)==0.0 &&
+ rIntVal>=SMALLEST_INT64 && rIntVal<=LARGEST_INT64 ){
+ sqlite3_result_int64(context, (i64)rIntVal);
+ return;
+ }
+ sqlite3_result_null(context);
+ break;
+ }
+#endif
case SQLITE_INTEGER: {
sqlite3_result_int64(context, sqlite3_value_int64(argv[0]));
break;
assert( argc==1 );
UNUSED_PARAMETER(argc);
switch( sqlite3_value_type(argv[0]) ){
- case SQLITE_FLOAT:
- case SQLITE_INTEGER: {
+ case SQLITE_FLOAT: {
sqlite3_result_double(context, sqlite3_value_double(argv[0]));
break;
}
+ case SQLITE_INTEGER: {
+ i64 iVal = sqlite3_value_int64(argv[0]);
+ double rVal = (double)iVal;
+ if( iVal==rVal ){
+ sqlite3_result_double(context, rVal);
+ return;
+ }
+ sqlite3_result_null(context);
+ break;
+ }
case SQLITE_BLOB:
case SQLITE_TEXT: {
const unsigned char *zStr = sqlite3_value_text(argv[0]);
} {1}
do_execsql_test func4-1.[incr i] {
SELECT tointeger(-1.79769313486232e308 - 1);
-} {-9223372036854775808}
+} {{}}
do_execsql_test func4-1.[incr i] {
SELECT tointeger(-1.79769313486232e308);
-} {-9223372036854775808}
+} {{}}
do_execsql_test func4-1.[incr i] {
SELECT tointeger(-1.79769313486232e308 + 1);
-} {-9223372036854775808}
+} {{}}
do_execsql_test func4-1.[incr i] {
SELECT tointeger(-9223372036854775808 - 1);
} {-9223372036854775808}
} {-9223372036854775808}
do_execsql_test func4-1.[incr i] {
SELECT tointeger(1.79769313486232e308 - 1);
-} {-9223372036854775808}
+} {{}}
do_execsql_test func4-1.[incr i] {
SELECT tointeger(1.79769313486232e308);
-} {-9223372036854775808}
+} {{}}
do_execsql_test func4-1.[incr i] {
SELECT tointeger(1.79769313486232e308 + 1);
-} {-9223372036854775808}
+} {{}}
do_execsql_test func4-1.[incr i] {
SELECT tointeger(4503599627370496 - 1);
} {4503599627370495}
} {-9223372036854775808}
do_execsql_test func4-1.[incr i] {
SELECT tointeger(18446744073709551616 - 1);
-} {-9223372036854775808}
+} {{}}
do_execsql_test func4-1.[incr i] {
SELECT tointeger(18446744073709551616);
-} {-9223372036854775808}
+} {{}}
do_execsql_test func4-1.[incr i] {
SELECT tointeger(18446744073709551616 + 1);
-} {-9223372036854775808}
+} {{}}
ifcapable floatingpoint {
set i 0
INSERT INTO t1 (x) VALUES ('1234bad');
}
} {1 {constraint failed}}
+ do_test func4-3.[incr i] {
+ catchsql {
+ INSERT INTO t1 (x) VALUES ('1234.56bad');
+ }
+ } {1 {constraint failed}}
do_test func4-3.[incr i] {
catchsql {
INSERT INTO t1 (x) VALUES (1234);
do_execsql_test func4-3.[incr i] {
SELECT x FROM t1 ORDER BY x;
} {1234 1234}
+
+ ifcapable floatingpoint {
+ set i 0
+ do_execsql_test func4-4.[incr i] {
+ CREATE TABLE t2(
+ x REAL CHECK(todouble(x) IS NOT NULL)
+ );
+ } {}
+ do_test func4-4.[incr i] {
+ catchsql {
+ INSERT INTO t2 (x) VALUES (NULL);
+ }
+ } {1 {constraint failed}}
+ do_test func4-4.[incr i] {
+ catchsql {
+ INSERT INTO t2 (x) VALUES (NULL);
+ }
+ } {1 {constraint failed}}
+ do_test func4-4.[incr i] {
+ catchsql {
+ INSERT INTO t2 (x) VALUES ('');
+ }
+ } {1 {constraint failed}}
+ do_test func4-4.[incr i] {
+ catchsql {
+ INSERT INTO t2 (x) VALUES ('bad');
+ }
+ } {1 {constraint failed}}
+ do_test func4-4.[incr i] {
+ catchsql {
+ INSERT INTO t2 (x) VALUES ('1234bad');
+ }
+ } {1 {constraint failed}}
+ do_test func4-4.[incr i] {
+ catchsql {
+ INSERT INTO t2 (x) VALUES ('1234.56bad');
+ }
+ } {1 {constraint failed}}
+ do_test func4-4.[incr i] {
+ catchsql {
+ INSERT INTO t2 (x) VALUES (1234);
+ }
+ } {0 {}}
+ do_test func4-4.[incr i] {
+ catchsql {
+ INSERT INTO t2 (x) VALUES (1234.56);
+ }
+ } {0 {}}
+ do_test func4-4.[incr i] {
+ catchsql {
+ INSERT INTO t2 (x) VALUES ('1234');
+ }
+ } {0 {}}
+ do_test func4-4.[incr i] {
+ catchsql {
+ INSERT INTO t2 (x) VALUES ('1234.56');
+ }
+ } {0 {}}
+ do_test func4-4.[incr i] {
+ catchsql {
+ INSERT INTO t2 (x) VALUES (ZEROBLOB(4));
+ }
+ } {1 {constraint failed}}
+ do_test func4-4.[incr i] {
+ catchsql {
+ INSERT INTO t2 (x) VALUES (X'');
+ }
+ } {1 {constraint failed}}
+ do_test func4-4.[incr i] {
+ catchsql {
+ INSERT INTO t2 (x) VALUES (X'1234');
+ }
+ } {1 {constraint failed}}
+ do_test func4-4.[incr i] {
+ catchsql {
+ INSERT INTO t2 (x) VALUES (X'12345678');
+ }
+ } {1 {constraint failed}}
+ do_execsql_test func4-4.[incr i] {
+ SELECT x FROM t2 ORDER BY x;
+ } {1234.0 1234.0 1234.56 1234.56}
+ }
}
finish_test