Quote from: Boby at Mar 15, 2006, 08:45 PM
I want to suggest using for the main MODx code as well fot plugins, snippets, etc. a very good database library for PHP. The best out there is AdoDB.
I am now helping on developing a link directory application, PHP Link Directory, that uses this library. My first contact with it was to write my old SQL queries, but after a while I can now save a lot of time and code using AdoDB. I must say, it’s not only fast, but also secure. For example you fill an array with the values you want to write to the DB, put one line of code and the library takes care for the rest, you don’t have to do hard charachter escaping or quoting and so on.
Welcome to the community Boby.
I’ve done a lot of research and development over the past 4 months with various PHP db layers and object relational management tools. In fact, I already did a proof of concept, replacing the core of MODx with a Propel generated object model that uses Creole for persistence (which by the way, is much more secure than ADOdb, which I believe still get’s hit with security advisories quite often, or at least last I checked their was one forcing another upgrade). But without PHP 5.1+, opcode caching, and a super light-weight db layer to work with, it is almost impossible to achieve the kind of performance MODx does now with such a DB layer in place. PDO and SDO offer some great potential in this area for PHP 5.1+, but MODx is a PHP 4/5 application and will probably remain so until PHP 5 hosting is the industry standard.
Honestly after looking at all of the available options, including ADOdb, EZPDO, and many others, I truly think that MODx should take a factory pattern approach to persistence, simply implementing the code optimized for each target db separately, and having the MODx controller use the appropriate implementation based on the db configuration chosen. This will keep the core extremely lean and avoid the performance issues associated with every useful DB layer out there except PDO, though it will mean maintenance of the CRUD code for each db, though in most cases, I think such adjustments would be almost trivial in nature. It would also make it easy for developers to add their own optimized DB implementations for their needs, or override default persistence behavior easily.
BTW, we have a PHP 5-based project getting underway based on the prototype I built with Propel/Creole, though I will most likely be making use of PDO/SDO instead of Creole as we progress with that project. The ultimate goal of hiding all SQL from the developer, and making complete site definitions portable from one db platform to another, even when working with user-defined data structures/classes, it what I’m shooting for.