Re: Re: DB: Changing database during script execution
| From: | Manuel Lemos | Date: | Fri, 26 Jul 2002 16:07:14 +0000 |
| Subject: | Re: Re: DB: Changing database during script execution | ||
| References: | 1 2 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-8019@lists.php.net to get a copy of this message | ||
On 07/22/2002 03:32 PM, Tomas V.V.Cox wrote:
Metabase makes that transparent. If it is necessary to close and re-open a connection, let it be. Since some operations do not require you to specify a database (it may even may not make sense), Metabase does not require that you define a database at setup time. The drivers only establish a connection when it is used for the first time. This way they avoid closing a connection to reopen it because you defined a new database name. -- Regards, Manuel LemosIs more a matter of the PHP support (or the backend API) that has the restriction of setting the database at connection time (Postgres, Oracle, Informix, ODBC, Interbase). In all that drivers the only way for switching the database is closing and reopening the connection.Well I dont know all Metabase drivers. But knowing Manuel he would not have put this method into his common Metabase class if it weren't supported by all the RDBMS that Metabase supports :-)to $dbname.MDB has setDatase($dbname) This method returns the old method and sets the databaseYeah, which basically does a disconnect() and connect(), the same I propossed to Martin (note that I'm talking about the drivers in general not MySQL specificly).Agreed. But your solution isn't that elegant than having a method that can change the database name. (Of course having such a method does only make sense if it can be done with all supported DBMS, as I already pointed out in an earlier mail.)