Re: switching DB's

From: Date: Mon, 15 Apr 2002 00:04:57 +0000
Subject: Re: switching DB's
References: 1 2 3  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-1139@lists.php.net to get a copy of this message
> > 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 I tested that only one connection was used by opening seperate connections in a php script using pear, and monitering the threads created variable in mysql, and only one connection is made.. so that solves my problem. Thank you. The only argument that I would make is that having a setDatabase method my be a little more intuitive than using multiple connect() statements. as the connect() method implies a connection bieng made (and not necissarily the re-use of the current connection.) Failing that I would lobby to have the connection reuse information put on the DB::connect() page of the pear documentation. That would have cleared things up for me a little more and I would have been using pear 4 months ago instead of just gettting started today. aside from that.. Great work on the pear project, thank you for spending your time on this, I appreciate the facilities you've provided thus far.. please.. keep up the great work!

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