Re: PEAR DB - Useful?
From: kicken (slick_at_aoeex.com)
Date: 01/08/05
- Next message: Makoto Kuwata: "FWD: [[ANN] Kwartz-php 0.3.0 - a template system for PHP, Ruby, and Java]"
- Previous message: Jan Pieter Kunst: "Re: PEAR DB - Useful?"
- In reply to: ryan_at_carsonworkshops.com: "PEAR DB - Useful?"
- Next in thread: Chung Leong: "Re: PEAR DB - Useful?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sat, 08 Jan 2005 05:22:11 -0700
ryan@carsonworkshops.com wrote:
> What are people's thoughts on this class? IMHO, it seems like it's
> overkill for what most developers need.
>
> I've been using it for awhile now, and I tend to use only about 3% of
> it's functionality.
>
> Thoughts? Opinions?
> -----------------
> One Day PHP/MySQL Workshop
> www.carsonworkshops.com
>
I use it and like it quite well. I also only use probably only a small
amount, but I find it makes things much more manageable and a bit easier
to read/understand. I like the fact that provided I produce complient
SQL, all I have to do is change the connect string and I can use it to
work with more or less any database out there. Personally I only use
mysql, but for projects I make which I distribute, like my IRC bot, I
can say that it can, theoretically, be used with databases other than mysql.
I also like the if (DB::isError($result)) part, as it makes error
checking eaiser. Now I don't have to worry about 'for this sql
statement, what constitues an error' type things. Coupling that with
PHP5's exceptions and stuff, I do things like this:
if (DB::isError($res)){
throw new DatabaseException('Unable to query for ...', $res);
}
then my DatabaseException class can examine the $res varible and provide
debugging information in a log file. Again couple these exceptions with
templates(smarty) and a logError function, I can do things like this:
if (DB::isError($res)){
logWWWError($tpl, new DatabaseException('Unable to query for ...',
$res), __FILE__, __LINE__);
exit;
}
and not only do I get quick error checking, but I get a nice log file
with sql error details and also a generated error page which is shown to
the user with the message from the exception. Makes my applications
look nicer, and run a bit smoother I think.
- Next message: Makoto Kuwata: "FWD: [[ANN] Kwartz-php 0.3.0 - a template system for PHP, Ruby, and Java]"
- Previous message: Jan Pieter Kunst: "Re: PEAR DB - Useful?"
- In reply to: ryan_at_carsonworkshops.com: "PEAR DB - Useful?"
- Next in thread: Chung Leong: "Re: PEAR DB - Useful?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|