Date: 08/02/00
- Next message: Philippe Paravicini: "RE: [phplib] Can't use database, any ideas?"
- Previous message: Luke Sturgess: "[phplib] User-groups"
- Next in thread: INFO jpmnet.de: "Re: [phplib] Multiple database handling in one app. What if ...?"
- Reply: INFO jpmnet.de: "Re: [phplib] Multiple database handling in one app. What if ...?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
> PHP reuses database connections, so it's impossible to handle two or
> more database connections that use similar connection parameters (as I
> know) simultaneously - you'll get the same results in all opened
> "connections". But what if one introduces several classes inherited
> DB_Sql with different connection parameters, e.g:
I believe the consensus on this list has been that this will work as is - if
the username and password are different for each extension of DB_Sql.
In those cases where separate sql logins are undesired, I have kludged the
following. I have added the following function to db_mysql.inc (haven't
tested with any other databases):
function verify_database() {
if($this->Link_ID != 0) {
$result = mysql_fetch_array(mysql_query("select database()"));
if($result["database()"] != $this->Database) {
<email protected>($this->Database,$this->Link_ID);
}
}
}
I call this function inside query() after the connect check:
function query($Query_String) {
if ($Query_String == "") return 0;
if (!$this->connect()) return 0;
# here's the new call
$this->verify_database();
if($this->Query_ID) $this->free();
blah blah ...
}
Layne Weathers
Lead Programmer
Ifworld, Inc.
layne <email protected>
---------------------------------------------------------------------
To unsubscribe, e-mail: phplib-unsubscribe <email protected>
For additional commands, e-mail: phplib-help <email protected>
- Next message: Philippe Paravicini: "RE: [phplib] Can't use database, any ideas?"
- Previous message: Luke Sturgess: "[phplib] User-groups"
- Next in thread: INFO jpmnet.de: "Re: [phplib] Multiple database handling in one app. What if ...?"
- Reply: INFO jpmnet.de: "Re: [phplib] Multiple database handling in one app. What if ...?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

