RE: [PEAR] DB connections with more databases
| From: | Sönke Ruempler | Date: | Wed, 01 Dec 2004 07:43:29 +0000 |
| Subject: | RE: [PEAR] DB connections with more databases | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-15930@lists.php.net to get a copy of this message | ||
Justin Patrin wrote on Monday, November 15, 2004 8:00 PM:
> On Mon, 15 Nov 2004 13:28:36 +0100, Sönke Ruempler
> <ruempler@topconcepts.com> wrote:
>> Hi,
>>
>> i noticed that i can't change the database within a pear object,
>> because DB sets the db before each query. Now i have a mysql server
>> with 4 databases and i need to use them all. I could make 4 DB
>> database connections, but that is really ugly and much overhead. Any
>> solution?
>>
>
> The best solution is to prefix your table names with the db name:
>
> SELECT * FROM database.table
I noticed that there is a hint in the mysql.php code that a method for
setting the database in runtime should be implemented, atm it's only the _db
member variable. Imho setting the database for *each* query is unnecessary
overhead.
If I am wrong, please correct me :)
--
soenke