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