Re: troubles with db classes
| From: | Burak DAYIOGLU | Date: | Tue, 13 Mar 2001 05:48:44 +0000 |
| Subject: | Re: troubles with db classes | ||
| References: | 1 2 | Groups: | php.pear |
| Request: | Send a blank email to php-pear+get-1807@lists.php.net to get a copy of this message | ||
Ok, then I have misunderstood the architecture, sorry. But still, I'm
having a problematic code with query() which in turn works seamless with
simplequery(). If anyone wants to check it out, I am willing to provide
it.
There is still the issue with resultset handles. When numrows e.g. is
given a handle which doesn't point to a real handle, it gives an error
with no descriptive information. I was suggesting the addition of
detailed error description for this.
regards,
-bd
Stig Sæther Bakken wrote:
>
> [Burak DAYIOGLU <dayioglu@metu.edu.tr>]
> > Hello,
> > I found out the problem at last. The query() method is not implemented
> > in the pgsql.php file. So when I call the query method, it is called
> > but as no implementation is provided nothing happens (and no error or
> > warning is displayed as well). When I try to get count of rows returned
> > I get the real error...
>
> None of the DB_<dbtype> classes have the query() method, it's
> inherited from DB_common. All the database-specific stuff is in
> simpleQuery(), query() is merely a wrapper returning a DB_result
> object.
>
> > Wouldn't it be better to give a descriptive error message when numrows()
> > is called for a handle which is not valid or not full with some data?
> > Stig?
>
> PEAR has an error system that is pretty configurable and that is not
> "noisy" by default (printing errors) like PHP is. You can configure
> it to, though. Try this:
>
> $dbh = DB::connect($dsn);
> $dbh->setErrorHandling(PEAR_ERROR_DIE);
>
> If you only want to print the error message, use PEAR_ERROR_PRINT
> instead, or PEAR_ERROR_TRIGGER if you want to use PHP's internal
> errors.
>
> - Stig
>
> --
> Stig Sæther Bakken <ssb@fast.no>
> Fast Search & Transfer ASA, Trondheim, Norway