xref: /PHP-5.3/ext/oci8/tests/drcp_scope5.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// Similar to drcp_scope3.phpt but does a commit before end of
14// function2, allowing the table to be dropped cleanly at the end.
15
16// The test opens a connection within function1 and updates a table
17// (without committing).  Another connection is opened from function
18// 2, and the table queried.  When function1 ends, the connection from
19// function1 is not closed, so the updated value will be seen in
20// function2.  Also the table can't be dropped because an uncommitted
21// transaction exists.
22
23// Create the table
24$c = oci_new_connect($user,$password,$dbase);
25@drcp_drop_table($c);
26drcp_create_table($c);
27
28echo "This is with a OCI_PCONNECT\n";
29function1($user,$password,$dbase);
30
31// Should return the OLD value
32function2($user,$password,$dbase);
33
34// This is the first scope for the script
35
36function function1($user,$password,$dbase)
37{
38	var_dump($c = oci_pconnect($user,$password,$dbase));
39	drcp_update_table($c);
40}
41
42// This is the second scope
43
44function function2($user,$password,$dbase)
45{
46	var_dump($c = oci_pconnect($user,$password,$dbase));
47	drcp_select_value($c);
48	oci_commit($c);
49}
50
51drcp_drop_table($c);
52oci_close($c);
53
54echo "Done\n";
55
56?>
57--EXPECTF--
58This is with a OCI_PCONNECT
59resource(%d) of type (oci8 persistent connection)
60Update done-- DEPT value has been set to NEWDEPT
61resource(%d) of type (oci8 persistent connection)
62The value of DEPT for id 105 is NEWDEPT
63Done