Annotation of embedaddon/php/ext/oci8/tests/connect_scope1.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test oci_connect end-of-scope when statement returned
3: --SKIPIF--
4: <?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
5: --FILE--
6: <?php
7:
8: require(dirname(__FILE__).'/details.inc');
9:
10: // Initialization
11:
12: $stmtarray = array(
13: "drop table connect_scope1_tab",
14: "create table connect_scope1_tab (c1 number)",
15: );
16:
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);
23:
24: // Run Test
25:
26: echo "Test 1 - oci_connect\n";
27:
28: function f()
29: {
30: global $user, $password, $dbase;
31:
32: if (!empty($dbase))
33: $c = oci_connect($user,$password,$dbase);
34: else
35: $c = oci_connect($user,$password);
36: $s = oci_parse($c, "insert into connect_scope1_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
39: }
40:
41: $s2 = f();
42:
43: // Check nothing committed yet
44:
45: $s1 = oci_parse($c1, "select * from connect_scope1_tab");
46: oci_execute($s1, OCI_DEFAULT);
47: oci_fetch_all($s1, $r);
48: var_dump($r);
49:
50: // insert 2nd row on returned statement, committing both rows
51: oci_execute($s2);
52:
53: // Verify data was committed
54:
55: $s1 = oci_parse($c1, "select * from connect_scope1_tab");
56: oci_execute($s1);
57: oci_fetch_all($s1, $r);
58: var_dump($r);
59:
60: // Cleanup
61:
62: $stmtarray = array(
63: "drop table connect_scope1_tab"
64: );
65:
66: oci8_test_sql_execute($c1, $stmtarray);
67:
68: echo "Done\n";
69:
70: ?>
71: --EXPECTF--
72: Test 1 - oci_connect
73: array(1) {
74: ["C1"]=>
75: array(0) {
76: }
77: }
78: array(1) {
79: ["C1"]=>
80: array(2) {
81: [0]=>
82: string(1) "1"
83: [1]=>
84: string(1) "1"
85: }
86: }
87: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>