Moodle with Pear DB

Moodle with Pear DB

de Howard Miller -
Número de respuestas: 8
Imagen de Core developers Imagen de Documentation writers Imagen de Particularly helpful Moodlers Imagen de Peer reviewers Imagen de Plugin developers
If anybody is interested, I have written a library class that lets Moodle run with the Pear 'DB' database abstraction class rather than adodb.

It's simply a matter of having the class in the lib directory and loading it in place of the adodb class in lib/setup.php. That's it, there are no other changes to any other Moodle files. I have it set up on my test machine using a $CFG variable and a check for either library in setup.php.

The main restrictions at the moment is that it has only been tested with mysql and it is not compatible (weirdly) with caching, so that has to be turned off in the admin=>filters screen (some very strange things happen with it on). I'm working on that one.

I can submit it to CVS or just post it here if there is interest. I would consider it experimental at the moment sonrisa
Promedio de valoraciones: -
En respuesta a Howard Miller

Re: Moodle with Pear DB

de Howard Miller -
Imagen de Core developers Imagen de Documentation writers Imagen de Particularly helpful Moodlers Imagen de Peer reviewers Imagen de Plugin developers
In fact here it is attached.

Instructions:
* turn off cacheing in admin=>filters (even if you don't use filters)
* put the file peardb_adodb.php in your lib directory
* In lib/setup.php at or about line 85 comment out the include_once for adodb and replace it with a similar line that points to peardb_adodb.php

That's all you need. You are now using Pear's 'DB' database abstraction library instead of adodb. Please note that this has 'only' been tested with mysql on Linux using 1.5dev. If you loose all your data don't blame me, but I'm reasonably confident that it works.
En respuesta a Howard Miller

Re: Moodle with Pear DB

de Ziba Scott -
That hidden inner part of me that irrationally prefers Pear to Adodb applauds you.
En respuesta a Howard Miller

Re: Moodle with Pear DB

de Martín Langhoff -
Howard -- this is *really* interesting. I'm full of questions...

What are the (rational) drivers? Does PEAR DB have better DB abstraction? Is it demonstrably faster (have you got benchmarks)? Is it more compatible with weird databases?

En respuesta a Martín Langhoff

Re: Moodle with Pear DB

de Howard Miller -
Imagen de Core developers Imagen de Documentation writers Imagen de Particularly helpful Moodlers Imagen de Peer reviewers Imagen de Plugin developers
Hi Martin,

I'm not sure it's anything too exciting. It just uses the native PHP drivers. Although PEAR has it's ups and downs I have generally been impressed with the work of this project. They seem committed to producing high quality products.

I have always liked it better because the interface seems much more intuitive than adodb and it has (relatively) decent documentation.

To complicate matters DB is, strictly speaking, deprecated and replaced by MDB (there is MDB2 at alpha stage as well). However not many standard installs seem to have it. MDB, allegedly, was/is heavily profiled for best performance.

The supported databases should be the usual suspects (from my install):
fbsql, ifx, mssql, oci8, pgsql, storage, dbase, ibase, msql, mysql, odbc, sqlite, sybase
(of course, assumes your system has the relevant drivers compiled in)

I haven't done an A/B comparison with adodb (yet). It will be interesting to try.
En respuesta a Howard Miller

Re: Moodle with Pear DB

de Howard Miller -
Imagen de Core developers Imagen de Documentation writers Imagen de Particularly helpful Moodlers Imagen de Peer reviewers Imagen de Plugin developers
Here's another version (attached) with the last lot of bugs fixed. In particular, cacheing now works fine - you don't have to switch it off. Unless anybody objects, I might submit this into CVS as it might come in useful and only requires a trivial change to setup.php.

One thing I forgot to mention, was that you need to make sure that DB.php is on your path, so installations do this - others don't, regardless of the PEAR files being installed. On my SuSE 9.1 system I had to edit php.ini thus

include_path = .:/usr/share/php

(/usr/share/php being where the PEAR stuff lives)
En respuesta a Howard Miller

Re: Moodle with Pear DB

de Martin Dougiamas -
Imagen de Core developers Imagen de Documentation writers Imagen de Moodle HQ Imagen de Particularly helpful Moodlers Imagen de Plugin developers Imagen de Testers
Do they have good solutions yet for table creation/maintenance?   Last I looked (while back) they hadn't yet.