Annotation of embedaddon/php/ext/oci8/tests/drcp_scope5.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: DRCP: oci_pconnect() with scope end when oci8.old_oci_close_semantics ON
! 3: --SKIPIF--
! 4: <?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
! 5: --INI--
! 6: oci8.old_oci_close_semantics=1
! 7: --FILE--
! 8: <?php
! 9:
! 10: require dirname(__FILE__)."/drcp_functions.inc";
! 11: require dirname(__FILE__)."/details.inc";
! 12:
! 13: // Similar to drcp_scope3.phpt but does a commit before end of
! 14: // function2, allowing the table to be dropped cleanly at the end.
! 15:
! 16: // The test opens a connection within function1 and updates a table
! 17: // (without committing). Another connection is opened from function
! 18: // 2, and the table queried. When function1 ends, the connection from
! 19: // function1 is not closed, so the updated value will be seen in
! 20: // function2. Also the table can't be dropped because an uncommitted
! 21: // transaction exists.
! 22:
! 23: // Create the table
! 24: $c = oci_new_connect($user,$password,$dbase);
! 25: @drcp_drop_table($c);
! 26: drcp_create_table($c);
! 27:
! 28: echo "This is with a OCI_PCONNECT\n";
! 29: function1($user,$password,$dbase);
! 30:
! 31: // Should return the OLD value
! 32: function2($user,$password,$dbase);
! 33:
! 34: // This is the first scope for the script
! 35:
! 36: function function1($user,$password,$dbase)
! 37: {
! 38: var_dump($c = oci_pconnect($user,$password,$dbase));
! 39: drcp_update_table($c);
! 40: }
! 41:
! 42: // This is the second scope
! 43:
! 44: function function2($user,$password,$dbase)
! 45: {
! 46: var_dump($c = oci_pconnect($user,$password,$dbase));
! 47: drcp_select_value($c);
! 48: oci_commit($c);
! 49: }
! 50:
! 51: drcp_drop_table($c);
! 52: oci_close($c);
! 53:
! 54: echo "Done\n";
! 55:
! 56: ?>
! 57: --EXPECTF--
! 58: This is with a OCI_PCONNECT
! 59: resource(%d) of type (oci8 persistent connection)
! 60: Update done-- DEPT value has been set to NEWDEPT
! 61: resource(%d) of type (oci8 persistent connection)
! 62: The value of DEPT for id 105 is NEWDEPT
! 63: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>