]> granicus.if.org Git - php/commitdiff
- Updated pdo_pgsql tests to be 8.5+ friendly
authorMatteo Beccati <mbeccati@php.net>
Fri, 25 Dec 2009 20:11:07 +0000 (20:11 +0000)
committerMatteo Beccati <mbeccati@php.net>
Fri, 25 Dec 2009 20:11:07 +0000 (20:11 +0000)
ext/pdo/tests/bug_44861.phpt
ext/pdo_pgsql/tests/bug_33876.phpt
ext/pdo_pgsql/tests/bug_49985.phpt

index a3923729041b3ced9df82ef92a61352dcd8f6f18..3612561ed6a8104a8be96c24090908ce8fa6a8c3 100644 (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);
index 0ec04e8bd98fec07e941a3e65c9b4e5e69cc18dc..48618e13dba95cbed9db2b8fba6acc19e09ad5bc 100644 (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));
+}
 
 
 
index 7ada87630ab6ad0012d304cab7d81b894f03beb1..26dcfc617d244b166b79167619aa99e45bef9817 100644 (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();
     }
 }