RE: [PEAR] QueryTool questions
| From: | Rob Hutton | Date: | Mon, 15 Sep 2003 19:09:09 +0000 |
| Subject: | RE: [PEAR] QueryTool questions | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-7824@lists.php.net to get a copy of this message | ||
You would have to do _construct(&$dsn) for this to work, otherwise a copy of
the DB object is passed, not a reference, and a new connection may or may
not be created (depending on the state when it was passed). Also, this
would require that the DSN is a variable which would break BC. I would
recommend instead that a setDBConnection(&$dbCon) or similar function be
added and the $dsn parameter to _construct be made optional...
Thanks,
Rob
> -----Original Message-----
> From: Wolfram Kriesing [mailto:lists@kriesing.de]
> Sent: Monday, September 15, 2003 2:13 PM
> To: Jackson Miller
> Cc: PEAR
> Subject: Re: [PEAR] QueryTool questions
>
>
> Jackson Miller wrote:
> > I have two questions about QueryTool
> >
> > 1) Could a line be added to _construct to allow for using an
> existing DB
> > object.
> > Something along the lines of:
> > if (DB::isConnection($dsn)) {
> > // use that connection
> > } else {
> > if ($autoConnect) {
> > $this->connect($dsn);
> > }
> > }
> >
> > The reason I ask for this is that it would make my life using
> QueryTool within
> > my application API classes a lot easier. On a high traffic
> site I really
> > want to keep DB connections to a minimum.
>
> of course this is possible, i will add it. i remember that that was on
> my todo anyway. sorry for being so slow :-)
>
> >
> > 2) how do you set the LIMIT part of a query. Is that the getMultiple
> > function? I ask becuase the documentation is a little lacking
> in that area.
>
> either use
> setLimit(<start>,<count>);
> getAll();
> or
> getAll(<start>,<count>)
>
> getMultiple() is actually an extension to get().
> get($id) gets the row for the given $id, where $id is compared to the
> primary column. And getMultiple($ids) works for multiple number of IDs.
>
>
> --
> Wolfram
>
> http://opensource.visionp.de
>
> ... authentication system ....
> http://sf.net/projects/auth
>
> --
> PEAR General Mailing List (http://pear.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>