johannes Mon, 25 Jan 2010 17:02:37 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=294001
Log: merge postgresql 8.5 test changes (mbeccati) -r292630 - Updated pdo_pgsql tests to be 8.5+ friendly -r292633 - Updated ext/pgsql tests to work w/ PostgreSQL 8.5 -r292634 - Removed spurious high-ascii char from previous commmit Changed paths: _U php/php-src/branches/PHP_5_3_2/ U php/php-src/branches/PHP_5_3_2/ext/pdo/tests/bug_44861.phpt U php/php-src/branches/PHP_5_3_2/ext/pdo_pgsql/tests/bug_33876.phpt U php/php-src/branches/PHP_5_3_2/ext/pdo_pgsql/tests/bug_49985.phpt U php/php-src/branches/PHP_5_3_2/ext/pgsql/tests/10pg_convert.phpt A + php/php-src/branches/PHP_5_3_2/ext/pgsql/tests/10pg_convert_85.phpt (from php/php-src/branches/PHP_5_3/ext/pgsql/tests/10pg_convert_85.phpt:r292633) U php/php-src/branches/PHP_5_3_2/ext/pgsql/tests/12pg_insert.phpt A + php/php-src/branches/PHP_5_3_2/ext/pgsql/tests/12pg_insert_85.phpt (from php/php-src/branches/PHP_5_3/ext/pgsql/tests/12pg_insert_85.phpt:r292633) U php/php-src/branches/PHP_5_3_2/ext/pgsql/tests/13pg_select.phpt A + php/php-src/branches/PHP_5_3_2/ext/pgsql/tests/13pg_select_85.phpt (from php/php-src/branches/PHP_5_3/ext/pgsql/tests/13pg_select_85.phpt:r292633) U php/php-src/branches/PHP_5_3_2/ext/pgsql/tests/14pg_update.phpt A + php/php-src/branches/PHP_5_3_2/ext/pgsql/tests/14pg_update_85.phpt (from php/php-src/branches/PHP_5_3/ext/pgsql/tests/14pg_update_85.phpt:r292633) U php/php-src/branches/PHP_5_3_2/ext/pgsql/tests/bug37100.phpt A + php/php-src/branches/PHP_5_3_2/ext/pgsql/tests/bug37100_85.phpt (from php/php-src/branches/PHP_5_3/ext/pgsql/tests/bug37100_85.phpt:r292633) U php/php-src/branches/PHP_5_3_2/ext/pgsql/tests/skipif.inc
Property changes on: php/php-src/branches/PHP_5_3_2 ___________________________________________________________________ Modified: svn:mergeinfo - /php/php-src/branches/PHP_5_3:292504,292574,292594-292595,292611,292624 /php/php-src/trunk:284726 + /php/php-src/branches/PHP_5_3:292504,292574,292594-292595,292611,292624,292630,292633-292634 /php/php-src/trunk:284726 Modified: php/php-src/branches/PHP_5_3_2/ext/pdo/tests/bug_44861.phpt =================================================================== --- php/php-src/branches/PHP_5_3_2/ext/pdo/tests/bug_44861.phpt 2010-01-25 16:46:55 UTC (rev 294000) +++ php/php-src/branches/PHP_5_3_2/ext/pdo/tests/bug_44861.phpt 2010-01-25 17:02:37 UTC (rev 294001) @@ -32,7 +32,7 @@ $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); Modified: php/php-src/branches/PHP_5_3_2/ext/pdo_pgsql/tests/bug_33876.phpt =================================================================== --- php/php-src/branches/PHP_5_3_2/ext/pdo_pgsql/tests/bug_33876.phpt 2010-01-25 16:46:55 UTC (rev 294000) +++ php/php-src/branches/PHP_5_3_2/ext/pdo_pgsql/tests/bug_33876.phpt 2010-01-25 17:02:37 UTC (rev 294001) @@ -80,10 +80,14 @@ # 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)); +} Modified: php/php-src/branches/PHP_5_3_2/ext/pdo_pgsql/tests/bug_49985.phpt =================================================================== --- php/php-src/branches/PHP_5_3_2/ext/pdo_pgsql/tests/bug_49985.phpt 2010-01-25 16:46:55 UTC (rev 294000) +++ php/php-src/branches/PHP_5_3_2/ext/pdo_pgsql/tests/bug_49985.phpt 2010-01-25 17:02:37 UTC (rev 294001) @@ -22,7 +22,7 @@ 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(); } } Modified: php/php-src/branches/PHP_5_3_2/ext/pgsql/tests/10pg_convert.phpt =================================================================== --- php/php-src/branches/PHP_5_3_2/ext/pgsql/tests/10pg_convert.phpt 2010-01-25 16:46:55 UTC (rev 294000) +++ php/php-src/branches/PHP_5_3_2/ext/pgsql/tests/10pg_convert.phpt 2010-01-25 17:02:37 UTC (rev 294001) @@ -1,7 +1,10 @@ --TEST-- PostgreSQL pg_convert() --SKIPIF-- -<?php include("skipif.inc"); ?> +<?php +include("skipif.inc"); +skip_server_version('8.5dev', '>='); +?> --FILE-- <?php error_reporting(E_ALL); Copied: php/php-src/branches/PHP_5_3_2/ext/pgsql/tests/10pg_convert_85.phpt (from rev 292633, php/php-src/branches/PHP_5_3/ext/pgsql/tests/10pg_convert_85.phpt) =================================================================== --- php/php-src/branches/PHP_5_3_2/ext/pgsql/tests/10pg_convert_85.phpt (rev 0) +++ php/php-src/branches/PHP_5_3_2/ext/pgsql/tests/10pg_convert_85.phpt 2010-01-25 17:02:37 UTC (rev 294001) @@ -0,0 +1,29 @@ +--TEST-- +PostgreSQL pg_convert() (8.5+) +--SKIPIF-- +<?php +include("skipif.inc"); +skip_server_version('8.5dev', '<'); +?> +--FILE-- +<?php +error_reporting(E_ALL); + +include 'config.inc'; + +$db = pg_connect($conn_str); + +$fields = array('num'=>'1234', 'str'=>'AAA', 'bin'=>'BBB'); +$converted = pg_convert($db, $table_name, $fields); + +var_dump($converted); +?> +--EXPECT-- +array(3) { + ["num"]=> + string(4) "1234" + ["str"]=> + string(5) "'AAA'" + ["bin"]=> + string(11) "'\\x424242'" +} Modified: php/php-src/branches/PHP_5_3_2/ext/pgsql/tests/12pg_insert.phpt =================================================================== --- php/php-src/branches/PHP_5_3_2/ext/pgsql/tests/12pg_insert.phpt 2010-01-25 16:46:55 UTC (rev 294000) +++ php/php-src/branches/PHP_5_3_2/ext/pgsql/tests/12pg_insert.phpt 2010-01-25 17:02:37 UTC (rev 294001) @@ -1,7 +1,10 @@ --TEST-- PostgreSQL pg_insert() --SKIPIF-- -<?php include("skipif.inc"); ?> +<?php +include("skipif.inc"); +skip_server_version('8.5dev', '>='); +?> --FILE-- <?php error_reporting(E_ALL); Copied: php/php-src/branches/PHP_5_3_2/ext/pgsql/tests/12pg_insert_85.phpt (from rev 292633, php/php-src/branches/PHP_5_3/ext/pgsql/tests/12pg_insert_85.phpt) =================================================================== --- php/php-src/branches/PHP_5_3_2/ext/pgsql/tests/12pg_insert_85.phpt (rev 0) +++ php/php-src/branches/PHP_5_3_2/ext/pgsql/tests/12pg_insert_85.phpt 2010-01-25 17:02:37 UTC (rev 294001) @@ -0,0 +1,24 @@ +--TEST-- +PostgreSQL pg_insert() (8.5+) +--SKIPIF-- +<?php +include("skipif.inc"); +skip_server_version('8.5dev', '<'); +?> +--FILE-- +<?php +error_reporting(E_ALL); + +include 'config.inc'; + +$db = pg_connect($conn_str); +$fields = array('num'=>'1234', 'str'=>'AAA', 'bin'=>'BBB'); + +pg_insert($db, $table_name, $fields) or print "Error in test 1\n"; +echo pg_insert($db, $table_name, $fields, PGSQL_DML_STRING)."\n"; + +echo "Ok\n"; +?> +--EXPECT-- +INSERT INTO php_pgsql_test (num,str,bin) VALUES (1234,'AAA','\\x424242'); +Ok Modified: php/php-src/branches/PHP_5_3_2/ext/pgsql/tests/13pg_select.phpt =================================================================== --- php/php-src/branches/PHP_5_3_2/ext/pgsql/tests/13pg_select.phpt 2010-01-25 16:46:55 UTC (rev 294000) +++ php/php-src/branches/PHP_5_3_2/ext/pgsql/tests/13pg_select.phpt 2010-01-25 17:02:37 UTC (rev 294001) @@ -1,7 +1,10 @@ --TEST-- PostgreSQL pg_select() --SKIPIF-- -<?php include("skipif.inc"); ?> +<?php +include("skipif.inc"); +skip_server_version('8.5dev', '>='); +?> --FILE-- <?php error_reporting(E_ALL); Copied: php/php-src/branches/PHP_5_3_2/ext/pgsql/tests/13pg_select_85.phpt (from rev 292633, php/php-src/branches/PHP_5_3/ext/pgsql/tests/13pg_select_85.phpt) =================================================================== --- php/php-src/branches/PHP_5_3_2/ext/pgsql/tests/13pg_select_85.phpt (rev 0) +++ php/php-src/branches/PHP_5_3_2/ext/pgsql/tests/13pg_select_85.phpt 2010-01-25 17:02:37 UTC (rev 294001) @@ -0,0 +1,37 @@ +--TEST-- +PostgreSQL pg_select() (8.5+) +--SKIPIF-- +<?php +include("skipif.inc"); +skip_server_version('8.5dev', '<'); +?> +--FILE-- +<?php +error_reporting(E_ALL); + +include 'config.inc'; + +$db = pg_connect($conn_str); +$fields = array('num'=>'1234', 'str'=>'ABC', 'bin'=>'XYZ'); +$ids = array('num'=>'1234'); + +$res = pg_select($db, $table_name, $ids) or print "Error\n"; +var_dump($res); +echo pg_select($db, $table_name, $ids, PGSQL_DML_STRING)."\n"; +echo "Ok\n"; + +?> +--EXPECT-- +array(1) { + [0]=> + array(3) { + ["num"]=> + string(4) "1234" + ["str"]=> + string(3) "AAA" + ["bin"]=> + string(8) "\x424242" + } +} +SELECT * FROM php_pgsql_test WHERE num=1234; +Ok Modified: php/php-src/branches/PHP_5_3_2/ext/pgsql/tests/14pg_update.phpt =================================================================== --- php/php-src/branches/PHP_5_3_2/ext/pgsql/tests/14pg_update.phpt 2010-01-25 16:46:55 UTC (rev 294000) +++ php/php-src/branches/PHP_5_3_2/ext/pgsql/tests/14pg_update.phpt 2010-01-25 17:02:37 UTC (rev 294001) @@ -1,7 +1,10 @@ --TEST-- PostgreSQL pg_update() --SKIPIF-- -<?php include("skipif.inc"); ?> +<?php +include("skipif.inc"); +skip_server_version('8.5dev', '>='); +?> --FILE-- <?php error_reporting(E_ALL); Copied: php/php-src/branches/PHP_5_3_2/ext/pgsql/tests/14pg_update_85.phpt (from rev 292633, php/php-src/branches/PHP_5_3/ext/pgsql/tests/14pg_update_85.phpt) =================================================================== --- php/php-src/branches/PHP_5_3_2/ext/pgsql/tests/14pg_update_85.phpt (rev 0) +++ php/php-src/branches/PHP_5_3_2/ext/pgsql/tests/14pg_update_85.phpt 2010-01-25 17:02:37 UTC (rev 294001) @@ -0,0 +1,25 @@ +--TEST-- +PostgreSQL pg_update() (8.5+) +--SKIPIF-- +<?php +include("skipif.inc"); +skip_server_version('8.5dev', '<'); +?> +--FILE-- +<?php +error_reporting(E_ALL); + +include 'config.inc'; + +$db = pg_connect($conn_str); +$fields = array('num'=>'1234', 'str'=>'ABC', 'bin'=>'XYZ'); +$ids = array('num'=>'1234'); + +pg_update($db, $table_name, $fields, $ids) or print "Error in test 1\n"; +echo pg_update($db, $table_name, $fields, $ids, PGSQL_DML_STRING)."\n"; + +echo "Ok\n"; +?> +--EXPECT-- +UPDATE php_pgsql_test SET num=1234,str='ABC',bin='\\x58595a' WHERE num=1234; +Ok Modified: php/php-src/branches/PHP_5_3_2/ext/pgsql/tests/bug37100.phpt =================================================================== --- php/php-src/branches/PHP_5_3_2/ext/pgsql/tests/bug37100.phpt 2010-01-25 16:46:55 UTC (rev 294000) +++ php/php-src/branches/PHP_5_3_2/ext/pgsql/tests/bug37100.phpt 2010-01-25 17:02:37 UTC (rev 294001) @@ -1,7 +1,10 @@ --TEST-- Bug #37100 (data is returned truncated with BINARY CURSOR) --SKIPIF-- -<?php include("skipif.inc"); ?> +<?php +include("skipif.inc"); +skip_server_version('8.5dev', '>='); +?> --FILE-- <?php Copied: php/php-src/branches/PHP_5_3_2/ext/pgsql/tests/bug37100_85.phpt (from rev 292633, php/php-src/branches/PHP_5_3/ext/pgsql/tests/bug37100_85.phpt) =================================================================== --- php/php-src/branches/PHP_5_3_2/ext/pgsql/tests/bug37100_85.phpt (rev 0) +++ php/php-src/branches/PHP_5_3_2/ext/pgsql/tests/bug37100_85.phpt 2010-01-25 17:02:37 UTC (rev 294001) @@ -0,0 +1,46 @@ +--TEST-- +Bug #37100 (data is returned truncated with BINARY CURSOR) (8.5+) +--SKIPIF-- +<?php +include("skipif.inc"); +skip_server_version('8.5dev', '<'); +?> +--FILE-- +<?php + +include 'config.inc'; + +$db = pg_connect($conn_str); + +...@pg_query('DROP TABLE test_bug'); + +pg_query('CREATE TABLE test_bug (binfield byteA) ;'); +pg_query("INSERT INTO test_bug VALUES (decode('0103AA000812','hex'))"); + + +$data = pg_query("SELECT binfield FROM test_bug"); +$res = pg_fetch_result($data,0); +var_dump($res); +var_dump(bin2hex(pg_unescape_bytea($res))); + +$sql = "BEGIN; DECLARE mycursor BINARY CURSOR FOR SELECT binfield FROM test_bug; FETCH ALL IN mycursor;"; + +$data = pg_query($sql); +$res = pg_fetch_result($data,0); + +var_dump(strlen($res)); +var_dump(bin2hex($res)); + +pg_close($db); + +$db = pg_connect($conn_str); +pg_query('DROP TABLE test_bug'); +pg_close($db); + + +?> +--EXPECT-- +string(14) "\x0103aa000812" +string(12) "0103aa000812" +int(6) +string(12) "0103aa000812" Modified: php/php-src/branches/PHP_5_3_2/ext/pgsql/tests/skipif.inc =================================================================== --- php/php-src/branches/PHP_5_3_2/ext/pgsql/tests/skipif.inc 2010-01-25 16:46:55 UTC (rev 294000) +++ php/php-src/branches/PHP_5_3_2/ext/pgsql/tests/skipif.inc 2010-01-25 17:02:37 UTC (rev 294001) @@ -15,4 +15,17 @@ if (!is_resource($conn)) { die("skip could not connect\n"); } -?> \ No newline at end of file + +function skip_server_version($version, $op = '<') { _skip_version('server', $version, $op); } +function skip_client_version($version, $op = '<') { _skip_version('client', $version, $op); } + + +function _skip_version($type, $version, $op) +{ + $pg = pg_parameter_status($type.'_version'); + if (version_compare($pg, $version, $op)) { + die("skip {$type} version {$pg} is {$op} {$version}\n"); + } +} + +?>
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php