drcp_scope3.phpt 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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. require dirname(__FILE__)."/drcp_functions.inc";
  10. require dirname(__FILE__)."/details.inc";
  11. // The test opens a connection within function1 and updates a table
  12. // (without committing). Another connection is opened from function
  13. // 2, and the table queried. When function1 ends, the connection from
  14. // function1 is not closed, so the updated value will be seen in
  15. // function2. Also the table can't be dropped because an uncommitted
  16. // transaction exists.
  17. // Create the table
  18. $c = oci_new_connect($user,$password,$dbase);
  19. @drcp_drop_table($c);
  20. drcp_create_table($c);
  21. echo "This is with a OCI_PCONNECT\n";
  22. function1($user,$password,$dbase);
  23. // Should return the OLD value
  24. function2($user,$password,$dbase);
  25. // This is the first scope for the script
  26. function function1($user,$password,$dbase)
  27. {
  28. var_dump($c = oci_pconnect($user,$password,$dbase));
  29. drcp_update_table($c);
  30. }
  31. // This is the second scope
  32. function function2($user,$password,$dbase)
  33. {
  34. var_dump($c = oci_pconnect($user,$password,$dbase));
  35. drcp_select_value($c);
  36. }
  37. drcp_drop_table($c);
  38. oci_close($c);
  39. echo "Done\n";
  40. ?>
  41. --EXPECTF--
  42. This is with a OCI_PCONNECT
  43. resource(%d) of type (oci8 persistent connection)
  44. Update done-- DEPT value has been set to NEWDEPT
  45. resource(%d) of type (oci8 persistent connection)
  46. The value of DEPT for id 105 is NEWDEPT
  47. Warning: oci_execute(): ORA-00054: %s
  48. Done