Search

Hi,

I'm currently looking into creating support for multiple database providers, for those who wish to use oracle, mssql or sqlite. I know this has been tried before (I've been searching the forum), but it remains a bit of an obscure theme. However, I believe support for multiple database providers is very valuable and can be achieved with some small adjustments.

Implementation plan

My approach is to create a class.dbprovider.php abstract class in toolkit and a subfolder called data-providers in which the class.mysql.php and other providers can be placed.

The abstract class will contain functions like install() and about() (similar to extensions) which will be called by the installer script to fill a select box and show the appropriate fields.

SQL Dialect

The SQL dialect will remain MySQL, both for Symphony core as extensions, so when developing a provider, one must translate the SQL statements using regular expressions.

Installer

As said above, the installer will need some love to support this. The first iteration will limit to searching the folder for available providers. Users will need to pre-install the provider before they will continue with their Symphony installation (if they wish to use a different database provider). MySQL will of course always be available.

The second iteration of installer love will entail adding the ability for users to download the provider from the installer script. Don't know how this will be done yet, but it is definitely a nice feature.

For those interested in following my effort on GitHub:

https://github.com/remie/symphony-2/tree/db-providers https://github.com/remie/SQLiteProvider

Interesting!

Your post reminded me that I wanted to start a discussion on Neo4j - perhaps not directly related, but relevant?

Well... I'm not familiar with Neo4j, but I quess with a generic approach on database providers, one should theoretically be able to create a provider for this type of database. As long as you are able to translate the current MySQL implementation to Neo4j format :)

My goal is not to switch the default database engine or current structure. It is only meant to provide a hook for developers to be able to switch database engines. This is currently hard to achieve because the MySQL implementation is hardcoded and expected in some key parts of Symphony (like the installer).

If a developer is able to create a provider that translates the current relational input / output to an object or map type of database engine, than that would be supported by my generic database provider implementation. There is just one restriction: the provider should return the same output as the MySQL provider, because that is what Symphony currently expects.

I don't know if this answers your question... :)

I'm not even sure what my question was, but you've given me something to think about. :-)

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details