conn_attr_5.phpt 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. --TEST--
  2. Set and get connection attributes with scope end.
  3. --EXTENSIONS--
  4. oci8
  5. --SKIPIF--
  6. <?php
  7. if (getenv('SKIP_REPEAT')) die('skip fails with repeat');
  8. $target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
  9. require(__DIR__.'/skipif.inc');
  10. if (strcasecmp($user, "system") && strcasecmp($user, "sys")) die("skip needs to be run as a DBA user");
  11. if ($test_drcp) die("skip output might vary with DRCP");
  12. preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches);
  13. if (!(isset($matches[0]) && $matches[1] >= 10)) {
  14. die("skip expected output only valid when using Oracle 10g or greater database server");
  15. }
  16. ?>
  17. --FILE--
  18. <?php
  19. $testuser = 'testuser_attr_5'; // Used in conn_attr.inc
  20. $testpassword = 'testuser';
  21. require(__DIR__."/conn_attr.inc");
  22. echo"**Test - Set and get values for the attributes with scope end ************\n";
  23. // Set the attributes in one scope and verify the values from another scope.
  24. set_scope();
  25. echo "Get the Values from a different scope \n";
  26. get_scope();
  27. function set_scope() {
  28. $conn1 = get_conn(1);
  29. set_attr($conn1,'CLIENT_INFO',50);
  30. set_attr($conn1,'CLIENT_IDENTIFIER',50);
  31. $conn2 = get_conn(3);
  32. set_attr($conn2,'ACTION',50);
  33. $conn3 = get_conn(2);
  34. set_attr($conn3,'MODULE',50);
  35. }
  36. function get_scope() {
  37. $conn1 = get_conn(1);
  38. get_attr($conn1,'CLIENT_INFO');
  39. get_attr($conn1,'CLIENT_IDENTIFIER');
  40. $conn2 = get_conn(3);
  41. get_attr($conn2,'ACTION');
  42. $conn3 = get_conn(2);
  43. get_attr($conn3,'MODULE');
  44. }
  45. clean_up($c);
  46. echo "Done";
  47. ?>
  48. --EXPECT--
  49. **Test - Set and get values for the attributes with scope end ************
  50. Testing with oci_connect()
  51. Value of CLIENT_INFO has been set successfully
  52. Value of CLIENT_IDENTIFIER has been set successfully
  53. Testing with oci_new_connect()
  54. Value of ACTION has been set successfully
  55. Testing with oci_pconnect()
  56. Value of MODULE has been set successfully
  57. Get the Values from a different scope
  58. Testing with oci_connect()
  59. The value of CLIENT_INFO is
  60. The value of CLIENT_IDENTIFIER is
  61. Testing with oci_new_connect()
  62. The value of ACTION is
  63. Testing with oci_pconnect()
  64. The value of MODULE is PHP TEST50
  65. Done