]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Work around a NaN bug in some versions of Tcl. (CVS 5058)
authordrh <drh@noemail.net>
Mon, 28 Apr 2008 15:23:02 +0000 (15:23 +0000)
committerdrh <drh@noemail.net>
Mon, 28 Apr 2008 15:23:02 +0000 (15:23 +0000)
FossilOrigin-Name: 7bf8213ce9f591f4c2ef6c1e19a17712e3bae9e3

manifest
manifest.uuid
src/test1.c

index 602dc2e027e79aa7a8c2150b6506617015448e13..93d0dd0979408184f950569cbaa43a8d660eca71 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Changes\sto\stest\sscripts\sto\saccommodate\sdifferent\sarchitectures\sand\sdifferent\nversions\sof\sTcl.\s(CVS\s5057)
-D 2008-04-28T13:02:58
+C Work\saround\sa\sNaN\sbug\sin\ssome\sversions\sof\sTcl.\s(CVS\s5058)
+D 2008-04-28T15:23:03
 F Makefile.arm-wince-mingw32ce-gcc ac5f7b2cef0cd850d6f755ba6ee4ab961b1fadf7
 F Makefile.in 25b3282a4ac39388632c2fb0e044ff494d490952
 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@@ -138,7 +138,7 @@ F src/sqliteInt.h d038951808706ae039b05090e068674d307f3e3f
 F src/sqliteLimit.h f435e728c6b620ef7312814d660a81f9356eb5c8
 F src/table.c 46ccf9b7892a86f57420ae7bac69ecd5e72d26b5
 F src/tclsqlite.c 2877726bf32f7d72ff057b37ed6c93485b667ea1
-F src/test1.c ab25cb2715a9e3f1d91cf99a7280ac7d8dd478e2
+F src/test1.c caf46aac174a51be7077110dea8a05a5563b85d1
 F src/test2.c f0808cc643528b9620e4059ca9bda8346f526121
 F src/test3.c f5328839e29631ed9eef8674994ad7341b2de59b
 F src/test4.c c2c0f5dc907f1346f5d4b65eb5799f11eb9e4071
@@ -630,7 +630,7 @@ F www/tclsqlite.tcl 8be95ee6dba05eabcd27a9d91331c803f2ce2130
 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
 F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
 F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5
-P e96e8b9b4137c3ea239674683cf9fd8682851908
-R 0afe0dea2b4e388bca2da8c4bcd08b36
+P 8eb2c07c520c12c2cd4610596dbec451c8275e95
+R 0d20d66feeaace19e07473438052cbbe
 U drh
-Z be6a7bb7666069d4d03be120f2bd1f64
+Z 82e30186eb61b94a6ebb1cd09ee72fb5
index f1b35367a607cc8dc745149e76163fd17bb2e50d..b510a04ee942ee8331e365684ec75a7a4f74b728 100644 (file)
@@ -1 +1 @@
-8eb2c07c520c12c2cd4610596dbec451c8275e95
\ No newline at end of file
+7bf8213ce9f591f4c2ef6c1e19a17712e3bae9e3
\ No newline at end of file
index 97629f58b1abbf8c0648b13b1d72db03ea64655f..7b461bc77fbd057496f72ae555cf04f3d5974051 100644 (file)
@@ -13,7 +13,7 @@
 ** is not included in the SQLite library.  It is used for automated
 ** testing of the SQLite library.
 **
-** $Id: test1.c,v 1.299 2008/04/16 12:58:54 drh Exp $
+** $Id: test1.c,v 1.300 2008/04/28 15:23:03 drh Exp $
 */
 #include "sqliteInt.h"
 #include "tcl.h"
@@ -2621,8 +2621,20 @@ static int test_bind_double(
 
   if( getStmtPointer(interp, Tcl_GetString(objv[1]), &pStmt) ) return TCL_ERROR;
   if( Tcl_GetIntFromObj(interp, objv[2], &idx) ) return TCL_ERROR;
-  if( Tcl_GetDoubleFromObj(interp, objv[3], &value) ) return TCL_ERROR;
 
+  /* Intercept the string "NaN" and generate a NaN value for it.
+  ** All other strings are passed through to Tcl_GetDoubleFromObj().
+  ** Tcl_GetDoubleFromObj() should understand "NaN" but some versions
+  ** contain a bug.
+  */
+  if( strcmp(Tcl_GetString(objv[3]), "NaN")==0 ){
+    sqlite3_int64 i;
+    i = 0xfff80000;
+    i <<= 32;
+    value = *(double*)(char*)&i;
+  }else if( Tcl_GetDoubleFromObj(interp, objv[3], &value) ){
+    return TCL_ERROR;
+  }
   rc = sqlite3_bind_double(pStmt, idx, value);
   if( sqlite3TestErrCode(interp, StmtToDb(pStmt), rc) ) return TCL_ERROR;
   if( rc!=SQLITE_OK ){