conn_attr_1.phpt 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. --TEST--
  2. Set and get of connection attributes with all types of connections.
  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"))
  11. die("skip needs to be run as a DBA user");
  12. if ($test_drcp) die("skip output might vary with DRCP");
  13. preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches);
  14. if (!(isset($matches[0]) && $matches[1] >= 10)) {
  15. die("skip expected output only valid when using Oracle 10g or greater database server");
  16. }
  17. ?>
  18. --FILE--
  19. <?php
  20. $testuser = 'testuser_attr_1'; // Used in conn_attr.inc
  21. $testpassword = 'testuser';
  22. require(__DIR__."/conn_attr.inc");
  23. $attr_array = array('MODULE','ACTION','CLIENT_INFO','CLIENT_IDENTIFIER');
  24. echo"**Test 1.1 - Default values for the attributes **************\n";
  25. $c = get_conn(1);
  26. foreach($attr_array as $attr) {
  27. get_attr($c,$attr);
  28. }
  29. echo"**Test 1.2 - Set and get values for the attributes **************\n";
  30. // With oci_connect, oci_pconnect, oci_new_connect
  31. $conn1 = get_conn(1); //oci_connect()
  32. foreach($attr_array as $attr) {
  33. set_attr($conn1,$attr,1);
  34. get_attr($conn1,$attr);
  35. }
  36. $conn2 = get_conn(2); //oci_pconnect()
  37. foreach($attr_array as $attr) {
  38. set_attr($conn2,$attr,2);
  39. get_attr($conn2,$attr);
  40. }
  41. $conn3 = get_conn(3); //oci_new_connect()
  42. foreach($attr_array as $attr) {
  43. set_attr($conn3,$attr,3);
  44. get_attr($conn3,$attr);
  45. }
  46. // clean up
  47. oci_close($conn1);
  48. oci_close($conn2);
  49. oci_close($conn3);
  50. clean_up($c);
  51. echo "Done\n";
  52. ?>
  53. --EXPECTF--
  54. **Test 1.1 - Default values for the attributes **************
  55. Testing with oci_connect()
  56. The value of MODULE is %s
  57. The value of ACTION is
  58. The value of CLIENT_INFO is
  59. The value of CLIENT_IDENTIFIER is
  60. **Test 1.2 - Set and get values for the attributes **************
  61. Testing with oci_connect()
  62. Value of MODULE has been set successfully
  63. The value of MODULE is PHP TEST1
  64. Value of ACTION has been set successfully
  65. The value of ACTION is TASK1
  66. Value of CLIENT_INFO has been set successfully
  67. The value of CLIENT_INFO is INFO11
  68. Value of CLIENT_IDENTIFIER has been set successfully
  69. The value of CLIENT_IDENTIFIER is ID001
  70. Testing with oci_pconnect()
  71. Value of MODULE has been set successfully
  72. The value of MODULE is PHP TEST2
  73. Value of ACTION has been set successfully
  74. The value of ACTION is TASK2
  75. Value of CLIENT_INFO has been set successfully
  76. The value of CLIENT_INFO is INFO12
  77. Value of CLIENT_IDENTIFIER has been set successfully
  78. The value of CLIENT_IDENTIFIER is ID002
  79. Testing with oci_new_connect()
  80. Value of MODULE has been set successfully
  81. The value of MODULE is PHP TEST3
  82. Value of ACTION has been set successfully
  83. The value of ACTION is TASK3
  84. Value of CLIENT_INFO has been set successfully
  85. The value of CLIENT_INFO is INFO13
  86. Value of CLIENT_IDENTIFIER has been set successfully
  87. The value of CLIENT_IDENTIFIER is ID003
  88. Done