General => Gena01 Blog => Topic started by: Gena01 on January 07, 2009, 12:09:56 pm

Title: My Pear DB fork.
Post by: Gena01 on January 07, 2009, 12:09:56 pm
We use PEAR DB extensively in our code (for my day job) and switching over to another abstraction library is too much hassle at the moment. We are also still in the migration phase from PHP4 to PHP5. (Yes I know PHP4 is dead and PHP5 rocks) One of the challenges that we faced was the fact that Pear DB generates a ton of warnings when running in PHP5 and it's also pretty much obsolete/abandoned. Which is a good thing for me, since I don't need to worry about having to merge different trees. I am currently focusing my efforts on db.php and the pear db oci8 driver implementation. I also added some new code to speed up Pear DB a little.

A couple of items that were fixed already:
+ Added a PHP version check to reduce the warnings and call the right function for the right version of PHP (4 vs 5).
+ Added oci8 implementation functions for GetCol(), GetAll() and GetAssoc() which use the oci8 ocifetchstatement() function to fetch rows in batches. 1 function call vs 2* N rows. The difference is huge if you are fetching 200-300 rows.

Things still looking at:
- There's a default pre-fetch that was introduced and somehow it's set at 400? That seems quite large. PHP oci8 module actually sets it to 100 by default. It's also set every time before fetching the rows. I am still pondering if we need another default in Pear DB driver.