xref: /PHP-5.3/ext/oci8/tests/drcp_scope3.phpt (revision 08eaa567)
1--TEST--
2DRCP: oci_pconnect() with scope end when oci8.old_oci_close_semantics ON
3--SKIPIF--
4<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
5--INI--
6oci8.old_oci_close_semantics=1
7--FILE--
8<?php
9
10require dirname(__FILE__)."/drcp_functions.inc";
11require dirname(__FILE__)."/details.inc";
12
13// The test opens a connection within function1 and updates a table
14// (without committing).  Another connection is opened from function
15// 2, and the table queried.  When function1 ends, the connection from
16// function1 is not closed, so the updated value will be seen in
17// function2.  Also the table can't be dropped because an uncommitted
18// transaction exists.
19
20// Create the table
21$c = oci_new_connect($user,$password,$dbase);
22@drcp_drop_table($c);
23drcp_create_table($c);
24
25echo "This is with a OCI_PCONNECT\n";
26function1($user,$password,$dbase);
27
28// Should return the OLD value
29function2($user,$password,$dbase);
30
31// This is the first scope for the script
32
33function function1($user,$password,$dbase)
34{
35	var_dump($c = oci_pconnect($user,$password,$dbase));
36	drcp_update_table($c);
37}
38
39// This is the second scope
40
41function function2($user,$password,$dbase)
42{
43	var_dump($c = oci_pconnect($user,$password,$dbase));
44	drcp_select_value($c);
45}
46
47drcp_drop_table($c);
48oci_close($c);
49
50echo "Done\n";
51
52?>
53--EXPECTF--
54This is with a OCI_PCONNECT
55resource(%d) of type (oci8 persistent connection)
56Update done-- DEPT value has been set to NEWDEPT
57resource(%d) of type (oci8 persistent connection)
58The value of DEPT for id 105 is NEWDEPT
59
60Warning: oci_execute(): ORA-00054: %s
61Done