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
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.
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.
That hidden inner part of me that irrationally prefers Pear to Adodb applauds you.
I have the same irrational thoughts. Of course, in the last ten minutes I have found a couple of bugs - new version coming soon I hope!
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?
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?
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.
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.
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)
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)
Do they have good solutions yet for table creation/maintenance? Last I looked (while back) they hadn't yet.
Yeh - MDB2 (despite my earlier comments at a reasonably stable Beta stage it seems) has this stuff...
http://oss.backendmedia.com/index.php?area=MDB2&page=DocumenTation
I can't say I've had a chance to try it yet. The bang on about it being very fast too.