drcp_scope4.phpt 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. --TEST--
  2. DRCP: oci_pconnect() with scope end when oci8.old_oci_close_semantics OFF
  3. --EXTENSIONS--
  4. oci8
  5. --INI--
  6. oci8.old_oci_close_semantics=0
  7. --FILE--
  8. <?php
  9. require __DIR__."/drcp_functions.inc";
  10. require __DIR__."/details.inc";
  11. // The default expected behavior of this test is different between PHP
  12. // 5.2 and PHP 5.3
  13. //
  14. // In PHP 5.3, the test opens a connection within function1 and
  15. // updates a table (without committing). Another connection is opened
  16. // from function 2, and the table queried. When function1 ends, the
  17. // txn is rolled back and hence the updated value will not be
  18. // reflected in function2. Use oci8.old_oci_close_semantics=1 to
  19. // get old behavior
  20. // Create the table
  21. $c = oci_new_connect($user,$password,$dbase);
  22. @drcp_drop_table($c);
  23. drcp_create_table($c);
  24. echo "This is with a OCI_PCONNECT\n";
  25. function1($user,$password,$dbase);
  26. // Should return the OLD value
  27. function2($user,$password,$dbase);
  28. // This is the first scope for the script
  29. function function1($user,$password,$dbase)
  30. {
  31. var_dump($c = oci_pconnect($user,$password,$dbase));
  32. drcp_update_table($c);
  33. }
  34. // This is the second scope
  35. function function2($user,$password,$dbase)
  36. {
  37. var_dump($c = oci_pconnect($user,$password,$dbase));
  38. drcp_select_value($c);
  39. }
  40. drcp_drop_table($c);
  41. oci_close($c);
  42. echo "Done\n";
  43. ?>
  44. --EXPECTF--
  45. This is with a OCI_PCONNECT
  46. resource(%d) of type (oci8 persistent connection)
  47. Update done-- DEPT value has been set to NEWDEPT
  48. resource(%d) of type (oci8 persistent connection)
  49. The value of DEPT for id 105 is HR
  50. Done