forum.coppermine-gallery.net

Support => cpg1.5.x Support => cpg1.5 bridging => Topic started by: Dion on February 21, 2014, 09:22:19 pm

Title: A new DBAL-based bridge core, and supporting phpBB3 driver
Post by: Dion on February 21, 2014, 09:22:19 pm
One issue I've had with Coppermine, for myself as well as with clients, is that it doesn't support bridging to applications that use non-MySQL databases. The issue is that the bridge core is hard-coded to MySQL.

So one day I sat down and modified the udb_base.inc.php bridge core to create a database abstraction layer (DBAL), and then completely rewrote the phpbb3.inc.php phpBB3 bridge driver to utilize the DBAL in the new bridge core. It works great, and I wanted to share it with the folks here. While I had no interest in writing additional bridge drivers, they should be easy to write.

Here is where you can find the new files: http://forum.dion-designs.com/t9012/improved-copperminephpbb3-bridge/

I thought about attaching the ZIP file here, but since the instructions in the above topic are also required, I felt it was better to link to the topic.

Please let me know what you think.
Title: Re: A new DBAL-based bridge core, and supporting phpBB3 driver
Post by: gmc on February 21, 2014, 09:56:56 pm
Dion,
Thank you for the documentation and sharing your code!

A Database Abstraction Layer has definitely been a topic of discussion - we certainly know we need to replace the direct mysql calls due to deprecation... The direction for the abstraction hasn't been determined yet as several options are being explored...

I've downloaded your code and will take a closer look at what you did. (haven't had a chance to do more than read the post and linked page...)

I've already documented several 'missing' functions for the dev teamincluding 'free result' to be covered as well as we go through the process as I found those in writing some plugin code.

Greg
Title: Re: A new DBAL-based bridge core, and supporting phpBB3 driver
Post by: phill104 on February 21, 2014, 10:54:32 pm
Dion,

Absolutely fantastic work. As Greg says, a DBAL is something that we have wanted to add to CPG for a very long time. Keep it coming, we would love to know your thoughts on adding an abstraction layer to the core for CPG1.6.
Title: Re: A new DBAL-based bridge core, and supporting phpBB3 driver
Post by: Dion on February 22, 2014, 09:30:09 pm
I didn't mention it in my original post, but if you want to use my revised bridge code in CPG, feel free to do so. You have my permission to remove my copyright blocks in the two files.

I think adding a DBAL would be a great idea. Creating it will be easy; a $CONFIG['dbal'] line in config.inc.php specifying a DBAL (mysqli/pgsql/mssql/etc) driver, and each driver having its own set of cpg_db_xxx() functions. Most of the required functions have already been written; I added the missing "simple" functions in my bridge DBAL, but a few more will be needed for manipulating tables (creating/truncating/dropping/altering).

The biggest issue will be replacing the large number of hard-coded mysql calls in the current code with DBAL-based calls.

I'm curious about something...what is this? http://sourceforge.net/p/coppermine/code/HEAD/tree/trunk/cpgdbal/include/cpgdb/
Title: Re: A new DBAL-based bridge core, and supporting phpBB3 driver
Post by: Αndré on March 14, 2014, 03:29:02 pm
what is this? http://sourceforge.net/p/coppermine/code/HEAD/tree/trunk/cpgdbal/include/cpgdb/

That was an attempt (or proof of concept) of a DBAL for Coppermine. As far as I know Abbas created it and it also seemed to work as expected. I don't know why it was abandoned, that was before I joined the dev team.