HEAD ON! Support has been added for Pear::DB!

spiderr • 25 Jan 2006 (21:42 UTC)
Research and Development
As of yesterday, myself and xing have moved primarily to HEAD for development. R1 has been stable and cooking in the oven for nearly 9 months, and we feel it's in great shape. Now it is time to move forward with our conquest to the top of the php applications empire.

Along those lines, we have already made many great changes. First, we have some people wanting to use bitweaver, however they want to use Pear::DB instead of ADODB. I have abstracted out our BitDB class and the core is now working 100% on both, with a simple toggle of a variable in kernel/config_inc.php

ADODB is our prefered mechanism and is still required for things like the installer, and a handful of admin pages that verifyInstalledPackages. However, this reworking allows for PEAR or the addition of the new native PDO stuff if it happens to turn out to be any good. Pear::DB is slower than ADODB, and feature incomplete IMHO (missing DataDict for one..), however there is a lot of handy stuff written in PEAR some people need/prefer.

Very little changes were needed to make the transition thanks to ADODB's and Pear's almost identical behaviors for the key functions. BitDb has been broken apart into the following classes:

BitDbBase.php - Pure Virtual Base Class, and common functions like convertQuery
|->BitDbAdodb.php - ADODB implementation
|->BitDbPear.php - PEAR implmentation

Very few things have changed. backticks in our queries are still handled the same way. convertQuery is still in the BitDbBase class, as is convert_sortmode and others.

What does need to change is the use of $result->EOF and $result->fields in the results sets. We don't do this everywhere, but it is common. However, it is very easy to change like the following:

while( !$result->EOF ) {
array_key_existsstrtolower$result->fields['title'] ), $ret ) ) {
$result->fields['description'] = tra'Multiple pages with this name' );
$ret[strtolower$result->fields['title'] )] = $result->fields;

Changes to:

$row $result->fetchRow() ) {
array_key_existsstrtolower$row['title'] ), $ret ) ) {
$row['description'] = tra'Multiple pages with this name' );
$ret[strtolower$row['title'] )] = $row;

Also, queries that snag a single row and then use $rs->fields should revert to the simpler getRow() funciton in the BitDb classes.

I have not cleared out all the packages, but a good bit of them are all working with a restored bw.o dump. If you want to try out PEAR, update to HEAD, run "pear install DB", and add "$gBitDbSystem = 'pear';" to your kernel/config_inc.php

Related Items

Documentation » Technical Documentation

Documentation geared towards developers and people who want to learn about the core processes of bitweaver

  •    •    •    •    •    •    •    •    •    •    •    •    •    •    •    •    •    •    •    •    •    •    •    •    •    •    •    •    •    •    •    •    •