PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Database » DB » Bug #2469

method disconnect no Php5/MySQL

Details

Submitted2004-10-06 15:55 UTC
Fromarnaud dot vautey at kenoa dot com
Assigneddanielc
StatusBogus
PackageDB
PHP Version5.0.1
OSwindows XP
Roadmaps(Not assigned)

Comments

[2004-10-06 15:55 UTC] arnaud dot vautey at kenoa dot com

Description:
------------
if I open and close a connection on 2 functions and call the function 1 inside the second one, the call of the method disconnect() on function1 close the connection of the function2.
Above the code to reproduce it.
This probleme does not appear with php4.

Reproduce code:
---------------
require 'DB.php';
function testdb1(){

//Connection
$options = array(
'debug' => 2,
'portability' => DB_PORTABILITY_ALL,
);
$db2 = DB::connect(DB_DSN, $options);
if (DB::isError($db2)) {
echo 'Standard: ' . $db->getMessage() . "\n";
exit;
}
$sql="SELECT * FROM test";
$result =& $db2->query($sql);
echo "fonction db1";
while ($row =& $result->fetchRow(DB_FETCHMODE_ASSOC)) {
echo $row['type'];}
$result->free();
$db2->disconnect();
}//end

function testdb2(){
//Connection
$options = array(
'debug' => 2,
'portability' => DB_PORTABILITY_ALL,
);
$db =& DB::connect(DB_DSN, $options);
if (DB::isError($db)) {
echo 'Standard : ' . $db->getMessage() . "\n";
exit;
}
testdb1(); //call the first function
$sql="SELECT * FROM test2";
$result =& $db->query($sql);
while ($row =& $result->fetchRow(DB_FETCHMODE_ASSOC)) {
echo $row['type'];}
$result->free();
$db->disconnect();
}//end Liste Box
echo "testDB";
testdb2();

Expected result:
----------------
result from the 2 functions

Actual result:
--------------
Fatal error: Call to undefined method DB_Error::fetchRow() in