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