Annotation of embedaddon/php/ext/oci8/tests/drcp_cclass1.phpt, revision 1.1.1.2

1.1       misho       1: --TEST--
                      2: DRCP: Test setting connection class inline
                      3: --SKIPIF--
                      4: <?php 
                      5: if (!extension_loaded('oci8')) die ("skip no oci8 extension"); 
1.1.1.2 ! misho       6: require(dirname(__FILE__).'/connect.inc');
1.1       misho       7: if (!$test_drcp) die("skip testing DRCP connection class only works in DRCP mode");
                      8: if (strcasecmp($user, "system") && strcasecmp($user, "sys")) die("skip needs to be run as a DBA user"); 
1.1.1.2 ! misho       9: 
        !            10: preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches_sv);
        !            11: // This test in Oracle 12c needs a non-CDB or the root container
        !            12: if (isset($matches_sv[0]) && $matches_sv[1] >= 12) {
        !            13:     $s = oci_parse($c, "select nvl(sys_context('userenv', 'con_name'), 'notacdb') as dbtype from dual");
        !            14:     $r = @oci_execute($s);
        !            15:     if (!$r)
        !            16:         die('skip could not identify container type');
        !            17:     $r = oci_fetch_array($s);
        !            18:     if ($r['DBTYPE'] !== 'CDB$ROOT')
        !            19:         die('skip cannot run test using a PDB');
        !            20: }
1.1       misho      21: ?>
                     22: --FILE--
                     23: <?php
                     24: 
                     25: require(dirname(__FILE__)."/details.inc");
                     26: 
                     27: // Initialization
                     28: 
                     29: $t = time();
                     30: $cc1 = 'cc1_'.$t;
                     31: $cc2 = 'cc2_'.$t;
                     32: 
                     33: // Run Test
                     34: 
                     35: echo "Test 1\n";
                     36: 
                     37: ini_set('oci8.connection_class', $cc1);
                     38: $c = oci_pconnect($user, $password, $dbase);
                     39: $s = oci_parse($c, "select * from dual");
                     40: oci_execute($s);
                     41: oci_fetch_all($s, $r);
                     42: var_dump($r);
                     43: 
                     44: echo "Test 2\n";
                     45: 
                     46: ini_set('oci8.connection_class', $cc2);
                     47: $c = oci_pconnect($user, $password, $dbase);
                     48: $s = oci_parse($c, "select * from dual");
                     49: oci_execute($s);
                     50: oci_fetch_all($s, $r);
                     51: var_dump($r);
                     52: 
                     53: echo "Test 3\n";
                     54: 
                     55: $s = oci_parse($c, "select cclass_name from v\$cpool_cc_stats where cclass_name like '%.cc__$t' order by cclass_name");
                     56: oci_execute($s);
                     57: oci_fetch_all($s, $r);
                     58: var_dump($r);
                     59: 
                     60: // Cleanup
                     61: 
                     62: echo "Done\n";
                     63: 
                     64: ?>
                     65: --EXPECTF--
                     66: Test 1
                     67: array(1) {
                     68:   ["DUMMY"]=>
                     69:   array(1) {
                     70:     [0]=>
                     71:     string(1) "X"
                     72:   }
                     73: }
                     74: Test 2
                     75: array(1) {
                     76:   ["DUMMY"]=>
                     77:   array(1) {
                     78:     [0]=>
                     79:     string(1) "X"
                     80:   }
                     81: }
                     82: Test 3
                     83: array(1) {
                     84:   ["CCLASS_NAME"]=>
                     85:   array(2) {
                     86:     [0]=>
                     87:     string(21) "%s.cc1_%d"
                     88:     [1]=>
                     89:     string(21) "%s.cc2_%d"
                     90:   }
                     91: }
                     92: Done

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>