File:
[ELWIX - Embedded LightWeight unIX -] /
embedaddon /
php /
ext /
oci8 /
tests /
connect_scope1.phpt
Revision
1.1.1.1 (vendor branch):
download - view:
text,
annotated -
select for diffs -
revision graph
Tue Feb 21 23:47:58 2012 UTC (12 years, 6 months ago) by
misho
Branches:
php,
MAIN
CVS tags:
v5_4_3elwix,
v5_4_29p0,
v5_4_29,
v5_4_20p0,
v5_4_20,
v5_4_17p0,
v5_4_17,
v5_3_10,
HEAD
php
--TEST--
Test oci_connect end-of-scope when statement returned
--SKIPIF--
<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
--FILE--
<?php
require(dirname(__FILE__).'/details.inc');
// Initialization
$stmtarray = array(
"drop table connect_scope1_tab",
"create table connect_scope1_tab (c1 number)",
);
if (!empty($dbase))
$c1 = oci_new_connect($user,$password,$dbase);
else
$c1 = oci_new_connect($user,$password);
oci8_test_sql_execute($c1, $stmtarray);
// Run Test
echo "Test 1 - oci_connect\n";
function f()
{
global $user, $password, $dbase;
if (!empty($dbase))
$c = oci_connect($user,$password,$dbase);
else
$c = oci_connect($user,$password);
$s = oci_parse($c, "insert into connect_scope1_tab values (1)");
oci_execute($s, OCI_DEFAULT); // no commit
return($s); // this keeps the connection refcount positive so the connection isn't closed
}
$s2 = f();
// Check nothing committed yet
$s1 = oci_parse($c1, "select * from connect_scope1_tab");
oci_execute($s1, OCI_DEFAULT);
oci_fetch_all($s1, $r);
var_dump($r);
// insert 2nd row on returned statement, committing both rows
oci_execute($s2);
// Verify data was committed
$s1 = oci_parse($c1, "select * from connect_scope1_tab");
oci_execute($s1);
oci_fetch_all($s1, $r);
var_dump($r);
// Cleanup
$stmtarray = array(
"drop table connect_scope1_tab"
);
oci8_test_sql_execute($c1, $stmtarray);
echo "Done\n";
?>
--EXPECTF--
Test 1 - oci_connect
array(1) {
["C1"]=>
array(0) {
}
}
array(1) {
["C1"]=>
array(2) {
[0]=>
string(1) "1"
[1]=>
string(1) "1"
}
}
Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>