driver_name_11gR2.phpt 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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] == 11 && $matches[2] >= 2))) {
  11. die("skip expected output only valid when using Oracle 11.2 database or its later patchsets");
  12. }
  13. preg_match('/^([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)/', oci_client_version(), $matches);
  14. if (!(isset($matches[0]) && ($matches[1] == 11 && $matches[2] >= 2) || ($matches[1] > 11))) {
  15. die("skip test expected to work only with Oracle 11.2 or greater version of client");
  16. }
  17. ?>
  18. --FILE--
  19. <?php
  20. require(__DIR__."/connect.inc");
  21. echo"**Test 1.1 - Default values for the attribute **************\n";
  22. get_attr($c);
  23. oci_close($c);
  24. echo"\n***Test 1.2 - Get the values from different connections **************\n";
  25. // with oci_pconnect()
  26. echo "Testing with oci_pconnect()\n";
  27. $pc1=oci_pconnect($user,$password,$dbase);
  28. get_attr($pc1);
  29. oci_close($pc1);
  30. echo "Testing with oci_new_connect()\n";
  31. $nc1=oci_new_connect($user,$password,$dbase);
  32. get_attr($nc1);
  33. oci_close($nc1);
  34. echo "Done\n";
  35. function get_attr($conn)
  36. {
  37. $sel_stmt = "select client_driver
  38. from v\$session_connect_info sci, v\$session s
  39. where sci.client_driver is not null
  40. and sci.sid = s.sid
  41. and s.audsid = userenv('SESSIONID')";
  42. $s2 = oci_parse($conn,$sel_stmt);
  43. oci_execute($s2,OCI_DEFAULT);
  44. oci_fetch($s2);
  45. echo "The value of DRIVER_NAME is ".trim(oci_result($s2,1))."\n";
  46. }
  47. ?>
  48. --EXPECT--
  49. **Test 1.1 - Default values for the attribute **************
  50. The value of DRIVER_NAME is PHP OCI8
  51. ***Test 1.2 - Get the values from different connections **************
  52. Testing with oci_pconnect()
  53. The value of DRIVER_NAME is PHP OCI8
  54. Testing with oci_new_connect()
  55. The value of DRIVER_NAME is PHP OCI8
  56. Done