Benchmarking PDO and ADOdb Database Abstraction Libraries

June 23rd, 2008 § 2

I was unable to locate a satisfactory benchmark of PDO vs. ADOdb, so I decided create some to get an idea of the performance differences.

I expected PDO to beat ADOdb easily, since PDO is a native PHP library and requires no run-time include. See my Web App benchmarking methodology here to understand why I was unsatisfied with the existing PDO vs ADOdb and PEAR::NET library benchmarks I found online.

» Read the rest of this entry «

Convert from ADOdb Library to PDO

May 30th, 2008 § 0

In the past I used the ADOdb Database Abstraction Library for PHP for a lot of my PHP projects. However, PDO (PHP Data Objects) is now a better fit as it performs better for me and doesn’t require the inclusion of any libraries.

I wanted to make the switch not only for future projects, but also to go back into some of my existing projects that I maintain and covert from ADOdb to PDO. However, I didn’t want to alter thousands of calls to ADOdb methods.

The solution I came up with was to do some more work on my PDO Singleton Class. By adding in the ADOdb methods Execute(), qstr(), GetOne(), and an iterator for the adodb recordsets returned by Execute(), I was able to easily transition to PDO in projects with thousands of lines of code by including this class and creating a new instance of sdb() instead of NewADOConnection() and Connect().

$DB =& new sdb(”mysql:host=localhost;dbname=testdb”, ‘username’, ‘password’);

This is the equivalent of the following ADOdb code: (except it is a singleton)

$DB = NewADOConnection(’mysql’);
$DB->Connect(”localhost”, “username”, “password”, “testdb”);

You can now treat that $DB object just as you would with ADOdb to create a connection to the mysql database ‘testdb’. Note: I have not refactored the error or transaction functions as they were not used in the specific projects I needed this conversion in… but they would be very simple to add.

» Read the rest of this entry «

Where Am I?

You are currently browsing entries tagged with ADOdb at Tony Landis.