Annotation of embedaddon/php/ext/pdo_firebird/tests/bug_64037.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Bug #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:
! 9: require("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();
! 26: var_dump($rows[0]['COST']);
! 27: var_dump($rows[1]['COST']);
! 28: var_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:
! 38: unset($stmt);
! 39: unset($dbh);
! 40:
! 41: ?>
! 42: --EXPECT--
! 43: string(5) "-1.00"
! 44: string(5) "-0.99"
! 45: string(5) "-1.01"
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>