Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.12.3

Bug #15481 float values are quoted
Submitted: 2009-01-02 02:25 UTC
From: ukiewel Assigned: danielc
Status: No Feedback Package: DB (version 1.7.13)
PHP Version: 5.2.8 OS: Linux
Roadmaps: (Not assigned)    
Subscription  


 [2009-01-02 02:25 UTC] ukiewel (Uwe Kiewel)
Description: ------------ Integer values are passed correctly to the database backend (DB2 via ODBC) float values are being quoted. That quote is imho a bug. Float values have also passed unquoted to the database backend. Test script: --------------- $dbh->query($update, array(2, 3.5, 4.5, 24)); Expected result: ---------------- correct statemend passed to the db with unquoted numeric values Actual result: -------------- integers are unquoted, floats are quoted: from the DB2 trace: UPDATE policy SET spam_tag_level = 2, spam_tag2_level = '3.5', spam_kill_level = '4.5' WHERE id = 48

Comments

 [2009-01-02 02:49 UTC] ukiewel (Uwe Kiewel)
due to an upload problem here the really short patch: Index: common.php =================================================================== --- common.php (revision 24) +++ common.php (working copy) @@ -442,7 +442,9 @@ if (is_int($in)) { return $in; } elseif (is_float($in)) { - return $this->quoteFloat($in); + if ($this->dbsyntax == 'db2') { + return $in; + } else return $this->quoteFloat($in); } elseif (is_bool($in)) { return $this->quoteBoolean($in); } elseif (is_null($in)) {
 [2010-01-08 09:55 UTC] danielc (Daniel Convissor)
-Status: Analyzed +Status: Feedback
What happens? When I was fixing the DB2 driver for PEAR DB (years ago), I never ran into any problems along these lines when running PEAR DB's test suite.
 [2010-07-30 17:30 UTC] danielc (Daniel Convissor)
-Status: Feedback +Status: No Feedback -Assigned To: +Assigned To: danielc