- Updated pdo_pgsql tests to be 8.5+ friendly

This commit is contained in:
Matteo Beccati 2009-12-25 20:11:07 +00:00
parent acd8753c5d
commit 731466cca3
3 changed files with 9 additions and 5 deletions

View File

@ -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);

View File

@ -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));
}

View File

@ -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();
}
}