Updates to Tomato RAF including NGINX && PHP
[tomato.git] / release / src / router / php / ext / oci8 / tests / connect_scope2.phpt
blob7d05c114118c350c1dbd0818f80e3b5e6fa12745
1 --TEST--
2 Test oci_pconnect end-of-scope when statement returned
3 --SKIPIF--
4 <?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
5 --FILE--
6 <?php
8 require(dirname(__FILE__).'/details.inc');
10 // Initialization
12 $stmtarray = array(
13         "drop table connect_scope2_tab",
14         "create table connect_scope2_tab (c1 number)",
17 if (!empty($dbase))
18         $c1 = oci_new_connect($user,$password,$dbase);
19 else
20         $c1 = oci_new_connect($user,$password);
21                                                                                                  
22 oci8_test_sql_execute($c1, $stmtarray);
24 // Run Test
26 echo "Test 1 - oci_pconnect\n";
28 function f()
30         global $user, $password, $dbase;
32         if (!empty($dbase))
33                 $c = oci_pconnect($user,$password,$dbase);
34         else
35                 $c = oci_pconnect($user,$password);
36         $s = oci_parse($c, "insert into connect_scope2_tab values (1)");
37         oci_execute($s, OCI_DEFAULT);  // no commit
38         return($s); // this keeps the connection refcount positive so the connection isn't closed
41 $s2 = f();
43 // Check nothing committed yet
45 $s1 = oci_parse($c1, "select * from connect_scope2_tab");
46 oci_execute($s1, OCI_DEFAULT);
47 oci_fetch_all($s1, $r);
48 var_dump($r);
50 // insert 2nd row on returned statement, committing both rows
51 oci_execute($s2);
53 // Verify data was committed
55 $s1 = oci_parse($c1, "select * from connect_scope2_tab");
56 oci_execute($s1);
57 oci_fetch_all($s1, $r);
58 var_dump($r);
60 // Cleanup
62 $stmtarray = array(
63         "drop table connect_scope2_tab"
66 oci8_test_sql_execute($c1, $stmtarray);
68 echo "Done\n";
71 --EXPECTF--
72 Test 1 - oci_pconnect
73 array(1) {
74   ["C1"]=>
75   array(0) {
76   }
78 array(1) {
79   ["C1"]=>
80   array(2) {
81     [0]=>
82     string(1) "1"
83     [1]=>
84     string(1) "1"
85   }
87 Done