3 changed files with 103 additions and 4 deletions
-
11ext/pdo_firebird/firebird_statement.c
-
51ext/pdo_firebird/tests/bug_62024.phpt
-
45ext/pdo_firebird/tests/bug_64037.phpt
@ -0,0 +1,51 @@ |
|||
--TEST-- |
|||
Bug #62024 Cannot insert second row with null using parametrized query (Firebird PDO) |
|||
--SKIPIF-- |
|||
<?php extension_loaded("pdo_firebird") or die("skip"); ?> |
|||
<?php function_exists("ibase_query") or die("skip"); ?> |
|||
--FILE-- |
|||
<?php |
|||
|
|||
require("testdb.inc"); |
|||
|
|||
$dbh = new PDO("firebird:dbname=$test_base",$user,$password) or die; |
|||
$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING); |
|||
$value = '2'; |
|||
@$dbh->exec('DROP TABLE test_insert'); |
|||
$dbh->exec("CREATE TABLE test_insert (ID INTEGER NOT NULL, TEXT VARCHAR(10))"); |
|||
|
|||
$dbh->commit(); |
|||
|
|||
//start actual test |
|||
|
|||
$sql = "insert into test_insert (id, text) values (?, ?)"; |
|||
$sttmt = $dbh->prepare($sql); |
|||
|
|||
$args_ok = array(1, "test1"); |
|||
$args_err = array(2, null); |
|||
|
|||
$res = $sttmt->execute($args_ok); |
|||
var_dump($res); |
|||
|
|||
$res = $sttmt->execute($args_err); |
|||
var_dump($res); |
|||
|
|||
$dbh->commit(); |
|||
|
|||
|
|||
//teardown test data |
|||
$sttmt = $dbh->prepare('DELETE FROM test_insert'); |
|||
$sttmt->execute(); |
|||
|
|||
$dbh->commit(); |
|||
|
|||
$dbh->exec('DROP TABLE test_insert'); |
|||
|
|||
unset($sttmt); |
|||
unset($dbh); |
|||
|
|||
?> |
|||
--EXPECT-- |
|||
bool(true) |
|||
bool(true) |
|||
|
|||
@ -0,0 +1,45 @@ |
|||
--TEST-- |
|||
Bug #64037 Firebird return wrong value for numeric field |
|||
--SKIPIF-- |
|||
<?php extension_loaded("pdo_firebird") or die("skip"); ?> |
|||
<?php function_exists("ibase_query") or die("skip"); ?> |
|||
--FILE-- |
|||
<?php |
|||
|
|||
require("testdb.inc"); |
|||
|
|||
$dbh = new PDO("firebird:dbname=$test_base",$user,$password) or die; |
|||
$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING); |
|||
$value = '2'; |
|||
@$dbh->exec('DROP TABLE price'); |
|||
$dbh->exec("CREATE TABLE PRICE (ID INTEGER NOT NULL, TEXT VARCHAR(10), COST NUMERIC(15, 2))"); |
|||
$dbh->exec("INSERT INTO PRICE (ID, TEXT, COST) VALUES (1, 'test', -1.0)"); |
|||
$dbh->exec("INSERT INTO PRICE (ID, TEXT, COST) VALUES (2, 'test', -0.99)"); |
|||
$dbh->exec("INSERT INTO PRICE (ID, TEXT, COST) VALUES (3, 'test', -1.01)"); |
|||
|
|||
$dbh->commit(); |
|||
|
|||
$query = "SELECT * from price order by ID"; |
|||
$stmt = $dbh->prepare($query); |
|||
$stmt->execute(); |
|||
$rows = $stmt->fetchAll(); |
|||
var_dump($rows[0]['COST']); |
|||
var_dump($rows[1]['COST']); |
|||
var_dump($rows[2]['COST']); |
|||
|
|||
|
|||
$stmt = $dbh->prepare('DELETE FROM price'); |
|||
$stmt->execute(); |
|||
|
|||
$dbh->commit(); |
|||
|
|||
$dbh->exec('DROP TABLE price'); |
|||
|
|||
unset($stmt); |
|||
unset($dbh); |
|||
|
|||
?> |
|||
--EXPECT-- |
|||
string(5) "-1.00" |
|||
string(5) "-0.99" |
|||
string(5) "-1.01" |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue