Annotation of embedaddon/php/ext/oci8/tests/drcp_connect1.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: DRCP: oci_connect()
3: --SKIPIF--
4: <?php
5: $target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs (Calling PL/SQL from SQL is not supported in TimesTen)
6: require(dirname(__FILE__).'/skipif.inc');
7: ?>
8: --INI--
9: oci8.connection_class=test
10: oci8.old_oci_close_semantics=0
11: --FILE--
12: <?php
13:
14: require dirname(__FILE__)."/details.inc";
15: require dirname(__FILE__)."/drcp_functions.inc";
16:
17: // Open a number of connections with oci_connect and oci_pconnect and verify
18: // whether we get a used session with DRCP.
19: // To verify this, we change the value of a PL/SQL package variable in one
20: // session and query for this through another connection
21:
22: echo "Test 1a\n";
23: var_dump($conn1 = oci_connect($user,$password,$dbase));
24: // Create the package
25: drcp_create_package($conn1);
26:
27: echo "Test 1b\n";
28: // OCI_CONNECT
29: echo " This is with OCI_CONNECT.....\n";
30: drcp_select_packagevar($conn1); // Returns 0
31: drcp_set_packagevar($conn1,1000);
32: oci_close($conn1);
33: echo " Connection conn1 closed....\n";
34:
35: echo "Test 2\n";
36: // Second connection should return 0 for the package variable.
37: var_dump($conn2 = oci_connect($user,$password,$dbase));
38: echo " Select with connection 2 \n";
39: drcp_select_packagevar($conn2); // Returns 0
40: drcp_set_packagevar($conn2,100);
41:
42: echo "Test 3\n";
43: // Third connection. There is no oci_close() for conn2 hence this should
44: // return the value set by conn2.
45: var_dump($conn3 = oci_connect($user,$password,$dbase));
46: echo " Select with connection 3 \n";
47: drcp_select_packagevar($conn3); // Returns 100
48:
49: // Close all the connections
50: oci_close($conn2);
51: oci_close($conn3);
52:
53: echo "Test 4\n";
54: // OCI_PCONNECT
55: echo " This is with oci_pconnect().....\n";
56: var_dump($pconn1 = oci_pconnect($user,$password,$dbase));
57: drcp_set_packagevar($pconn1,1000);
58: oci_close($pconn1);
59: echo " Connection pconn1 closed....\n";
60:
61: // Second connection with oci_pconnect should return the same session hence the
62: // value returned is what is set by pconn1
63:
64: echo "Test 5\n";
65: var_dump($pconn2 = oci_pconnect($user,$password,$dbase));
66: echo " Select with persistent connection 2 \n";
67: drcp_select_packagevar($pconn2); // Returns 1000
68: oci_close($pconn2);
69:
70: echo "Done\n";
71:
72: ?>
73: --EXPECTF--
74: Test 1a
75: resource(%d) of type (oci8 connection)
76: Test 1b
77: This is with OCI_CONNECT.....
78: The value of the package variable is 0
79: Package variable value set to 1000
80: Connection conn1 closed....
81: Test 2
82: resource(%d) of type (oci8 connection)
83: Select with connection 2
84: The value of the package variable is 0
85: Package variable value set to 100
86: Test 3
87: resource(%d) of type (oci8 connection)
88: Select with connection 3
89: The value of the package variable is 100
90: Test 4
91: This is with oci_pconnect().....
92: resource(%d) of type (oci8 persistent connection)
93: Package variable value set to 1000
94: Connection pconn1 closed....
95: Test 5
96: resource(%d) of type (oci8 persistent connection)
97: Select with persistent connection 2
98: The value of the package variable is 1000
99: Done
100:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>