Edit report at https://bugs.php.net/bug.php?id=61939&edit=1
ID: 61939 Comment by: slavb18 at gmail dot com Reported by: sim-mail at list dot ru Summary: PDO_FIREBIRD incorrect result of query for NUMERIC(x, y) type in 1 dialect Status: Not a bug Type: Bug Package: PDO related Operating System: Windows 7 32bit PHP Version: 5.3.12 Assigned To: mariuz Block user comment: N Private report: N New Comment: dialect 1 returning SQL_DOUBLE with var->sqlscale < 0 with quick and dirty patch ignoring var->sqlscale for SQL_DOUBLE, it works but returns not so pretty double numbers (with six digits after comma, like 123.450000 istead of 123.45) Previous Comments: ------------------------------------------------------------------------ [2012-07-06 07:52:51] mar...@php.net Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php Please use dialect 3 that is the default dialect for firebird 2.5 Dialect 1 will be deprecated ------------------------------------------------------------------------ [2012-07-06 06:26:39] mar...@php.net Currently it is possible to create databases in Dialect 1 and 3 only, however it is recommended that you use Dialect 3 exclusively, since Dialect 1 will eventually be deprecated. ------------------------------------------------------------------------ [2012-06-26 15:50:14] manubing at gmail dot com Also affected on macosx using PHP 5.3.10 and debian lenny with PHP 5.2.6-1+lenny16. Something odd: incorrect results are the same for a column for all rows fetched: using the previous example: public 'COST' => string '1.00' <-- Error All rows fetched will have 'COST' set to '1.00' (even if actual values differs) Running again the query will give another (eg: '600.000000') incorrect value, the same on all rows again. ------------------------------------------------------------------------ [2012-05-04 14:53:01] sim-mail at list dot ru only 1 dialect ------------------------------------------------------------------------ [2012-05-04 14:50:22] sim-mail at list dot ru Description: ------------ PDO_FIREBIRD incorrect result of query for NUMERIC(x, y) or DECIMAL (x, y) type <?php $sql = 'select * from price'; $dbh = new PDO('firebird:dbname=localhost:d:\interbasedata\test.fdb;charset=win1251', 'sysdba', 'masterkey'); $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $sth = $dbh->prepare($sql); $sth->execute(); $obj = $sth->fetch(); var_dump($obj); $sth = null; ?> Script print object(stdClass)[3] public 'ID' => string '1' (length=1) public 'NAME' => string 'my price' (length=8) public 'COST' => string '1.00' (length=4) <-- Error hear (correct result 12.34) Test script: --------------- Sql script for create database SET SQL DIALECT 1; SET NAMES WIN1251; CREATE DATABASE 'LOCALHOST:D:\interbasedata\test.fdb' USER 'SYSDBA' PASSWORD 'masterkey' PAGE_SIZE 16384 DEFAULT CHARACTER SET WIN1251 COLLATION WIN1251; CREATE TABLE PRICE ( ID INTEGER NOT NULL, NAME VARCHAR(10), COST NUMERIC(15,2) ); INSERT INTO PRICE (ID, NAME, COST) VALUES (1, 'my price', 12.34); COMMIT WORK; ALTER TABLE PRICE ADD CONSTRAINT PK_PRICE PRIMARY KEY (ID); ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=61939&edit=1