Bug #65690 [Com]: PDO_Firebird returns wrong results with numeric 15,2 and dialect 1
| From: | dorin dot marcoci at gmail dot com | Date: | Mon, 30 Jan 2017 08:18:24 +0000 |
| Subject: | Bug #65690 [Com]: PDO_Firebird returns wrong results with numeric 15,2 and dialect 1 | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-207036@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=65690&edit=1
ID: 65690
Comment by: dorin dot marcoci at gmail dot com
Reported by: slavb18 at gmail dot com
Summary: PDO_Firebird returns wrong results with numeric
15,2 and dialect 1
Status: Assigned
Type: Bug
Package: PDO Firebird
Operating System: any
PHP Version: 5.4.19
Assigned To: mariuz
Block user comment: N
Private report: N
New Comment:
Slavb18,
I found this patch not so viable across Firebird dialects.
It just check for SQL_DOUBLE and sqlscale, behavior that may change and/or be different across
existing or next dialects.
Currently PDO driver connects by default using 3rd dialect and no other handling is done in terms of
specifics.
A nice solution will be to read and take into account the database dialect when connecting to a FB
database and on next operations like data fetches, parameters handling, etc...
Previous Comments:
------------------------------------------------------------------------
[2017-01-09 10:23:38] slavb18 at gmail dot com
dialect 1 is still used in legacy databases, why not fix, if patch exists for three years
------------------------------------------------------------------------
[2017-01-09 06:42:28] dorin dot marcoci at gmail dot com
Still anyone uses dialect 1? It is pending to be deprecated.
Is it worth to fix this bug? It will involve additional FB specific flag/parameter to PDO, in order
to deal right with dialects.
------------------------------------------------------------------------
[2016-03-03 13:45:31] cmb@php.net
Related To: Bug #71652
------------------------------------------------------------------------
[2013-09-17 13:28:50] slavb18 at gmail dot com
forget to attach php script:
...
$sql="select * FROM TESTPDO";
$sth = $pdo->prepare($sql);
$sth->execute();
$obj = $sth->fetch();
print_r($obj);
------------------------------------------------------------------------
[2013-09-17 13:14:57] slavb18 at gmail dot com
Description:
------------
PDO_Firebird returns wrong results with numeric (15,2) and dialect 1
dialect 1 returns numeric (15,2) as SQL_DOUBLE and sqlscale < 0,
I know this was reported before but this report is with patch
Test script:
---------------
create or alter procedure testpdo
returns (
res numeric(15,2),
res2 numeric(5,2))
as
begin
RES=123.45;
RES2=123.45;
suspend;
end
Expected result:
----------------
Array
(
[RES] => 123.45
[0] => 123.45
[RES2] => 123.45
[1] => 123.45
)
Actual result:
--------------
Array
(
[RES] => 0.04
[0] => 0.04
[RES2] => 123.45
[1] => 123.45
)
(or any other number istead of 0.04 as variable "n" is unitilized in case of SQL_DOUBLE)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=65690&edit=1