Important question about MDB::connect and disconnect

From: Date: Wed, 31 Mar 2004 15:53:40 +0000
Subject: Important question about MDB::connect and disconnect
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-11562@lists.php.net to get a copy of this message
Hi all, I the MDB documenation, it is well explained that one should prefer create a new connection to a database using a rference to a connecion object rather than a copy (sample from PDB.php) * IMPORTANT: In order for MDB to work properly it is necessary that * you make sure that you work with a reference of the original * object instead of a copy (this is a PHP4 quirk). * * For example: * $mdb =& MDB::connect($dsn); * ^^ * And not: * $mdb = MDB::connect($dsn); * ^^ My question is 'When should i disconnect the connection then??' In my application, I use many classes that all need a connection to the same DB. So , in every class constructor, I create a new refernece using $this->conn = & MDB::connect($dsn);. I use that class variable this connection in many functions. When disconnecting inside one class, the disconnect occurs on the referenced connection object. So the connection is lost for all classes. What do you suggest?? Vincent

« previous php.pear.general (#11562) next »