Updates to Tomato RAF including NGINX && PHP
[tomato.git] / release / src / router / php / ext / oci8 / tests / connect_scope_try5.phpt
blob3afc87b9156864cd6fa2f27a5cad5c6a2b3d2a08
1 --TEST--
2 Check oci_pconnect try/catch end-of-scope with old_oci_close_semantics Off
3 --SKIPIF--
4 <?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
5 --INI--
6 oci8.old_oci_close_semantics=0
7 --FILE--
8 <?php
10 require(dirname(__FILE__).'/details.inc');
12 // Initialization
14 $stmtarray = array(
15         "drop table scope_try5_tab",
16         "create table scope_try5_tab (c1 number)"
19 if (!empty($dbase))
20         $c1 = oci_new_connect($user,$password,$dbase);
21 else
22         $c1 = oci_new_connect($user,$password);
23                                                  
24 oci8_test_sql_execute($c1, $stmtarray);
26 // Run Test
28 echo "Test 1\n";
30 // Make errors throw exceptions
32 set_error_handler(create_function('$x, $y', 'throw new Exception($y, $x);'));
34 try
36         if (!empty($dbase))
37                 $c = oci_pconnect($user,$password,$dbase);
38         else
39                 $c = oci_pconnect($user,$password);
40         $s = oci_parse($c, "insert into scope_try5_tab values (1)");
41         oci_execute($s, OCI_DEFAULT);  // no commit
42         $s = oci_parse($c, "insert into scope_try5_tab values (ABC)"); // syntax error -> throws exception
43         oci_execute($s, OCI_DEFAULT);  // no commit
45 catch (Exception $e)
47         echo "Caught Exception: ". $e->getMessage(), "\n";
48         var_dump($c);
50         // Verify data is not yet committed
51         $s1 = oci_parse($c1, "select * from scope_try5_tab");
52         oci_execute($s1);
53         oci_fetch_all($s1, $r);
54         var_dump($r);
56         // Now commit
57         oci_commit($c);
60 // Verify data was committed in the Catch block
62 $s1 = oci_parse($c1, "select * from scope_try5_tab");
63 oci_execute($s1);
64 oci_fetch_all($s1, $r);
65 var_dump($r);
67 // Cleanup
69 $stmtarray = array(
70         "drop table scope_try5_tab"
73 oci8_test_sql_execute($c1, $stmtarray);
75 echo "Done\n";
78 --EXPECTF--
79 Test 1
80 Caught Exception: oci_execute(): ORA-%r(00984|57000: TT2957)%r: %s
81 resource(%d) of type (oci8 persistent connection)
82 array(1) {
83   ["C1"]=>
84   array(0) {
85   }
87 array(1) {
88   ["C1"]=>
89   array(1) {
90     [0]=>
91     string(1) "1"
92   }
94 Done