ADODB Legacy compatibility

Permalink 2 users found helpful
Andrew said in the recent 5.7 video that he wrote a compatibility layer so that Doctrine DBAL would work with the ADODB function calls. I looked through the 5.7-wip code (in the new git repo) but I cannot find this code at all.

I've been working with the Doctrine DBAL on another project recently so I know that there are some differences between it and ADODB. Specifically, I use the following handy functions all over the place and would love it if they kept working in 5.7 without modification:

ADODB::GetArray() -> Doctrine:: fetchAll()

ADODB::GetRow() -> Doctrine::fetchAssoc()

ADODB::GetCol() -> does not have an equivelant in Doctrine (so there should be a function that calls fetchAll and extracts just the first column from all results and returns them in a numeric array)

ADODB::GetOne() -> Doctrine::fetchColumn()

ADODB::AutoExecute() -> Doctrine::insert() OR Doctrine::update() (the function will need to determine which to use based on passed-in args)

If these are already implemented, where are they in the codebase? If not, I'd be happy to implement them -- just need a pointer to where they should go.

Thanks,
Jordan

jordanlev
 
Shotster replied on at Permalink Reply
Shotster
> Andrew said in the recent 5.7 video that he wrote a compatibility
> layer so that Doctrine DBAL would work with the ADODB function
> calls. I looked through the 5.7-wip code (in the new git repo) but
> I cannot find this code at all.

I think it's in:

concrete/core/Database/Connection.php

-Steve
jordanlev replied on at Permalink Reply
jordanlev
Brilliant -- thanks!

Looks like it's all there except for AutoExecute... I'll submit a pull request for that now.

-Jordan
jordanlev replied on at Permalink Reply
jordanlev
...or not... looks like Doctrine handles the WHERE clause of an UPDATE differently from ADODB (ADODB has you pass in a sql string, but Doctrine uses a field=>value array). So I guess this is one thing that will need to be manually updated in peoples code (although it should be fairly straightforward to do so).

Is there some place that serves as a master list of required code changes that I could add this to?
Shotster replied on at Permalink Reply
Shotster
> Is there some place that serves as a master list of required code
> changes that I could add this to?

Maybe on the Github Wiki as per Andrew's reply here...

http://www.concrete5.org/developers/pro-accounts/community-leaders-...

-Steve
jordanlev replied on at Permalink Reply
jordanlev
Okay, I've created a new "Migration Guide" wiki page:
https://github.com/concrete5/concrete5-5.7.0/wiki/Migration-Guide...

I've incorporated all of the things Andrew mentioned in his recent blog posts, plus the ADODB thing.

Hopefully everyone can keep that up-to-date as they discover new things.