Re: switching DB's

From: Date: Sun, 14 Apr 2002 20:42:00 +0000
Subject: Re: switching DB's
References: 1 2  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-1138@lists.php.net to get a copy of this message
"Stig S. Bakken" wrote: > > On Sun, 2002-04-14 at 01:05, destr0 wrote: > > I have information in several different databases that I need to access. > > With my current database abstraction layer I make use of the > > mysql_select_db() function to switch databases on the fly between queries. > > > > The last time I looked the only way I could change databases with pear was > > by opening a second connection with a second dsn. Is there any way with > > pear to open a connection once and then switch databases on the same > > connection without opening a second connection? > > We could add a setDatabase method. What do people think? Tomas? > The mysql driver already do what Destr0 say. $db1 = DB::connect('mysql://root@localhost/db1'); $dbN = DB::connect('mysql://root@localhost/dbN'); Internally the same connection is used but PEAR DB switchs on the fly the database with mysql_select_db(). I don't see the real need for adding setDatabase. Tomas V.V.Cox

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