Re: why is PEAR::DB constantly initting connection?
| From: | joseph | Date: | Fri, 24 Mar 2006 17:05:46 +0000 |
| Subject: | Re: why is PEAR::DB constantly initting connection? | ||
| References: | 1 2 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-23445@lists.php.net to get a copy of this message | ||
2006-03-24 (금), 07:52 -0800, Justin Patrin 쓰시길:
> On 3/23/06, joseph <kmh496@kornet.net> wrote:
> > bonjour,
> >
> > why does my DB object always send INIT DB to mysql server? i am using
> > PHP 5.0.5 and
> > * @version Release: 1.7.5
> > * @link http://pear.php.net/package/DB
> > */
> >
> >
> > the problem caused by calls like the following -- very simple code,
> > really ---- may be caused by my PEAR/DB.php wrapper functions (see
> > below) . which are logically stupid, nevertheless, should i stop using
> > pear and go to mysql_query which does not do INIT DB in my server logs?
> > i need to run lots of queeries ( order of thousands at a shot) so ....
> > now, the evidence is my mysql query log (shown below the code, also),
> > please help me pinpoint the error................
> You're not really using DB how you should be. You'r eusing far too
> many globals and normal functions. Just use DB directly, don't use
> functions like this.
>
> Also try looking into PEAR::setErrorHandling().
>
i upgraded to MDB2 and there is no more DB init stuff going on.
also, i added
PEAR::setErrorHandling(PEAR_ERROR_DIE);
to my global variable initialization file
and am getting rid of the nasty code wrappers for PEAR::DB / MDB2.
thanks for pointing out MDB2 i had no idea it was the new DB.
(the documentation on PEAR.php.net is like not really there saying that
out in the open).
> Likely this "Init DB" thing is due to DB selecting the DB before every
> query. If this is why it's happening don't bother to complain about
> it, it's needed to correctly allow for multiple database connections.
>
> You could also try using MDB2 and see if that does the same thing.
> MDB2 is the supported DB layer now, DB is deprecated.
>
> --
> Justin Patrin
>