sifophp / SIFO

PHP Framework with "project inheritance", multiple DB support, balancing, Sphinx, Memcached, Redis and other stuff
Other
56 stars 21 forks source link

Migrate from ADODB to PDO #13

Open alombarte opened 12 years ago

alombarte commented 12 years ago

UPDATE: ADODB keeps alive with PHP5 support (see: http://sourceforge.net/projects/adodb/). The last update is from June 2013 and current version is 5.18. SIFO is using 5.06 right now.

ADODB is a deprecated PHP4 project that no longer makes sense to continue supporting.

Multiple driver database feature will be lost per default (Mysql, postgresql, oracle...) and we will stick to Mysql when it comes to relational databases.

A class to maintain backwards compatibility could be created, or a migration script. I don't know which of them are more painful

obokaman-com commented 12 years ago

Woooooo! proceed with caution. :-) I can't imagine somethink like a "migration script", we (and lot of SIFO-projects, I think) are using ADODB methods in all of our Models (getAll, getRow, getOne, Execute, Autoexecute, etc.) Are there specific equivalents in PDO?

alombarte commented 12 years ago

A specific class ADODB to PDO that implements all this ADODB methods (getOne, getRow) ... but using PDO would be implemented

obokaman-com commented 12 years ago

Could be a solution. This AdoDBToPDO class + a migration manual would be great. :-)

thedae commented 12 years ago

Agreed, I'll take a look at this

Can you give me a list with the most used AdoDB methods?

alombarte commented 11 years ago

Most used models in ADODB:

AutoExecute Execute GetOne GetAll GetArray GetAssoc GetCol GetRow Query Affected_Rows Insert_ID ErrorNo Query ErrorMsg

Less common, but present:

BeginTrans BindDate BindTimeStamp Close CommitTrans CompleteTrans Concat Connect DBDate DBTimeStamp Disconnect escape FailTrans GenID GetInsertSQL GetUpdateSQL HasFailedTrans IgnoreErrors nextId q QMagic qstr Quote Replace RollbackLock RollbackTrans SetTransactionMode StartTrans Time UnixDate UnixTimeStamp

There are more methods, but I don't think they are used at all (like sequences for mysql).

Do not forget that there are many methods of Model, not related to adodb like

nextQueryInMaster storeInRegistry inRegistry closeConnectionDatabase

alombarte commented 11 years ago

To consider: http://sourceforge.net/projects/adodb/files/adodb-php5-only/adodb-518-for-php5/

alombarte commented 11 years ago

I did a first test replacing current version by 5.18 and it seems to work. The only thing to be fixed is the following notice, generated by the debug:

Notice: Undefined property: ADODB_mysql::$_querySQL in /var/www/wc/alo/libs/Sifo/Database.php on line 320

This is the internal variable that stores current SQL query. Fixing that I think we can migrate it and test in devel.