sixd            Wed May  7 15:29:28 2008 UTC

  Added files:                 (Branch: PHP_5_2)
    /php-src/ext/oci8/tests     bug37220.phpt bug43497_92.phpt 
                                connect_scope1.phpt connect_scope2.phpt 
                                connect_scope_try1.phpt 
                                connect_scope_try2.phpt 
                                connect_scope_try3.phpt 
                                connect_scope_try4.phpt 
                                connect_scope_try5.phpt 
                                connect_scope_try6.phpt 
                                drcp_characterset.phpt 
                                drcp_conn_close1.phpt drcp_conn_close2.phpt 
                                drcp_connect1.phpt drcp_functions.inc 
                                drcp_newconnect.phpt drcp_pconn_close1.phpt 
                                drcp_pconn_close2.phpt drcp_privileged.phpt 
                                drcp_scope1.phpt drcp_scope2.phpt 
                                drcp_scope3.phpt drcp_scope4.phpt 
                                drcp_scope5.phpt pecl_bug10194_blob_64.phpt 
                                testping.phpt 

  Modified files:              
    /php-src/ext/oci8/tests     bug43497.phpt bug44113.phpt bug44206.phpt 
                                lob_042.phpt password.phpt password_2.phpt 
                                password_new.phpt password_old.phpt 
                                pecl_bug10194_blob.phpt 
  Log:
  MFH: new tests and test cleanup
  
http://cvs.php.net/viewvc.cgi/php-src/ext/oci8/tests/bug43497.phpt?r1=1.1.2.1&r2=1.1.2.2&diff_format=u
Index: php-src/ext/oci8/tests/bug43497.phpt
diff -u php-src/ext/oci8/tests/bug43497.phpt:1.1.2.1 
php-src/ext/oci8/tests/bug43497.phpt:1.1.2.2
--- php-src/ext/oci8/tests/bug43497.phpt:1.1.2.1        Tue Jan 15 20:42:13 2008
+++ php-src/ext/oci8/tests/bug43497.phpt        Wed May  7 15:29:27 2008
@@ -1,7 +1,16 @@
 --TEST--
 Bug #43497 (OCI8 XML/getClobVal aka temporary LOBs leak UGA memory)
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+<?php 
+if (!extension_loaded('oci8')) die ("skip no oci8 extension"); 
+ob_start();
+phpinfo(INFO_MODULES);
+$phpinfo = ob_get_clean();
+$ov = preg_match('/Oracle Version => 9/', $phpinfo);
+if ($ov === 1) {
+       die ("skip expected output only valid for Oracle clients from 10g 
onwards");
+}
+?>
 --FILE--
 <?php
 
http://cvs.php.net/viewvc.cgi/php-src/ext/oci8/tests/bug44113.phpt?r1=1.1.2.1&r2=1.1.2.2&diff_format=u
Index: php-src/ext/oci8/tests/bug44113.phpt
diff -u php-src/ext/oci8/tests/bug44113.phpt:1.1.2.1 
php-src/ext/oci8/tests/bug44113.phpt:1.1.2.2
--- php-src/ext/oci8/tests/bug44113.phpt:1.1.2.1        Fri Feb 15 23:05:19 2008
+++ php-src/ext/oci8/tests/bug44113.phpt        Wed May  7 15:29:27 2008
@@ -5,7 +5,7 @@
 --FILE--
 <?php
 
-require dirname(__FILE__).'/connect.inc';
+require(dirname(__FILE__).'/connect.inc');
 
 // Initialization
 
@@ -22,8 +22,7 @@
 // The test can take some time to complete and can exceed PHP's test
 // timout limit on slow networks.
 
-for ($x = 0; $x < 70000; $x++)
-{
+for ($x = 0; $x < 70000; $x++) {
        if (!($var = oci_new_collection($c, 'BUG44113_LIST_T'))) {
                print "Failed new collection creation on $x\n";
                break;
http://cvs.php.net/viewvc.cgi/php-src/ext/oci8/tests/bug44206.phpt?r1=1.1.4.2&r2=1.1.4.3&diff_format=u
Index: php-src/ext/oci8/tests/bug44206.phpt
diff -u php-src/ext/oci8/tests/bug44206.phpt:1.1.4.2 
php-src/ext/oci8/tests/bug44206.phpt:1.1.4.3
--- php-src/ext/oci8/tests/bug44206.phpt:1.1.4.2        Mon Feb 25 23:52:10 2008
+++ php-src/ext/oci8/tests/bug44206.phpt        Wed May  7 15:29:27 2008
@@ -5,25 +5,27 @@
 --FILE--
 <?php
 
-require(dirname(__FILE__).'/connect.inc');
+require dirname(__FILE__).'/connect.inc';
 
 // Run Test
 
-for ($x = 0; $x < 400; $x++) {
+for ($x = 0; $x < 400; $x++)
+{
        $stmt = "select cursor (select $x from dual) a,
-                                       cursor (select $x from dual) b 
-                        from dual";
+                cursor (select $x from dual) b 
+                from dual";
        $s = oci_parse($c, $stmt);
        $r = oci_execute($s);
-       if (!$r) {
-               echo "Exiting $x\n";
-               exit;
-       }
-       $result = oci_fetch_array($s, OCI_ASSOC);
+        if (!$r) {
+                echo "Exiting $x\n";
+                exit;
+        }
+       $mode = OCI_ASSOC | OCI_RETURN_NULLS;
+       $result = oci_fetch_array($s, $mode);
        oci_execute($result['A']);
        oci_execute($result['B']);
-       oci_fetch_array($result['A'], OCI_ASSOC);
-       oci_fetch_array($result['B'], OCI_ASSOC);
+       oci_fetch_array($result['A'], $mode);
+       oci_fetch_array($result['B'], $mode);
        oci_free_statement($result['A']);
        oci_free_statement($result['B']);
        oci_free_statement($s);
http://cvs.php.net/viewvc.cgi/php-src/ext/oci8/tests/lob_042.phpt?r1=1.1.2.1&r2=1.1.2.2&diff_format=u
Index: php-src/ext/oci8/tests/lob_042.phpt
diff -u php-src/ext/oci8/tests/lob_042.phpt:1.1.2.1 
php-src/ext/oci8/tests/lob_042.phpt:1.1.2.2
--- php-src/ext/oci8/tests/lob_042.phpt:1.1.2.1 Sat Feb 16 03:01:16 2008
+++ php-src/ext/oci8/tests/lob_042.phpt Wed May  7 15:29:27 2008
@@ -5,8 +5,6 @@
 --FILE--
 <?php
 
-// test some LOB error messages
-       
 require(dirname(__FILE__).'/connect.inc');
 require(dirname(__FILE__).'/create_table.inc');
 
http://cvs.php.net/viewvc.cgi/php-src/ext/oci8/tests/password.phpt?r1=1.1.2.3&r2=1.1.2.3.2.1&diff_format=u
Index: php-src/ext/oci8/tests/password.phpt
diff -u php-src/ext/oci8/tests/password.phpt:1.1.2.3 
php-src/ext/oci8/tests/password.phpt:1.1.2.3.2.1
--- php-src/ext/oci8/tests/password.phpt:1.1.2.3        Tue Dec  6 19:28:25 2005
+++ php-src/ext/oci8/tests/password.phpt        Wed May  7 15:29:27 2008
@@ -1,24 +1,74 @@
 --TEST--
-oci_password_change()
+oci_password_change() for non-persistent connections
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php 
+if (!extension_loaded('oci8')) die("skip no oci8 extension"); 
+require(dirname(__FILE__)."/details.inc");
+if (empty($dbase)) die ("skip requires database connection string be set");
+if (strcasecmp($user, "system") && strcasecmp($user, "sys")) die("skip needs 
to be run as a DBA user"); 
+?>
 --FILE--
 <?php
 
-require dirname(__FILE__)."/connect.inc";
+require(dirname(__FILE__)."/details.inc");
 
-$new_password = "test";
-var_dump(oci_password_change($dbase, $user, $password, $new_password));
+// Create a user we can stuff around with and not affect subsequent tests
+$c0 = oci_connect($user, $password, $dbase);
+$stmts = array(
+       "drop user testuser",
+       "begin
+        execute immediate 'create user testuser identified by testuserpwd';
+        execute immediate 'grant connect, create session to testuser';
+       end;");
+foreach ($stmts as $sql) {
+       $s = oci_parse($c0, $sql);
+       @oci_execute($s);
+}
 
-if (!empty($dbase)) {
-       var_dump($new_c = ocilogon($user,$new_password,$dbase));
+// Connect and change the password
+$c1 = oci_connect("testuser", "testuserpwd", $dbase);
+var_dump($c1);
+$rn1 = (int)$c1;
+
+oci_password_change($c1, "testuser", "testuserpwd", "testuserpwd2");
+
+// Second connect should return a new resource because the hash string will be 
different from $c1
+$c2 = oci_connect("testuser", "testuserpwd2", $dbase);
+var_dump($c2);
+$rn2 = (int)$c2;
+
+// Despite using the old password this connect should succeed and return the 
original resource
+$c3 = oci_connect("testuser", "testuserpwd", $dbase);  
+var_dump($c3);
+$rn3 = (int)$c3;
+
+// Connections should differ
+if ($rn1 == $rn2) {
+       echo "First and second connections share a resource: Not OK\n";
+       var_dump($c1);
 }
 else {
-       var_dump($new_c = ocilogon($user,$new_password));
+       echo "First and second connections are different: OK\n";
 }
 
-var_dump(oci_password_change($dbase, $user, $new_password, $password));
+// Connections should be the same
+if ($rn1 == $rn3) {
+       echo "First and third connections share a resource: OK\n";
+}
+else {
+       echo "First and third connections are different: Not OK\n";
+       var_dump($c1);
+       var_dump($c2);
+}
 
+// Clean up
+oci_close($c1);
+oci_close($c2);
+oci_close($c3);
+
+// Clean up
+$s = oci_parse($c0, "drop user cascade testuser");
[EMAIL PROTECTED]($s);
 
 echo "Done\n";
 
@@ -27,4 +77,6 @@
 resource(%d) of type (oci8 connection)
 resource(%d) of type (oci8 connection)
 resource(%d) of type (oci8 connection)
+First and second connections are different: OK
+First and third connections share a resource: OK
 Done
http://cvs.php.net/viewvc.cgi/php-src/ext/oci8/tests/password_2.phpt?r1=1.1.2.1&r2=1.1.2.2&diff_format=u
Index: php-src/ext/oci8/tests/password_2.phpt
diff -u php-src/ext/oci8/tests/password_2.phpt:1.1.2.1 
php-src/ext/oci8/tests/password_2.phpt:1.1.2.2
--- php-src/ext/oci8/tests/password_2.phpt:1.1.2.1      Fri Aug  3 01:55:15 2007
+++ php-src/ext/oci8/tests/password_2.phpt      Wed May  7 15:29:27 2008
@@ -4,6 +4,7 @@
 <?php 
 if (!extension_loaded('oci8')) die("skip no oci8 extension"); 
 require(dirname(__FILE__)."/details.inc");
+if (empty($dbase)) die ("skip requires database connection string be set");
 if (strcasecmp($user, "system") && strcasecmp($user, "sys")) die("skip needs 
to be run as a DBA user"); 
 ?>
 --FILE--
@@ -27,34 +28,19 @@
 // Connect (persistent) and change the password
 $c1 = oci_pconnect("testuser", "testuserpwd", $dbase);
 var_dump($c1);
-
-ob_start();
-var_dump($c1);
-$r1 = ob_get_clean();
-preg_match("/resource\(([0-9])\) of.*/", $r1, $matches);
-$rn1 = $matches[1]; /* resource number */
+$rn1 = (int)$c1;
 
 oci_password_change($c1, "testuser", "testuserpwd", "testuserpwd2");
 
 // Second connect should return a new resource because the hash string will be 
different from $c1
 $c2 = oci_pconnect("testuser", "testuserpwd2", $dbase);
 var_dump($c2);
-
-ob_start();
-var_dump($c2);
-$r2 = ob_get_clean();
-preg_match("/resource\(([0-9])\) of.*/", $r2, $matches);
-$rn2 = $matches[1]; /* resource number */
+$rn2 = (int)$c2;
 
 // Despite using the old password this connect should succeed and return the 
original resource
 $c3 = oci_pconnect("testuser", "testuserpwd", $dbase);  
 var_dump($c3);
-
-ob_start();
-var_dump($c3);
-$r3 = ob_get_clean();
-preg_match("/resource\(([0-9])\) of.*/", $r3, $matches);
-$rn3 = $matches[1]; /* resource number */
+$rn3 = (int)$c3;
 
 // Connections should differ
 if ($rn1 == $rn2) {
@@ -76,10 +62,12 @@
 }
 
 // Clean up
-// Can't drop a user that is connected and can't close a persistent
-// connection.  So this test will leave the dummy user around, but the
-// schema will not be usable..
-$s = oci_parse($c0, "revoke connect, create session from testuser");
+oci_close($c1);
+oci_close($c2);
+oci_close($c3);
+
+// Clean up
+$s = oci_parse($c0, "drop user cascade testuser");
 @oci_execute($s);
 
 echo "Done\n";
http://cvs.php.net/viewvc.cgi/php-src/ext/oci8/tests/password_new.phpt?r1=1.1.2.3&r2=1.1.2.3.2.1&diff_format=u
Index: php-src/ext/oci8/tests/password_new.phpt
diff -u php-src/ext/oci8/tests/password_new.phpt:1.1.2.3 
php-src/ext/oci8/tests/password_new.phpt:1.1.2.3.2.1
--- php-src/ext/oci8/tests/password_new.phpt:1.1.2.3    Tue Dec  6 19:28:25 2005
+++ php-src/ext/oci8/tests/password_new.phpt    Wed May  7 15:29:27 2008
@@ -1,7 +1,25 @@
 --TEST--
 oci_password_change()
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+if (!extension_loaded('oci8')) die("skip no oci8 extension"); 
+require dirname(__FILE__)."/connect.inc";
+if (empty($dbase)) die ("skip requires database connection string be set");
+
+// This test is known to fail with Oracle 10g client libraries
+// connecting to Oracle Database 11.1.0.6 (Oracle bug 6277160)
+$sv = oci_server_version($c);
+$sv = preg_match('/11.1/', $sv, $matches);
+if ($sv === 1) {
+       ob_start();
+       phpinfo(INFO_MODULES);
+       $phpinfo = ob_get_clean();
+       $iv = preg_match('/Oracle .*Version => 10/', $phpinfo);
+       if ($iv === 1) {
+               die ("skip test known to fail using Oracle 10gR2 client libs 
connecting to Oracle 11.1 (6277160)");
+       }
+}
+?>
 --FILE--
 <?php
 
http://cvs.php.net/viewvc.cgi/php-src/ext/oci8/tests/password_old.phpt?r1=1.1.2.3&r2=1.1.2.3.2.1&diff_format=u
Index: php-src/ext/oci8/tests/password_old.phpt
diff -u php-src/ext/oci8/tests/password_old.phpt:1.1.2.3 
php-src/ext/oci8/tests/password_old.phpt:1.1.2.3.2.1
--- php-src/ext/oci8/tests/password_old.phpt:1.1.2.3    Tue Dec  6 19:28:25 2005
+++ php-src/ext/oci8/tests/password_old.phpt    Wed May  7 15:29:27 2008
@@ -1,14 +1,32 @@
 --TEST--
 ocipasswordchange()
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+if (!extension_loaded('oci8')) die("skip no oci8 extension"); 
+require dirname(__FILE__)."/connect.inc";
+if (empty($dbase)) die ("skip requires database connection string be set");
+
+// This test is known to fail with Oracle 10g client libraries
+// connecting to Oracle Database 11.1.0.6 (Oracle bug 6277160)
+$sv = oci_server_version($c);
+$sv = preg_match('/11.1/', $sv, $matches);
+if ($sv === 1) {
+       ob_start();
+       phpinfo(INFO_MODULES);
+       $phpinfo = ob_get_clean();
+       $iv = preg_match('/Oracle .*Version => 10/', $phpinfo);
+       if ($iv === 1) {
+               die ("skip test known to fail using Oracle 10gR2 client libs 
connecting to Oracle 11.1 (6277160)");
+       }
+}
+?>
 --FILE--
 <?php
 
 require dirname(__FILE__)."/connect.inc";
 
 $new_password = "test";
-var_dump(ocipasswordchange($c, $user, $password, $new_password));
+var_dump(ocipasswordchange($dbase, $user, $password, $new_password));
 
 if (!empty($dbase)) {
        var_dump($new_c = ocilogon($user,$new_password,$dbase));
@@ -17,14 +35,14 @@
        var_dump($new_c = ocilogon($user,$new_password));
 }
 
-var_dump(ocipasswordchange($new_c, $user, $new_password, $password));
+var_dump(ocipasswordchange($dbase, $user, $new_password, $password));
 
 
 echo "Done\n";
 
 ?>
 --EXPECTF--
-bool(true)
 resource(%d) of type (oci8 connection)
-bool(true)
+resource(%d) of type (oci8 connection)
+resource(%d) of type (oci8 connection)
 Done
http://cvs.php.net/viewvc.cgi/php-src/ext/oci8/tests/pecl_bug10194_blob.phpt?r1=1.1.2.3&r2=1.1.2.4&diff_format=u
Index: php-src/ext/oci8/tests/pecl_bug10194_blob.phpt
diff -u php-src/ext/oci8/tests/pecl_bug10194_blob.phpt:1.1.2.3 
php-src/ext/oci8/tests/pecl_bug10194_blob.phpt:1.1.2.4
--- php-src/ext/oci8/tests/pecl_bug10194_blob.phpt:1.1.2.3      Mon May  7 
12:09:14 2007
+++ php-src/ext/oci8/tests/pecl_bug10194_blob.phpt      Wed May  7 15:29:27 2008
@@ -1,19 +1,22 @@
 --TEST--
 PECL Bug #10194 (segfault in Instant Client when memory_limit is reached 
inside the callback) 
 --SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php 
+if (!extension_loaded('oci8')) die("skip no oci8 extension"); 
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platforms only");
+?>
 --INI--
-memory_limit=10M
+memory_limit=3M
 --FILE--
 <?php
+
+// This test is dependent on the behavior of the memory manager
        
 require dirname(__FILE__).'/connect.inc';
 require dirname(__FILE__).'/create_table.inc';
 
-$ora_sql = "INSERT INTO
-                       ".$schema.$table_name." (blob)
-                      VALUES (empty_blob())
-                      ";
+$ora_sql = "INSERT INTO ".$schema.$table_name." (blob)
+                          VALUES (empty_blob())";
 
 $statement = oci_parse($c,$ora_sql);
 oci_execute($statement);
@@ -32,10 +35,12 @@
 
 oci_commit($c);
 
-$ora_sql = "SELECT blob FROM ".$schema.$table_name."";
+$ora_sql = "SELECT blob FROM ".$schema.$table_name;
 $statement = oci_parse($c,$ora_sql);
 oci_execute($statement);
 
+echo "Before load()\n";
+
 $row = oci_fetch_assoc($statement);
 var_dump(strlen($row['BLOB']->load())); /* here it should fail */
 
@@ -44,4 +49,6 @@
 echo "Done\n";
 ?>
 --EXPECTF--    
+Before load()
+
 Fatal error: Allowed memory size of %d bytes exhausted%s(tried to allocate %d 
bytes) in %s on line %d

http://cvs.php.net/viewvc.cgi/php-src/ext/oci8/tests/bug37220.phpt?view=markup&rev=1.1
Index: php-src/ext/oci8/tests/bug37220.phpt
+++ php-src/ext/oci8/tests/bug37220.phpt
--TEST--
Bug #37220 (LOB Type mismatch when using windows & oci8.dll)
--SKIPIF--
<?php if (!extension_loaded("oci8")) print "skip"; ?>
--FILE--
<?php

require dirname(__FILE__).'/connect.inc';

// Initialization

$stmtarray = array(
        "create table bug37220_tab( mycolumn xmltype not null)",
        "insert into bug37220_tab values(xmltype('<THETAG 
myID=\"1234\"></THETAG>'))"
);

foreach ($stmtarray as $stmt) {
        $s = oci_parse($c, $stmt);
        @oci_execute($s);
}

// Now let's update the row where myId = 1234 and change the tag
// 'THETAG' to 'MYTAG' (mycolumn is an XMLTYPE datatype and
// bug37220_tab a normal Oracle table)

$query = "UPDATE  bug37220_tab 
                  SET     bug37220_tab.mycolumn = 
updateXML(bug37220_tab.mycolumn,'/THETAG',xmltype.createXML(:data)) 
                  WHERE   existsNode(bug37220_tab.mycolumn,'/[EMAIL 
PROTECTED]"1234\"]') = 1"; 
$stmt = oci_parse ($c, $query); 
$clob = oci_new_descriptor($c, OCI_D_LOB); 
oci_bind_by_name($stmt, ':data', $clob, -1, OCI_B_CLOB); 
$clob->writetemporary("<MYTAG/>", OCI_TEMP_CLOB); 
$success = oci_execute($stmt, OCI_COMMIT_ON_SUCCESS); 
oci_free_statement($stmt);      
$clob->close(); 

// Query back the change

$query = "select * from bug37220_tab";
$stmt = oci_parse ($c, $query); 

oci_execute($stmt);

while ($row = oci_fetch_array($stmt, OCI_ASSOC+OCI_RETURN_NULLS)) {
        foreach ($row as $item) {
                echo $item."\n";
        }
        echo "\n";
}

// Cleanup

$stmtarray = array(
        "drop table bug37220_tab"
);

foreach ($stmtarray as $stmt) {
        $s = oci_parse($c, $stmt);
        oci_execute($s);
}

echo "Done\n";

?>
--EXPECT--
<MYTAG/>

Done

http://cvs.php.net/viewvc.cgi/php-src/ext/oci8/tests/bug43497_92.phpt?view=markup&rev=1.1
Index: php-src/ext/oci8/tests/bug43497_92.phpt
+++ php-src/ext/oci8/tests/bug43497_92.phpt
--TEST--
Bug #43497 (OCI8 XML/getClobVal aka temporary LOBs leak UGA memory)
--SKIPIF--
<?php 
if (!extension_loaded('oci8')) die ("skip no oci8 extension"); 
ob_start();
phpinfo(INFO_MODULES);
$phpinfo = ob_get_clean();
$ov = preg_match('/Oracle Version => 9.2/', $phpinfo);
if ($ov !== 1) {
        die ("skip expected output only valid for Oracle 9.2 clients");
}
?>
--FILE--
<?php

require dirname(__FILE__).'/connect.inc';

function sessionid($c)  // determines and returns current session ID
{
    $query = "select sid from v\$session where audsid = userenv('sessionid')";

    $stmt = oci_parse($c, $query);

    if (oci_execute($stmt, OCI_DEFAULT)) {
                $row = oci_fetch($stmt);
                return oci_result($stmt, 1);
    }

    return null;
}


function templobs($c, $sid)  // returns number of temporary LOBs
{
    $query = "select abstract_lobs from v\$temporary_lobs where sid = " . $sid;

    $stmt = oci_parse($c, $query);

    if (oci_execute($stmt, OCI_DEFAULT)) {
                $row = oci_fetch($stmt);
                $val = oci_result($stmt, 1);
                oci_free_statement($stmt);
                return $val;
    }
    return null;
}


// Read all XML data using explicit LOB locator
function readxmltab_ex($c)
{
    $stmt = oci_parse($c, "select extract(xml, '/').getclobval() from 
bug43497_tab");

        $cntchk = 0;
        if (oci_execute($stmt)) {
                while ($result = oci_fetch_array($stmt, OCI_NUM)) {
                        $result[0]->free();   // cleanup properly
                        ++$cntchk;
                }
        }
        echo "Loop count check = $cntchk\n";
}

// Read all XML data using explicit LOB locator but without freeing the temp 
lobs
function readxmltab_ex_nofree($c)
{
    $stmt = oci_parse($c, "select extract(xml, '/').getclobval() from 
bug43497_tab");

        $cntchk = 0;
        if (oci_execute($stmt)) {
                while ($result = oci_fetch_array($stmt, OCI_NUM)) {
                        ++$cntchk;
                }
        }
        echo "Loop count check = $cntchk\n";
}

// Read all XML data using implicit LOB locator
function readxmltab_im($c)
{
    $stmt = oci_parse($c, "select extract(xml, '/').getclobval() from 
bug43497_tab");

        $cntchk = 0;
        if (oci_execute($stmt)) {
                while ($result = oci_fetch_array($stmt, 
OCI_NUM+OCI_RETURN_LOBS)) {
                        ++$cntchk;
                }
        }
        echo "Loop count check = $cntchk\n";
}

function createxmltab($c)  // create table w/ field of XML type
{
        @dropxmltab($c);
    $stmt = oci_parse($c, "create table bug43497_tab (id number primary key, 
xml xmltype)");
    oci_execute($stmt);
}

function dropxmltab($c)  // delete table
{
    $stmt = oci_parse($c, "drop table bug43497_tab");
    oci_execute($stmt);
}


function fillxmltab($c)
{
        for ($id = 1; $id <= 100; $id++) {
                
                // create an XML element string with random data                
                $s = "<data>";
                for ($j = 0; $j < 128; $j++) {
                        $s .= rand();           
                }
                $s .= "</data>\n";              
                for ($j = 0; $j < 4; $j++) {
                        $s .= $s;
                }               
                $data = "<?xml version=\"1.0\"?><records>" . $s . "</records>";
                
                // insert XML data into database
                
                $stmt = oci_parse($c, "insert into bug43497_tab(id, xml) values 
(:id, sys.xmltype.createxml(:xml))");
                oci_bind_by_name($stmt, ":id", $id);
                $clob = oci_new_descriptor($c, OCI_D_LOB);
                oci_bind_by_name($stmt, ":xml", $clob, -1, OCI_B_CLOB);
                $clob->writetemporary($data);
                oci_execute($stmt);
                
                $clob->close();
                $clob->free();
        }
}


// Initialize

createxmltab($c);
fillxmltab($c);

// Run Test

$sid = sessionid($c);

echo "Explicit LOB use\n";
for ($i = 1; $i <= 10; $i++) {
    echo "\nRun              = " . $i . "\n";
    echo "Temporary LOBs   = " . templobs($c, $sid) . "\n";
    readxmltab_ex($c);
}

echo "\nImplicit LOB use\n";
for ($i = 1; $i <= 10; $i++) {
    echo "\nRun              = " . $i . "\n";
    echo "Temporary LOBs   = " . templobs($c, $sid) . "\n";
    readxmltab_im($c);
}

echo "\nExplicit LOB with no free (i.e. a temp lob leak)\n";
for ($i = 1; $i <= 10; $i++) {
    echo "\nRun              = " . $i . "\n";
    echo "Temporary LOBs   = " . templobs($c, $sid) . "\n";
    readxmltab_ex_nofree($c);
}



// Cleanup

dropxmltab($c);

oci_close($c);

echo "Done\n";
?>
--EXPECT--
Explicit LOB use

Run              = 1
Temporary LOBs   = 0
Loop count check = 100

Run              = 2
Temporary LOBs   = 100
Loop count check = 100

Run              = 3
Temporary LOBs   = 200
Loop count check = 100

Run              = 4
Temporary LOBs   = 300
Loop count check = 100

Run              = 5
Temporary LOBs   = 400
Loop count check = 100

Run              = 6
Temporary LOBs   = 500
Loop count check = 100

Run              = 7
Temporary LOBs   = 600
Loop count check = 100

Run              = 8
Temporary LOBs   = 700
Loop count check = 100

Run              = 9
Temporary LOBs   = 800
Loop count check = 100

Run              = 10
Temporary LOBs   = 900
Loop count check = 100

Implicit LOB use

Run              = 1
Temporary LOBs   = 1000
Loop count check = 100

Run              = 2
Temporary LOBs   = 1100
Loop count check = 100

Run              = 3
Temporary LOBs   = 1200
Loop count check = 100

Run              = 4
Temporary LOBs   = 1300
Loop count check = 100

Run              = 5
Temporary LOBs   = 1400
Loop count check = 100

Run              = 6
Temporary LOBs   = 1500
Loop count check = 100

Run              = 7
Temporary LOBs   = 1600
Loop count check = 100

Run              = 8
Temporary LOBs   = 1700
Loop count check = 100

Run              = 9
Temporary LOBs   = 1800
Loop count check = 100

Run              = 10
Temporary LOBs   = 1900
Loop count check = 100

Explicit LOB with no free (i.e. a temp lob leak)

Run              = 1
Temporary LOBs   = 2000
Loop count check = 100

Run              = 2
Temporary LOBs   = 2100
Loop count check = 100

Run              = 3
Temporary LOBs   = 2200
Loop count check = 100

Run              = 4
Temporary LOBs   = 2300
Loop count check = 100

Run              = 5
Temporary LOBs   = 2400
Loop count check = 100

Run              = 6
Temporary LOBs   = 2500
Loop count check = 100

Run              = 7
Temporary LOBs   = 2600
Loop count check = 100

Run              = 8
Temporary LOBs   = 2700
Loop count check = 100

Run              = 9
Temporary LOBs   = 2800
Loop count check = 100

Run              = 10
Temporary LOBs   = 2900
Loop count check = 100
Done
http://cvs.php.net/viewvc.cgi/php-src/ext/oci8/tests/connect_scope1.phpt?view=markup&rev=1.1
Index: php-src/ext/oci8/tests/connect_scope1.phpt
+++ php-src/ext/oci8/tests/connect_scope1.phpt

http://cvs.php.net/viewvc.cgi/php-src/ext/oci8/tests/connect_scope2.phpt?view=markup&rev=1.1
Index: php-src/ext/oci8/tests/connect_scope2.phpt
+++ php-src/ext/oci8/tests/connect_scope2.phpt

http://cvs.php.net/viewvc.cgi/php-src/ext/oci8/tests/connect_scope_try1.phpt?view=markup&rev=1.1
Index: php-src/ext/oci8/tests/connect_scope_try1.phpt
+++ php-src/ext/oci8/tests/connect_scope_try1.phpt

http://cvs.php.net/viewvc.cgi/php-src/ext/oci8/tests/connect_scope_try2.phpt?view=markup&rev=1.1
Index: php-src/ext/oci8/tests/connect_scope_try2.phpt
+++ php-src/ext/oci8/tests/connect_scope_try2.phpt

http://cvs.php.net/viewvc.cgi/php-src/ext/oci8/tests/connect_scope_try3.phpt?view=markup&rev=1.1
Index: php-src/ext/oci8/tests/connect_scope_try3.phpt
+++ php-src/ext/oci8/tests/connect_scope_try3.phpt

http://cvs.php.net/viewvc.cgi/php-src/ext/oci8/tests/connect_scope_try4.phpt?view=markup&rev=1.1
Index: php-src/ext/oci8/tests/connect_scope_try4.phpt
+++ php-src/ext/oci8/tests/connect_scope_try4.phpt

http://cvs.php.net/viewvc.cgi/php-src/ext/oci8/tests/connect_scope_try5.phpt?view=markup&rev=1.1
Index: php-src/ext/oci8/tests/connect_scope_try5.phpt
+++ php-src/ext/oci8/tests/connect_scope_try5.phpt

http://cvs.php.net/viewvc.cgi/php-src/ext/oci8/tests/connect_scope_try6.phpt?view=markup&rev=1.1
Index: php-src/ext/oci8/tests/connect_scope_try6.phpt
+++ php-src/ext/oci8/tests/connect_scope_try6.phpt

http://cvs.php.net/viewvc.cgi/php-src/ext/oci8/tests/drcp_characterset.phpt?view=markup&rev=1.1
Index: php-src/ext/oci8/tests/drcp_characterset.phpt
+++ php-src/ext/oci8/tests/drcp_characterset.phpt

http://cvs.php.net/viewvc.cgi/php-src/ext/oci8/tests/drcp_conn_close1.phpt?view=markup&rev=1.1
Index: php-src/ext/oci8/tests/drcp_conn_close1.phpt
+++ php-src/ext/oci8/tests/drcp_conn_close1.phpt

http://cvs.php.net/viewvc.cgi/php-src/ext/oci8/tests/drcp_conn_close2.phpt?view=markup&rev=1.1
Index: php-src/ext/oci8/tests/drcp_conn_close2.phpt
+++ php-src/ext/oci8/tests/drcp_conn_close2.phpt

http://cvs.php.net/viewvc.cgi/php-src/ext/oci8/tests/drcp_connect1.phpt?view=markup&rev=1.1
Index: php-src/ext/oci8/tests/drcp_connect1.phpt
+++ php-src/ext/oci8/tests/drcp_connect1.phpt

http://cvs.php.net/viewvc.cgi/php-src/ext/oci8/tests/drcp_functions.inc?view=markup&rev=1.1
Index: php-src/ext/oci8/tests/drcp_functions.inc
+++ php-src/ext/oci8/tests/drcp_functions.inc

http://cvs.php.net/viewvc.cgi/php-src/ext/oci8/tests/drcp_newconnect.phpt?view=markup&rev=1.1
Index: php-src/ext/oci8/tests/drcp_newconnect.phpt
+++ php-src/ext/oci8/tests/drcp_newconnect.phpt

http://cvs.php.net/viewvc.cgi/php-src/ext/oci8/tests/drcp_pconn_close1.phpt?view=markup&rev=1.1
Index: php-src/ext/oci8/tests/drcp_pconn_close1.phpt
+++ php-src/ext/oci8/tests/drcp_pconn_close1.phpt

http://cvs.php.net/viewvc.cgi/php-src/ext/oci8/tests/drcp_pconn_close2.phpt?view=markup&rev=1.1
Index: php-src/ext/oci8/tests/drcp_pconn_close2.phpt
+++ php-src/ext/oci8/tests/drcp_pconn_close2.phpt

http://cvs.php.net/viewvc.cgi/php-src/ext/oci8/tests/drcp_privileged.phpt?view=markup&rev=1.1
Index: php-src/ext/oci8/tests/drcp_privileged.phpt
+++ php-src/ext/oci8/tests/drcp_privileged.phpt

http://cvs.php.net/viewvc.cgi/php-src/ext/oci8/tests/drcp_scope1.phpt?view=markup&rev=1.1
Index: php-src/ext/oci8/tests/drcp_scope1.phpt
+++ php-src/ext/oci8/tests/drcp_scope1.phpt

http://cvs.php.net/viewvc.cgi/php-src/ext/oci8/tests/drcp_scope2.phpt?view=markup&rev=1.1
Index: php-src/ext/oci8/tests/drcp_scope2.phpt
+++ php-src/ext/oci8/tests/drcp_scope2.phpt

http://cvs.php.net/viewvc.cgi/php-src/ext/oci8/tests/drcp_scope3.phpt?view=markup&rev=1.1
Index: php-src/ext/oci8/tests/drcp_scope3.phpt
+++ php-src/ext/oci8/tests/drcp_scope3.phpt
--TEST--
DRCP: oci_pconnect() with scope end when oci8.old_oci_close_semantics ON
--SKIPIF--
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
--INI--
oci8.old_oci_close_semantics=1
--FILE--
<?php

require dirname(__FILE__)."/drcp_functions.inc";
require dirname(__FILE__)."/details.inc";

// The test opens a connection within function1 and updates a table
// (without committing).  Another connection is opened from function
// 2, and the table queried.  When function1 ends, the connection from
// function1 is not closed, so the updated value will be seen in
// function2.  Also the table can't be dropped because an uncommitted
// transaction exists.

// Create the table
$c = oci_new_connect($user,$password,$dbase);
@drcp_drop_table($c);
drcp_create_table($c);

echo "This is with a OCI_PCONNECT\n";
function1($user,$password,$dbase);

// Should return the OLD value
function2($user,$password,$dbase);

// This is the first scope for the script

function function1($user,$password,$dbase)
{
        var_dump($c = oci_pconnect($user,$password,$dbase));
        drcp_update_table($c);
}

// This is the second scope

function function2($user,$password,$dbase)
{
        var_dump($c = oci_pconnect($user,$password,$dbase));
        drcp_select_value($c);
}

drcp_drop_table($c);
oci_close($c);

echo "Done\n";

?>
--EXPECTF--
This is with a OCI_PCONNECT
resource(%d) of type (oci8 persistent connection)
Update done-- DEPT value has been set to NEWDEPT
resource(%d) of type (oci8 persistent connection)
The value of DEPT for id 105 is NEWDEPT

Warning: oci_execute(): ORA-00054: %s
Done
http://cvs.php.net/viewvc.cgi/php-src/ext/oci8/tests/drcp_scope4.phpt?view=markup&rev=1.1
Index: php-src/ext/oci8/tests/drcp_scope4.phpt
+++ php-src/ext/oci8/tests/drcp_scope4.phpt
--TEST--
DRCP: oci_pconnect() with scope end when oci8.old_oci_close_semantics OFF
--SKIPIF--
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
--INI--
oci8.old_oci_close_semantics=0
--FILE--
<?php

require dirname(__FILE__)."/drcp_functions.inc";
require dirname(__FILE__)."/details.inc";

// The test opens a connection within function1 and updates a table
// (without committing).  Another connection is opened from function
// 2, and the table queried.  When function1 ends, the txn is rolled
// back and hence the updated value will not be reflected in function2

// Create the table
$c = oci_new_connect($user,$password,$dbase);
@drcp_drop_table($c);
drcp_create_table($c);

echo "This is with a OCI_PCONNECT\n";
function1($user,$password,$dbase);

// Should return the OLD value
function2($user,$password,$dbase);

// This is the first scope for the script

function function1($user,$password,$dbase)
{
        var_dump($c = oci_pconnect($user,$password,$dbase));
        drcp_update_table($c);
}

// This is the second scope

function function2($user,$password,$dbase)
{
        var_dump($c = oci_pconnect($user,$password,$dbase));
        drcp_select_value($c);
}

drcp_drop_table($c);
oci_close($c);

echo "Done\n";

?>
--EXPECTF--
This is with a OCI_PCONNECT
resource(%d) of type (oci8 persistent connection)
Update done-- DEPT value has been set to NEWDEPT
resource(%d) of type (oci8 persistent connection)
The value of DEPT for id 105 is HR
Done

http://cvs.php.net/viewvc.cgi/php-src/ext/oci8/tests/drcp_scope5.phpt?view=markup&rev=1.1
Index: php-src/ext/oci8/tests/drcp_scope5.phpt
+++ php-src/ext/oci8/tests/drcp_scope5.phpt
--TEST--
DRCP: oci_pconnect() with scope end when oci8.old_oci_close_semantics ON
--SKIPIF--
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
--INI--
oci8.old_oci_close_semantics=1
--FILE--
<?php

require dirname(__FILE__)."/drcp_functions.inc";
require dirname(__FILE__)."/details.inc";

// Similar to drcp_scope3.phpt but does a commit before end of
// function2, allowing the table to be dropped cleanly at the end.

// The test opens a connection within function1 and updates a table
// (without committing).  Another connection is opened from function
// 2, and the table queried.  When function1 ends, the connection from
// function1 is not closed, so the updated value will be seen in
// function2.  Also the table can't be dropped because an uncommitted
// transaction exists.

// Create the table
$c = oci_new_connect($user,$password,$dbase);
@drcp_drop_table($c);
drcp_create_table($c);

echo "This is with a OCI_PCONNECT\n";
function1($user,$password,$dbase);

// Should return the OLD value
function2($user,$password,$dbase);

// This is the first scope for the script

function function1($user,$password,$dbase)
{
        var_dump($c = oci_pconnect($user,$password,$dbase));
        drcp_update_table($c);
}

// This is the second scope

function function2($user,$password,$dbase)
{
        var_dump($c = oci_pconnect($user,$password,$dbase));
        drcp_select_value($c);
        oci_commit($c);
}

drcp_drop_table($c);
oci_close($c);

echo "Done\n";

?>
--EXPECTF--
This is with a OCI_PCONNECT
resource(%d) of type (oci8 persistent connection)
Update done-- DEPT value has been set to NEWDEPT
resource(%d) of type (oci8 persistent connection)
The value of DEPT for id 105 is NEWDEPT
Done
http://cvs.php.net/viewvc.cgi/php-src/ext/oci8/tests/pecl_bug10194_blob_64.phpt?view=markup&rev=1.1
Index: php-src/ext/oci8/tests/pecl_bug10194_blob_64.phpt
+++ php-src/ext/oci8/tests/pecl_bug10194_blob_64.phpt

http://cvs.php.net/viewvc.cgi/php-src/ext/oci8/tests/testping.phpt?view=markup&rev=1.1
Index: php-src/ext/oci8/tests/testping.phpt
+++ php-src/ext/oci8/tests/testping.phpt

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to