driver_name.phpt 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. --TEST--
  2. Verify that the Driver Name attribute is set
  3. --SKIPIF--
  4. <?php if (!extension_loaded('oci8')) die("skip no oci8 extension");
  5. require(dirname(__FILE__)."/connect.inc");
  6. if (strcasecmp($user, "system") && strcasecmp($user, "sys")) die("skip needs to be run as a DBA user");
  7. if ($test_drcp) die("skip as Output might vary with DRCP");
  8. preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches);
  9. if (!(isset($matches[0]) &&
  10. (($matches[1] == 11 && $matches[2] >= 2) ||
  11. ($matches[1] >= 12)
  12. ))) {
  13. die("skip expected output only valid when using Oracle 11gR2 or greater database server");
  14. }
  15. preg_match('/^([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)/', oci_client_version(), $matches);
  16. if (!(isset($matches[0]) &&
  17. (($matches[1] == 11 && $matches[2] >= 2) ||
  18. ($matches[1] >= 12)
  19. ))) {
  20. die("skip test expected to work only with Oracle 11gR2 or greater version of client");
  21. }
  22. ?>
  23. --FILE--
  24. <?php
  25. require(dirname(__FILE__)."/connect.inc");
  26. echo"**Test 1.1 - Default values for the attribute **************\n";
  27. get_attr($c);
  28. oci_close($c);
  29. echo"\n***Test 1.2 - Get the values from different connections **************\n";
  30. // with oci_pconnect()
  31. echo "Testing with oci_pconnect()\n";
  32. $pc1=oci_pconnect($user,$password,$dbase);
  33. get_attr($pc1);
  34. oci_close($pc1);
  35. echo "Testing with oci_new_connect()\n";
  36. $nc1=oci_new_connect($user,$password,$dbase);
  37. get_attr($nc1);
  38. oci_close($nc1);
  39. echo "Done\n";
  40. function get_attr($conn)
  41. {
  42. $sel_stmt = "select client_driver
  43. from v\$session_connect_info sci, v\$session s
  44. where sci.client_driver is not null
  45. and sci.sid = s.sid
  46. and s.audsid = userenv('SESSIONID')";
  47. $s2 = oci_parse($conn,$sel_stmt);
  48. oci_execute($s2,OCI_DEFAULT);
  49. oci_fetch($s2);
  50. echo "The value of DRIVER_NAME is ".oci_result($s2,1)."\n";
  51. }
  52. ?>
  53. --EXPECT--
  54. **Test 1.1 - Default values for the attribute **************
  55. The value of DRIVER_NAME is PHP OCI8
  56. ***Test 1.2 - Get the values from different connections **************
  57. Testing with oci_pconnect()
  58. The value of DRIVER_NAME is PHP OCI8
  59. Testing with oci_new_connect()
  60. The value of DRIVER_NAME is PHP OCI8
  61. Done