Lukas Kahwe Smith wrote:
B. Johannessen wrote:
Praneet Kandula wrote:
On 10/15/05, Lukas Kahwe Smith smith@pooteeweet.org wrote:
I just made the backend selectable and integrated the MDB2 backend ..
For this I moved the inclusion of the rcube_db.inc frm the index.php file into main.inc. I also added a new config option 'db_backend' to db.inc.php.
Wow, thanks a lot for this, Lukas. For those that don't know, Lukas Smith is a key member of the PEAR group, and the lead developer of MDB2, which is supposed to be the replacement for PEAR::DB. I hope we accept this patch in!
Actually I stepped down from the PEAR Group a while back. But I am still quite active in the PEAR project.
FYI: Lukas isn't on the list yet, so for now please keep him in the To:/Cc: on any replies concerning MDB2.
One more thing on the DB/MDB2 integration .. you can actually easily make your application self installing. You would simply need to add to the code to expect the relevant error code and you could then execute the installation of the tables (and in theory even database) on the fly.
Have a look at the MDB2 implementation of the nextID() method in the mysql driver: http://cvs.php.net/co.php/pear/MDB2/MDB2/Driver/mysql.php#625
With the following code you silence the global error handling for the given error code: $this->expectError(MDB2_ERROR_NOSUCHTABLE);
This however only works if you extend from the PEAR class. But there is also a static equivalent method, more details can be found here: http://phpmag.net/itr/online_artikel/psecom,id,330,nodeid,114.html
The important bit is simply that there is an error code you can then check for and then issue the necessary SQL commands. Either from a file or using the MDB2 manager API.
regards, Lukas