473,322 Members | 1,620 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

PEAR DB - Useful?

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

Jul 17 '05 #1
6 1451
ry**@carsonworkshops.com wrote:
What are people's thoughts on this class? IMHO, it seems like it's
overkill for what most developers need.

I started using it then I canned it and returned to the standard PHP. It
became an issue spending time learning a big class or geting my work
done. If the documentation was more user oriented-with more everyday
working examples I could use it maybe. My code was becoming "too
abstracted" too obtuse. Less maintainable w/the DB class.

But maybe it's more my own preference or even limitation that I didn't
use it. I need my code *obvious* above all elese.

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

Jul 17 '05 #2
ry**@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?


I use it and like it, even if the part I like is only ..% of its
functionality. What I like:

- central error reporting, no "or die()" all over the place

- nice shortcuts for getting single values or arrays in one pass,
without looping (getOne(), getCol(), getAssoc())

- automatic escaping of values with prepared statements:

$query = 'insert into table (field1, field2) values(?,?)';
$pear_db_object->query($query, array($raw_data1, $raw_data2));
JP
--
Sorry, <de*****@cauce.org> is a spam trap.
Real e-mail address unavailable. 5000+ spams per month.
Jul 17 '05 #3
ry**@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.
Jul 17 '05 #4
"ry**@carsonworkshops.com" <go****@carsonsystems.com> wrote in message
news:11**********************@c13g2000cwb.googlegr oups.com...
What are people's thoughts on this class? IMHO, it seems like it's
overkill for what most developers need.


Overkill isn't the right word. I would say it just doesn't work that well in
most situations. Unless your application performs very basic queries, the
class buys you little in terms of cross platform compatibility, as most
advanced queries requires vendor specific SQL syntax. This "then it'll work
with any database!" argument is rather bogus anyway, since few people have
the resources to actually QA the different setups.

Jul 17 '05 #5
ry**@carsonworkshops.com wrote:
What are people's thoughts on this class? IMHO, it seems like it's
overkill for what most developers need.


I hate PEAR. For database abstraction, I use phpBB like setup.

--
<?php echo 'Just another PHP saint'; ?>
Email: rrjanbiah-at-Y!com Blog: http://rajeshanbiah.blogspot.com/

Jul 17 '05 #6
The reason why I asked is because I think the PEAR DB class is a
classic case of OO over-abstraction. We've noticed a significant gain
in run-time efficiency by going procedural, instead of using a class to
connect to the DB. It almost seems backwards, but if it makes the
application 10% faster, then who's to argue?!

----------------------------------------------
One Day PHP/MySQL Workshop
www.carsonworkshops.com

Jul 17 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Bruno Desthuilliers | last post by:
Hello, Has someone here used the PEAR error handling mechanism, and how useful did he/her found it ? I'm a bit newbie with PHP (not with programming...) and currently working on a small OO...
13
by: Wolfgang May | last post by:
Hi, I have a problem with the HTTP implementation of the PEAR package: I try to PUT an XML instance to an XML database (eXist), but it always puts a binary: <?php require_once...
3
by: junkmail | last post by:
on a win 2k server apparantly it is saying i dont have it. or it cant find it. im using mySQL 4.1 php 4.3.x apache 3.0.53 im new to php and am doing some tutorials, but when i run the sripts...
3
by: Shelly | last post by:
I have been coding for almost 40 years, but only two months with php. I found www.php.net and it has a lot. I downloaded ZipCodeRange and it called for stuff, including DB.php. I was directed to...
7
by: Michael G | last post by:
Hi, Is PEAR DB worth using? Slower? Other problems? Or should a person just wrap db functions in a user-defined class? Mike
4
by: Alan Little | last post by:
On the PEAR site, the page for each package lists other packages that are dependent on it. That's nice, but is there way to determine which other packages the package itself depends on? It seems to...
1
by: IchBin | last post by:
I am new to PHP and I am running on Windoze XP SP 2. Just noticed that the PEAR installed dir structure I have (to DB subdir) is : C:\php5.2\PEAR\pear\DB My registry vars are:...
1
by: IchBin | last post by:
I remember having problems with pear when I first installed it but got it running some time ago. This is on a windoze XP SP OS. I did not think it was correct because it pointed to...
3
by: Anthony Smith | last post by:
I always get this message. No matter what package $ pear install Date PHP Warning: Module 'oci8' already loaded in Unknown on line 0 No releases available for package "pear.php.net/Date"...
2
by: mpar612 | last post by:
Hello, I'm new to Linux, setting up and running webservers. I purchased an unmanaged server that came with a lamp configuration and Plesk installed. I am trying to get PEAR functioning. I put a...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.