conn_attr_3.phpt 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. --TEST--
  2. Set and get of connection attributes with oci_close().
  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_3'; // 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 oci_close() ************\n";
  23. // With oci_connect ,oci_pconnect ,oci_new_connect
  24. var_dump($conn1 = get_conn(1)); //oci_connect()
  25. set_attr($conn1,'ACTION',1);
  26. get_attr($conn1,'ACTION');
  27. oci_close($conn1);
  28. // Open another connect and verify the value.
  29. var_dump($conn1 = get_conn(1)); //oci_connect()
  30. get_attr($conn1,'ACTION');
  31. oci_close($conn1);
  32. var_dump($pconn1 = get_conn(2)); //oci_pconnect()
  33. set_attr($pconn1,'MODULE',2);
  34. get_attr($pconn1,'MODULE');
  35. oci_close($pconn1);
  36. // Open another connect and verify the value.
  37. var_dump($pconn1 = get_conn(2)); //oci_pconnect()
  38. get_attr($pconn1,'MODULE');
  39. oci_close($pconn1);
  40. var_dump($nconn1 = get_conn(3)); //oci_new_connect()
  41. set_attr($nconn1,'CLIENT_INFO',3);
  42. set_attr($nconn1,'CLIENT_IDENTIFIER',3);
  43. get_attr($nconn1,'CLIENT_INFO');
  44. get_attr($nconn1,'CLIENT_IDENTIFIER');
  45. oci_close($nconn1);
  46. // Open another connect and verify the value.
  47. var_dump($nconn1 = get_conn(3)); //oci_new_connect()
  48. get_attr($nconn1,'CLIENT_INFO');
  49. get_attr($nconn1,'CLIENT_IDENTIFIER');
  50. oci_close($nconn1);
  51. clean_up($c);
  52. echo "Done\n";
  53. ?>
  54. --EXPECTF--
  55. **Test Set and get values for the attributes with oci_close() ************
  56. Testing with oci_connect()
  57. resource(%d) of type (oci8 connection)
  58. Value of ACTION has been set successfully
  59. The value of ACTION is TASK1
  60. Testing with oci_connect()
  61. resource(%d) of type (oci8 connection)
  62. The value of ACTION is
  63. Testing with oci_pconnect()
  64. resource(%d) of type (oci8 persistent connection)
  65. Value of MODULE has been set successfully
  66. The value of MODULE is PHP TEST2
  67. Testing with oci_pconnect()
  68. resource(%d) of type (oci8 persistent connection)
  69. The value of MODULE is PHP TEST2
  70. Testing with oci_new_connect()
  71. resource(%d) of type (oci8 connection)
  72. Value of CLIENT_INFO has been set successfully
  73. Value of CLIENT_IDENTIFIER has been set successfully
  74. The value of CLIENT_INFO is INFO13
  75. The value of CLIENT_IDENTIFIER is ID003
  76. Testing with oci_new_connect()
  77. resource(%d) of type (oci8 connection)
  78. The value of CLIENT_INFO is
  79. The value of CLIENT_IDENTIFIER is
  80. Done