Forums | Mahara Community
Developers
/
Are we using PHP's PDO for database access?
30 April 2011, 20:07
Hello developers,
In my iMoot presentation on Mahara 1.4 features, a participant asked "What chances the database layer being migrated to PDO?" He provided a link to "Why you should be using PHP's PDO for Database Access." Are we doing that already? If not, is it on the roadmap? If not, what are the reasons?
Thank you.
Kristina
30 April 2011, 23:05
Hi Kristina,
We are currently using ADODB as our database abstraction layer, not PDO.
While we have considered switching to PDO before, it's a lot of work and at the time we didn't believe it was worth the effort.
Cheers,
Francois
01 May 2011, 2:22
Actually the correct answer here is 'if you want to use PDO then just select the PDO driver in ADOdb' ... Since PDO provides none of the SQL abstraction that is integral to ADOdb, you need a proper abstraction layer anyway, and so need ADOdb anyway - or some other library that has yet to be writen. One of the ways of TESTING the PDO sub-drivers is to use ADOdb and check that things work the same between the native version and the PDO version, and in most cases the speed difference can be noticable. ADOdb converts it's abstract layer to the native layer, introducing a second 'abstract' layer for PDO just adds to the processing.
PDO is the wrong fix for the problem. Most projects that have changed to it THINKING it fixes cross database working find that even what they have is then a lot more difficult to handle. Currently if you need cross database working ADOdb is the benchmark, and with it's own low level accelerator it can be faster than PDO anyway.
02 May 2011, 0:39
Thank you, Francois and Lester, for your answers. I'll link to them in the iMoot forum. If Michael, who asked the question, wants some more information, he can ask here as we clearly have an expert.
Cheers
Kristina