sixd Mon, 22 Mar 2010 22:37:20 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=296651
Log: name changes for consistency with planned additions Changed paths: D php/php-src/branches/PHP_5_3/ext/oci8/tests/bind_error.phpt A + php/php-src/branches/PHP_5_3/ext/oci8/tests/bind_rowid.phpt (from php/php-src/branches/PHP_5_3/ext/oci8/tests/rowid_bind.phpt:r296627) A + php/php-src/branches/PHP_5_3/ext/oci8/tests/error_bind.phpt (from php/php-src/branches/PHP_5_3/ext/oci8/tests/bind_error.phpt:r296250) A + php/php-src/branches/PHP_5_3/ext/oci8/tests/error_parse.phpt (from php/php-src/branches/PHP_5_3/ext/oci8/tests/parse_error.phpt:r296250) D php/php-src/branches/PHP_5_3/ext/oci8/tests/parse_error.phpt D php/php-src/branches/PHP_5_3/ext/oci8/tests/rowid_bind.phpt
Deleted: php/php-src/branches/PHP_5_3/ext/oci8/tests/bind_error.phpt =================================================================== --- php/php-src/branches/PHP_5_3/ext/oci8/tests/bind_error.phpt 2010-03-22 21:49:59 UTC (rev 296650) +++ php/php-src/branches/PHP_5_3/ext/oci8/tests/bind_error.phpt 2010-03-22 22:37:20 UTC (rev 296651) @@ -1,70 +0,0 @@ ---TEST-- -Test some oci_bind_by_name error conditions ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require(dirname(__FILE__).'/connect.inc'); - -$drop = "drop table bind_test"; -$statement = oci_parse($c, $drop); -...@oci_execute($statement); - -$create = "create table bind_test(name varchar(10))"; -$statement = oci_parse($c, $create); -oci_execute($statement); - - -echo "Insert value\n"; - -$name = 'abc'; -$stmt = oci_parse($c, "insert into bind_test values (:name)"); -oci_bind_by_name($stmt, ":name", $name, 10, SQLT_CHR); -var_dump(oci_execute($stmt)); - -echo "Test 1 - Assign a resource to the bind variable and execute \n"; -$name=$c; -var_dump(oci_execute($stmt)); - -echo "Test 2 - Re-bind a resource\n"; -oci_bind_by_name($stmt, ":name", $c); -var_dump(oci_execute($stmt)); -var_dump($c); - -// Use a connection resource instead of a ROWID. -echo "Test 3 - Resource mismatch !!\n"; -$stmt = oci_parse($c, "update bind_test set name='xyz' returning rowid into :r_id"); -oci_bind_by_name($stmt, ":r_id", $c); -var_dump(oci_execute($stmt)); - -// Clean up - -$drop = "drop table bind_test"; -$statement = oci_parse($c, $drop); -...@oci_execute($statement); - -echo "Done\n"; - -?> ---EXPECTF-- -Insert value -bool(true) -Test 1 - Assign a resource to the bind variable and execute - -Warning: oci_execute(): Invalid variable used for bind in %s on line %d -bool(false) -Test 2 - Re-bind a resource - -Warning: oci_bind_by_name(): Invalid variable used for bind in %s on line %d - -Warning: oci_execute(): Invalid variable used for bind in %s on line %d -bool(false) -resource(%d) of type (oci8 connection) -Test 3 - Resource mismatch !! - -Warning: oci_bind_by_name(): Invalid variable used for bind in %s on line %d - -Warning: oci_execute(): ORA-01008: %s on line %d -bool(false) -Done Copied: php/php-src/branches/PHP_5_3/ext/oci8/tests/bind_rowid.phpt (from rev 296627, php/php-src/branches/PHP_5_3/ext/oci8/tests/rowid_bind.phpt) =================================================================== --- php/php-src/branches/PHP_5_3/ext/oci8/tests/bind_rowid.phpt (rev 0) +++ php/php-src/branches/PHP_5_3/ext/oci8/tests/bind_rowid.phpt 2010-03-22 22:37:20 UTC (rev 296651) @@ -0,0 +1,86 @@ +--TEST-- +Test ROWID bind +--SKIPIF-- +<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> +--FILE-- +<?php + +require(dirname(__FILE__)."/connect.inc"); + +function do_query($c) +{ + $s = oci_parse($c, 'select address from rid_tab order by id'); + $id = 1; + oci_execute($s, OCI_DEFAULT); + while ($row = oci_fetch_array($s, OCI_ASSOC+OCI_RETURN_NULLS)) { + var_dump($row); + } +} + +$stmts = array( + "drop table rid_tab", + "create table rid_tab (id number, address varchar2(40))", + "insert into rid_tab (id, address) values (1, 'original text #1')", + "insert into rid_tab (id, address) values (2, 'original text #2')" +); + +foreach ($stmts as $q) { + $s = oci_parse($c, $q); + @oci_execute($s); +} + +echo "Initial Data\n"; +do_query($c); + +$s = oci_parse($c, 'select rowid, address from rid_tab where id = :l_bv for update'); +$id = 1; +oci_bind_by_name($s, ':l_bv', $id); +oci_execute($s, OCI_DEFAULT); +$row = oci_fetch_array($s, OCI_ASSOC+OCI_RETURN_NULLS); + +$rid = $row['ROWID']; +$addr = $row['ADDRESS']; + +$addr = 'Some new text'; + +// Save changes +$s = oci_parse($c,'update rid_tab set address = :a_bv where rowid = :r_bv'); +oci_bind_by_name($s, ':r_bv', $rid, -1, OCI_B_ROWID); +oci_bind_by_name($s, ':a_bv', $addr); +oci_execute($s); + +echo "Verify Change\n"; +do_query($c); + +// Cleanup + +$stmts = array("drop table rid_tab"); + +foreach ($stmts as $q) { + $s = oci_parse($c, $q); + @oci_execute($s); +} + +echo "Done\n"; + +?> +--EXPECT-- +Initial Data +array(1) { + ["ADDRESS"]=> + string(16) "original text #1" +} +array(1) { + ["ADDRESS"]=> + string(16) "original text #2" +} +Verify Change +array(1) { + ["ADDRESS"]=> + string(13) "Some new text" +} +array(1) { + ["ADDRESS"]=> + string(16) "original text #2" +} +Done Copied: php/php-src/branches/PHP_5_3/ext/oci8/tests/error_bind.phpt (from rev 296250, php/php-src/branches/PHP_5_3/ext/oci8/tests/bind_error.phpt) =================================================================== --- php/php-src/branches/PHP_5_3/ext/oci8/tests/error_bind.phpt (rev 0) +++ php/php-src/branches/PHP_5_3/ext/oci8/tests/error_bind.phpt 2010-03-22 22:37:20 UTC (rev 296651) @@ -0,0 +1,70 @@ +--TEST-- +Test some oci_bind_by_name error conditions +--SKIPIF-- +<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> +--FILE-- +<?php + +require(dirname(__FILE__).'/connect.inc'); + +$drop = "drop table bind_test"; +$statement = oci_parse($c, $drop); +...@oci_execute($statement); + +$create = "create table bind_test(name varchar(10))"; +$statement = oci_parse($c, $create); +oci_execute($statement); + + +echo "Insert value\n"; + +$name = 'abc'; +$stmt = oci_parse($c, "insert into bind_test values (:name)"); +oci_bind_by_name($stmt, ":name", $name, 10, SQLT_CHR); +var_dump(oci_execute($stmt)); + +echo "Test 1 - Assign a resource to the bind variable and execute \n"; +$name=$c; +var_dump(oci_execute($stmt)); + +echo "Test 2 - Re-bind a resource\n"; +oci_bind_by_name($stmt, ":name", $c); +var_dump(oci_execute($stmt)); +var_dump($c); + +// Use a connection resource instead of a ROWID. +echo "Test 3 - Resource mismatch !!\n"; +$stmt = oci_parse($c, "update bind_test set name='xyz' returning rowid into :r_id"); +oci_bind_by_name($stmt, ":r_id", $c); +var_dump(oci_execute($stmt)); + +// Clean up + +$drop = "drop table bind_test"; +$statement = oci_parse($c, $drop); +...@oci_execute($statement); + +echo "Done\n"; + +?> +--EXPECTF-- +Insert value +bool(true) +Test 1 - Assign a resource to the bind variable and execute + +Warning: oci_execute(): Invalid variable used for bind in %s on line %d +bool(false) +Test 2 - Re-bind a resource + +Warning: oci_bind_by_name(): Invalid variable used for bind in %s on line %d + +Warning: oci_execute(): Invalid variable used for bind in %s on line %d +bool(false) +resource(%d) of type (oci8 connection) +Test 3 - Resource mismatch !! + +Warning: oci_bind_by_name(): Invalid variable used for bind in %s on line %d + +Warning: oci_execute(): ORA-01008: %s on line %d +bool(false) +Done Copied: php/php-src/branches/PHP_5_3/ext/oci8/tests/error_parse.phpt (from rev 296250, php/php-src/branches/PHP_5_3/ext/oci8/tests/parse_error.phpt) =================================================================== --- php/php-src/branches/PHP_5_3/ext/oci8/tests/error_parse.phpt (rev 0) +++ php/php-src/branches/PHP_5_3/ext/oci8/tests/error_parse.phpt 2010-03-22 22:37:20 UTC (rev 296651) @@ -0,0 +1,142 @@ +--TEST-- +Test error handling when persistent connection is passed to oci_error() +--SKIPIF-- +<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> +--FILE-- +<?php + +// As part of the fix for Bug 42134, an error handling difference was +// noticed when oci_error() was passed a persistent connection. This +// was fixed and the behavior of oci_error() for all connections types +// was made consistent. + +require(dirname(__FILE__).'/details.inc'); + +// Test parse error for normal connection + +if (!empty($dbase)) { + $c1 = oci_connect($user,$password,$dbase); +} +else { + $c1 = oci_connect($user,$password); +} + +$s = @oci_parse($c1, "select ' from dual"); +if (!$s) { + echo "Normal connection: Parse error\n"; + $m = oci_error($c1); + var_dump($m); +} + +// Test parse error for new connection + +if (!empty($dbase)) { + $c2 = oci_new_connect($user,$password,$dbase); +} +else { + $c2 = oci_new_connect($user,$password); +} + +$s = @oci_parse($c2, "select ' from dual"); +if (!$s) { + echo "New connection: Parse error\n"; + $m = oci_error($c2); + var_dump($m); +} + +// Test parse error for persistent connection + +if (!empty($dbase)) { + $c3 = oci_pconnect($user,$password,$dbase); +} +else { + $c3 = oci_pconnect($user,$password); +} + +$s = @oci_parse($c3, "select ' from dual"); +if (!$s) { + echo "Persistent connection: Parse error\n"; + $m = oci_error($c3); + var_dump($m); +} + +// Verify that passing no connection doesn't affect future calls + +$m = oci_error(); +echo "No connection: error: "; +var_dump($m); + +// Check the errors are still accessible in the respective handles + +$m = oci_error($c1); +echo "Normal connection (take #2): Parse error: "; +echo $m["message"], "\n"; + +$m = oci_error($c2); +echo "New connection (take #2): Parse error: "; +echo $m["message"], "\n"; + +$m = oci_error($c3); +echo "Persistent connection (take #2): Parse error: "; +echo $m["message"], "\n"; + +// Now create a new error for a normal connection and check all again + +$s = @oci_new_collection($c1, "ABC"); +$m = oci_error($c1); +echo "Normal connection: New Collection error: "; +echo $m["message"], "\n"; + +$m = oci_error($c2); +echo "New connection (take #3): Parse error: "; +echo $m["message"], "\n"; + +$m = oci_error($c3); +echo "Persistent connection (take #3): Parse error: "; +echo $m["message"], "\n"; + +echo "Done\n"; + +?> +--EXPECTF-- +Normal connection: Parse error +array(4) { + ["code"]=> + int(1756) + ["message"]=> + string(48) "ORA-01756: quoted string not properly terminated" + ["offset"]=> + int(0) + ["sqltext"]=> + string(0) "" +} +New connection: Parse error +array(4) { + ["code"]=> + int(1756) + ["message"]=> + string(48) "ORA-01756: quoted string not properly terminated" + ["offset"]=> + int(0) + ["sqltext"]=> + string(0) "" +} +Persistent connection: Parse error +array(4) { + ["code"]=> + int(1756) + ["message"]=> + string(48) "ORA-01756: quoted string not properly terminated" + ["offset"]=> + int(0) + ["sqltext"]=> + string(0) "" +} +No connection: error: bool(false) +Normal connection (take #2): Parse error: ORA-01756: quoted string not properly terminated +New connection (take #2): Parse error: ORA-01756: quoted string not properly terminated +Persistent connection (take #2): Parse error: ORA-01756: quoted string not properly terminated +Normal connection: New Collection error: OCI-22303: type ""."ABC" not found +New connection (take #3): Parse error: ORA-01756: quoted string not properly terminated +Persistent connection (take #3): Parse error: ORA-01756: quoted string not properly terminated +Done Deleted: php/php-src/branches/PHP_5_3/ext/oci8/tests/parse_error.phpt =================================================================== --- php/php-src/branches/PHP_5_3/ext/oci8/tests/parse_error.phpt 2010-03-22 21:49:59 UTC (rev 296650) +++ php/php-src/branches/PHP_5_3/ext/oci8/tests/parse_error.phpt 2010-03-22 22:37:20 UTC (rev 296651) @@ -1,142 +0,0 @@ ---TEST-- -Test error handling when persistent connection is passed to oci_error() ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -// As part of the fix for Bug 42134, an error handling difference was -// noticed when oci_error() was passed a persistent connection. This -// was fixed and the behavior of oci_error() for all connections types -// was made consistent. - -require(dirname(__FILE__).'/details.inc'); - -// Test parse error for normal connection - -if (!empty($dbase)) { - $c1 = oci_connect($user,$password,$dbase); -} -else { - $c1 = oci_connect($user,$password); -} - -$s = @oci_parse($c1, "select ' from dual"); -if (!$s) { - echo "Normal connection: Parse error\n"; - $m = oci_error($c1); - var_dump($m); -} - -// Test parse error for new connection - -if (!empty($dbase)) { - $c2 = oci_new_connect($user,$password,$dbase); -} -else { - $c2 = oci_new_connect($user,$password); -} - -$s = @oci_parse($c2, "select ' from dual"); -if (!$s) { - echo "New connection: Parse error\n"; - $m = oci_error($c2); - var_dump($m); -} - -// Test parse error for persistent connection - -if (!empty($dbase)) { - $c3 = oci_pconnect($user,$password,$dbase); -} -else { - $c3 = oci_pconnect($user,$password); -} - -$s = @oci_parse($c3, "select ' from dual"); -if (!$s) { - echo "Persistent connection: Parse error\n"; - $m = oci_error($c3); - var_dump($m); -} - -// Verify that passing no connection doesn't affect future calls - -$m = oci_error(); -echo "No connection: error: "; -var_dump($m); - -// Check the errors are still accessible in the respective handles - -$m = oci_error($c1); -echo "Normal connection (take #2): Parse error: "; -echo $m["message"], "\n"; - -$m = oci_error($c2); -echo "New connection (take #2): Parse error: "; -echo $m["message"], "\n"; - -$m = oci_error($c3); -echo "Persistent connection (take #2): Parse error: "; -echo $m["message"], "\n"; - -// Now create a new error for a normal connection and check all again - -$s = @oci_new_collection($c1, "ABC"); -$m = oci_error($c1); -echo "Normal connection: New Collection error: "; -echo $m["message"], "\n"; - -$m = oci_error($c2); -echo "New connection (take #3): Parse error: "; -echo $m["message"], "\n"; - -$m = oci_error($c3); -echo "Persistent connection (take #3): Parse error: "; -echo $m["message"], "\n"; - -echo "Done\n"; - -?> ---EXPECTF-- -Normal connection: Parse error -array(4) { - ["code"]=> - int(1756) - ["message"]=> - string(48) "ORA-01756: quoted string not properly terminated" - ["offset"]=> - int(0) - ["sqltext"]=> - string(0) "" -} -New connection: Parse error -array(4) { - ["code"]=> - int(1756) - ["message"]=> - string(48) "ORA-01756: quoted string not properly terminated" - ["offset"]=> - int(0) - ["sqltext"]=> - string(0) "" -} -Persistent connection: Parse error -array(4) { - ["code"]=> - int(1756) - ["message"]=> - string(48) "ORA-01756: quoted string not properly terminated" - ["offset"]=> - int(0) - ["sqltext"]=> - string(0) "" -} -No connection: error: bool(false) -Normal connection (take #2): Parse error: ORA-01756: quoted string not properly terminated -New connection (take #2): Parse error: ORA-01756: quoted string not properly terminated -Persistent connection (take #2): Parse error: ORA-01756: quoted string not properly terminated -Normal connection: New Collection error: OCI-22303: type ""."ABC" not found -New connection (take #3): Parse error: ORA-01756: quoted string not properly terminated -Persistent connection (take #3): Parse error: ORA-01756: quoted string not properly terminated -Done Deleted: php/php-src/branches/PHP_5_3/ext/oci8/tests/rowid_bind.phpt =================================================================== --- php/php-src/branches/PHP_5_3/ext/oci8/tests/rowid_bind.phpt 2010-03-22 21:49:59 UTC (rev 296650) +++ php/php-src/branches/PHP_5_3/ext/oci8/tests/rowid_bind.phpt 2010-03-22 22:37:20 UTC (rev 296651) @@ -1,86 +0,0 @@ ---TEST-- -Test ROWID bind ---SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> ---FILE-- -<?php - -require(dirname(__FILE__)."/connect.inc"); - -function do_query($c) -{ - $s = oci_parse($c, 'select address from rid_tab order by id'); - $id = 1; - oci_execute($s, OCI_DEFAULT); - while ($row = oci_fetch_array($s, OCI_ASSOC+OCI_RETURN_NULLS)) { - var_dump($row); - } -} - -$stmts = array( - "drop table rid_tab", - "create table rid_tab (id number, address varchar2(40))", - "insert into rid_tab (id, address) values (1, 'original text #1')", - "insert into rid_tab (id, address) values (2, 'original text #2')" -); - -foreach ($stmts as $q) { - $s = oci_parse($c, $q); - @oci_execute($s); -} - -echo "Initial Data\n"; -do_query($c); - -$s = oci_parse($c, 'select rowid, address from rid_tab where id = :l_bv for update'); -$id = 1; -oci_bind_by_name($s, ':l_bv', $id); -oci_execute($s, OCI_DEFAULT); -$row = oci_fetch_array($s, OCI_ASSOC+OCI_RETURN_NULLS); - -$rid = $row['ROWID']; -$addr = $row['ADDRESS']; - -$addr = 'Some new text'; - -// Save changes -$s = oci_parse($c,'update rid_tab set address = :a_bv where rowid = :r_bv'); -oci_bind_by_name($s, ':r_bv', $rid, -1, OCI_B_ROWID); -oci_bind_by_name($s, ':a_bv', $addr); -oci_execute($s); - -echo "Verify Change\n"; -do_query($c); - -// Cleanup - -$stmts = array("drop table rid_tab"); - -foreach ($stmts as $q) { - $s = oci_parse($c, $q); - @oci_execute($s); -} - -echo "Done\n"; - -?> ---EXPECT-- -Initial Data -array(1) { - ["ADDRESS"]=> - string(16) "original text #1" -} -array(1) { - ["ADDRESS"]=> - string(16) "original text #2" -} -Verify Change -array(1) { - ["ADDRESS"]=> - string(13) "Some new text" -} -array(1) { - ["ADDRESS"]=> - string(16) "original text #2" -} -Done
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php