Well, upgrading ADOdb's support for DB2 from C to A (whatever that means
) is a valuable contribution to the world of open source, irrespective of any thing else, so don't let us put you off doing that.
I don't thing we would take DB2 support into the official release of Moodle 1.9 unless there was also a working version of 2.0. Otherwise people who installed 1.9 on DB2 would be screwed when they wanted to upgrade.
However, a patch that people could apply if they really wanted 1.9 on DB2, added to the Modules and Plugins database, would be worth something.
I guess that adding support for a new database really comprises the following tasks (I will discuss 1.9/2.0 differences in each one):
1. Make the install process support the new database type.
This is basically a matter of creating a new generator class in
http://cvs.moodle.org/moodle/lib/ddl/. The only differences between 1.9 and 2.0 is that some related classes were renamed to better match the Moodle coding guidelines, so XmldbTable -> xmldb_table. So work done for 1.9 should be easy to carry over to 2.0.
2. Make the database abstraction layer (dmllib) support the new database type.
In 1.9 this means making sure ADOdb supports the new DB type well enough, and probably changing where the DB connection is initialised to accept 'db2' as a valid option.
In 2.0 this means writing new subclasses db2_moodle_native_database.php and db2_moodle_native_recordset.php in
http://cvs.moodle.org/moodle/lib/dml/. Note that Moodle 2.0 now has an extensive set of unit tests to support writing a new database-specific subclass of moodle_database, so it should be easy to know when you are done with this.
While there are still classes like postgres7_adodb_moodle_database.php in that folder, they are scheduled for removal. (We may keep ADOdb around, but only for things like the database enrolment plugin that needs to connect to other systems to synchronise other data with Moodle.) Basically, Eloy got bored of finding and fixing bugs in ADOdb, and also are new native classes are a small but significant bit faster that using ADOdb.
Actually, the more important reason was that ADOdb did not let us implement temporary tables, or session locking for database sessions. So adodb_moodle_database.php and its subclasses probably do not pass all the unit tests, will not be maintained, indeed will probably be deleted soon, and so are not something to build on.
So, in this area there is little commonality between 1.9 and 2.0, but the extra work to support 2.0 is easy to quantify (implement db2_moodle_native_database.php to pass all tests).
3. Review and test all SQL throughout Moodle and ensure that it works on DB2.
This is probably the biggest amount of work. As you can tell from the fact that Moodle has supported
MSSQL and Oracle since Moodle 1.7, but we are still finding SQL in obscure corners of Moodle that breaks on one or the other and needs to be fixed.
The one thing you can say for certain about the SQL standard is that all databases implement it differently.
And as the MSSQL experience shows, it is impossible to test all of Moodle, I guess you need to aim at a core subset (admin, course, user, mod/forum, ...). Since Moodle already works on four databases, and we already have a lot of sql_... functions to encapsulate the differences we have found so far, one would hope that once you have extended the sql_... functions to support DB2, then most things will work. However, if DB2 has different foibles, and needs new sql_... functions, introducing them everywhere necessary will be a lot of work.
One example is the AS keyword. The rules on
Development:Database are the only ones that work on all 4 of our currently supported databases.
Anyway, work in this area done in 1.9 can (and should) be merged to 2.0, but this will never be a straight merge because the database API has changed in a way that breaks automatic merges (for good reason but very annoying!) Fortunately, it is easy to merge by hand.
Phew! that was long. I hope it makes sense.