Generic database providers implementation
This is an open discussion with 3 replies, filed under General.
Search
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.
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 calleddata-providers
in which theclass.mysql.php
and other providers can be placed.The abstract class will contain functions like
install()
andabout()
(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