DBM/A Compatibility Layer

From: Date: Wed, 19 Jun 2002 09:25:31 +0000
Subject: DBM/A Compatibility Layer
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-7205@lists.php.net to get a copy of this message
Howdy, We had discussed earlier the possibility of having a DBM-style database compatibility layer to deal with the different DBM database libraries that PHP supports in a more consistent manner. To that end, I have written a class called DBA. It is a wrapper to the dba_* functions in PHP which provides an object interface and returns PEAR-style errors. It also implements a complete DBM-style database driver, written in PHP, which appears to be about as fast as any of the compiled-in drivers. One of the interesting features of the built-in driver is that it logs transactions, maintaining data integrity if there is a bug that prevents close() from being called properly. An example of this library's use is as follows: // $driver can be any of the native drivers, // or 'simple' for the built-in driver $db = DBA::create('simple'); $db->insert($key, $value); $db->replace($key, $value); $db->delete($key); $db->close(); Also included is a set of functions that wrap around the built-in DBM driver and provide the PHP dba_* functions on systems where they are not compiled in. I would like to include this library in PEAR. The code and some benchmark graphs are located here: http://www.brentandtiffany.org/projects/dba/news.xml.html There is a working table and relational database that go along with this, but I'm still working on cleaning, optimizing and PEARifying that code. I would enjoy any comments on design, utility and naming conventions for this library. - Brent

« previous php.pear.dev (#7205) next »