mirror of
https://github.com/php/php-src.git
synced 2024-12-29 19:59:19 +08:00
- Updated pdo_pgsql tests to be 8.5+ friendly
This commit is contained in:
parent
acd8753c5d
commit
731466cca3
@ -32,7 +32,7 @@ if ($db->getAttribute(PDO::ATTR_DRIVER_NAME) == 'oci') {
|
||||
$from = '';
|
||||
}
|
||||
|
||||
$query = "SELECT 'row1' AS r $from UNION SELECT 'row2' $from UNION SELECT 'row3' $from UNION SELECT 'row4' $from";
|
||||
$query = "SELECT 'row1' AS r $from UNION SELECT 'row2' $from UNION SELECT 'row3' $from UNION SELECT 'row4' $from ORDER BY r";
|
||||
$aParams = array(PDO::ATTR_CURSOR => PDO::CURSOR_SCROLL);
|
||||
|
||||
$res = $db->prepare($query, $aParams);
|
||||
|
@ -80,10 +80,14 @@ else
|
||||
|
||||
# Expected to fail; unless told otherwise, PDO assumes string inputs
|
||||
# false -> "" as string, which pgsql doesn't like
|
||||
if (!$res->execute(array(false)))
|
||||
print_r($res->errorInfo());
|
||||
else
|
||||
if (!$res->execute(array(false))) {
|
||||
$err = $res->errorInfo();
|
||||
// Strip additional lines ouputted by recent PgSQL versions
|
||||
$err[2] = trim(current(explode("\n", $err[2])));
|
||||
print_r($err);
|
||||
} else {
|
||||
print_r($res->fetchAll(PDO::FETCH_ASSOC));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -22,7 +22,7 @@ for ($i = 0; $i < 3; $i++) {
|
||||
var_dump($stmt->execute(array(1)));
|
||||
$db->commit();
|
||||
} catch (Exception $e) {
|
||||
echo $e->getMessage()."\n";
|
||||
echo trim(current(explode("\n", $e->getMessage())))."\n";
|
||||
$db->rollback();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user