xref: /PHP-5.3/ext/oci8/tests/drcp_cclass1.phpt (revision 08eaa567)
1--TEST--
2DRCP: Test setting connection class inline
3--SKIPIF--
4<?php
5if (!extension_loaded('oci8')) die ("skip no oci8 extension");
6require(dirname(__FILE__)."/details.inc");
7if (!$test_drcp) die("skip testing DRCP connection class only works in DRCP mode");
8if (strcasecmp($user, "system") && strcasecmp($user, "sys")) die("skip needs to be run as a DBA user");
9?>
10--FILE--
11<?php
12
13require(dirname(__FILE__)."/details.inc");
14
15// Initialization
16
17$t = time();
18$cc1 = 'cc1_'.$t;
19$cc2 = 'cc2_'.$t;
20
21// Run Test
22
23echo "Test 1\n";
24
25ini_set('oci8.connection_class', $cc1);
26$c = oci_pconnect($user, $password, $dbase);
27$s = oci_parse($c, "select * from dual");
28oci_execute($s);
29oci_fetch_all($s, $r);
30var_dump($r);
31
32echo "Test 2\n";
33
34ini_set('oci8.connection_class', $cc2);
35$c = oci_pconnect($user, $password, $dbase);
36$s = oci_parse($c, "select * from dual");
37oci_execute($s);
38oci_fetch_all($s, $r);
39var_dump($r);
40
41echo "Test 3\n";
42
43$s = oci_parse($c, "select cclass_name from v\$cpool_cc_stats where cclass_name like '%.cc__$t' order by cclass_name");
44oci_execute($s);
45oci_fetch_all($s, $r);
46var_dump($r);
47
48// Cleanup
49
50echo "Done\n";
51
52?>
53--EXPECTF--
54Test 1
55array(1) {
56  ["DUMMY"]=>
57  array(1) {
58    [0]=>
59    string(1) "X"
60  }
61}
62Test 2
63array(1) {
64  ["DUMMY"]=>
65  array(1) {
66    [0]=>
67    string(1) "X"
68  }
69}
70Test 3
71array(1) {
72  ["CCLASS_NAME"]=>
73  array(2) {
74    [0]=>
75    string(21) "%s.cc1_%d"
76    [1]=>
77    string(21) "%s.cc2_%d"
78  }
79}
80Done
81