Quote from: OpenGeek at Oct 27, 2009, 02:05 PM
XPDO is realy great for bigger projects, I think, but IMO the old db-api-functions are easier to understand and to use for fast&easy database-manipulations and non-hardcore-coders.
Please do not remove them on future releases of revolution!!
Sorry, but they are definitely going away, and tbh using PDO is just as easy or easier than learning different database extensions like mysql_ or pgsql_. The whole point of Revolution is to make MODx database agnostic and allowing users to write SQL in API functions without some kind of abstraction layer for database-specific code is not going to work. I want to discourage the use of SQL in component code at all. The only place it should appear are in the database-specific table classes you generate for a table with xPDO.
This is an important point - as we progress to 2.1 and beyond, the code will (and should) become increasingly abstracted to allow for Revolution installs on mssql, pgsql, and other database extensions. There is a huge userbase of users that cannot use MODx currently because of the MySQL limitation. We will be pushing for abstraction; that, tbh, is not for debate. 3PC developers will be strongly encouraged to use the abstracted xPDO layer to take full advantage of this. Those that don’t - well, don’t expect people to use your components when they’re not compatible with their system.
That said, for simple client projects, it is *strongly* advantageous for you to learn basic PDO syntax. (note that jason showed you simple, non-schema/classes queries.) A few reasons why:
- Security layer - PDO implements better security against sql injection
- Easier to read - it’s much easier than parsing massive DB queries that have to use a bunch of old functions to extrapolate the data.
- Upgradability - simply put, you’re going to see PDO become more and more of the PHP DB market, and low-level mysql_connect and such become less and less.
We will be removing the DBAPI in 2.1. That, unfortunately for some, is a reality. If you want to keep using DBAPI (which to be honest, I find much more complex than xPDO), you can stick with Evolution. However, you’re going to be missing the vast feature-rich possibilities of Revolution in doing so.
On a side note, I think it’s important to note that PHP development in general is becoming more abstract; simple scripts are losing ground to more robust, OOP-like APIs and systems. A lot of people aren’t going to like this progression - but such, in essence, is technological progress. Change, whether we like it or not, is an inevitability for the web industry. My experience has shown me that in this industry, either you change with the industry - or go broke trying not to.