db_op_2.phpt 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. --TEST--
  2. oci_set_db_operation: basic test for end-to-end tracing
  3. --SKIPIF--
  4. <?php
  5. if (!extension_loaded('oci8')) die ("skip no oci8 extension");
  6. $target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
  7. require(dirname(__FILE__).'/skipif.inc');
  8. if (strcasecmp($user, "system") && strcasecmp($user, "sys")) {
  9. die("skip needs to be run as a DBA user");
  10. }
  11. preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches);
  12. if (!(isset($matches[0]) && $matches[1] >= 12)) {
  13. die("skip expected output only valid when using Oracle Database 12c or greater");
  14. }
  15. preg_match('/^[[:digit:]]+/', oci_client_version(), $matches);
  16. if (!(isset($matches[0]) && $matches[0] >= 12)) {
  17. die("skip works only with Oracle 12c or greater version of Oracle client libraries");
  18. }
  19. if (!function_exists('oci_set_db_operation'))
  20. {
  21. die("skip function oci_set_db_operation() does not exist");
  22. }
  23. ?>
  24. --FILE--
  25. <?php
  26. require(dirname(__FILE__).'/connect.inc');
  27. function dq($c, $q)
  28. {
  29. $s = oci_parse($c, $q);
  30. oci_execute($s);
  31. var_dump(oci_fetch_assoc($s));
  32. }
  33. echo "Test 1\n";
  34. oci_set_db_operation($c, "db_op_2_a");
  35. dq($c, 'select * from dual');
  36. echo "Test 2\n";
  37. oci_set_db_operation($c, "db_op_2_b");
  38. dq($c, 'select * from dual');
  39. echo "Test 3\n";
  40. dq($c, 'select dbop_name from v$sql_monitor where dbop_name like \'db_op2%\' order by dbop_exec_id desc');
  41. ?>
  42. ===DONE===
  43. <?php exit(0); ?>
  44. --XFAIL--
  45. Fails due to Oracle Bug 16695981
  46. --EXPECTF--
  47. Test 1
  48. array(1) {
  49. ["DUMMY"]=>
  50. string(1) "X"
  51. }
  52. Test 2
  53. array(1) {
  54. ["DUMMY"]=>
  55. string(1) "X"
  56. }
  57. Test 3
  58. array(2) {
  59. ["DBOP_NAME"]=>
  60. string(7) "db_op_2a"
  61. }
  62. ===DONE===