driver_name.phpt 2.2 KB

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