[phplib] Multiple database handling in one app. What if ...? From: Max Derkachev (kot <email protected>)
Date: 08/02/00

Good day (night ? :)) everybody.

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:

class DB_Data extends DB_Sql {
 var $Host = "localhost";
 var $Database = "data";
 var $User = "datauser";
 var $Password = "password"

 ........................
}

class DB_Sessions extends DB_Sql {
 var $Host = "localhost"; # or any other host
 var $Database = "sessions";
 var $User = "sessuser";
 var $Password = "otherpassword";
 .........................
}

etc ...

Then in container class we define DB_Sessions as database class, as in
User, Auth and other "service" classes, and DB_Data goes in any other
case, just to retreive non-session and user data.

Did anybody tried this setup at work?

--
Best regards,
Max A. Derkachev mailto:kot <email protected>
Symbol-Plus Publishing Ltd.
phone: +7 (812) 265-0054, 265-1228, phone/fax: 567-8775
http://www.Books.Ru -- All Books of Russia

--------------------------------------------------------------------- To unsubscribe, e-mail: phplib-unsubscribe <email protected> For additional commands, e-mail: phplib-help <email protected>