1--TEST--
2Bug #64037 Firebird return wrong value for numeric field
3--SKIPIF--
4<?php extension_loaded("pdo_firebird") or die("skip"); ?>
5<?php function_exists("ibase_query") or die("skip"); ?>
6--FILE--
7<?php
8
9require("testdb.inc");
10
11$dbh = new PDO("firebird:dbname=$test_base",$user,$password) or die;
12$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
13$value = '2';
14@$dbh->exec('DROP TABLE price');
15$dbh->exec("CREATE TABLE PRICE (ID INTEGER NOT NULL, TEXT VARCHAR(10), COST NUMERIC(15, 2))");
16$dbh->exec("INSERT INTO PRICE (ID, TEXT, COST) VALUES (1, 'test', -1.0)");
17$dbh->exec("INSERT INTO PRICE (ID, TEXT, COST) VALUES (2, 'test', -0.99)");
18$dbh->exec("INSERT INTO PRICE (ID, TEXT, COST) VALUES (3, 'test', -1.01)");
19
20$dbh->commit();
21
22$query = "SELECT * from price order by ID";
23$stmt = $dbh->prepare($query);
24$stmt->execute();
25$rows = $stmt->fetchAll();
26var_dump($rows[0]['COST']);
27var_dump($rows[1]['COST']);
28var_dump($rows[2]['COST']);
29
30
31$stmt = $dbh->prepare('DELETE FROM price');
32$stmt->execute();
33
34$dbh->commit();
35
36$dbh->exec('DROP TABLE price');
37
38unset($stmt);
39unset($dbh);
40
41?>
42--EXPECT--
43string(5) "-1.00"
44string(5) "-0.99"
45string(5) "-1.01"