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