datalib.php is dead. Long live the new libs

datalib.php is dead. Long live the new libs

by Eloy Lafuente (stronk7) -
Number of replies: 8
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Testers
Hi moodlers,

since some minutes ago lib/datalib.php has changed dramatically. surprise

It has been divided in three parts:

* lib/dmllib.php: Where all the select/insert/update... functions will reside (DML functions).
* lib/ddllib.php: Where all the table/field/index creation/drop... functions will reside (DDL functions).
* lib/ddllib.php: Where all the functions not being DML/DDL will remain until they were moved to other libraries/stuff (legacy library).

This radical change is part of the XML database schema thing, coming for Moodle 1.7.

In a few days, some changes will be performed to both the DDL and DML libraries in order to be able to work against some more RDBMS (MSSQL and Oracle are our goals for 1.7. - apart from MySQL and PostgreSQL, of course wink ).

You can find more information about the whole thing and all its implications in the above link. At the time of writing this, both points 1 &3 in the Roadmap have been completed and our next objectives are points 4 and 5 in that document.

With them finished, both installation and upgrade of Moodle will be DB-cross-compatible and we'll be able to run against/under big grin the new RDBMS and focus all our efforts on point 2 (all the DML modifications needed to be performed in a lot of scripts to work properly against any DB).

I would recommend you to learn a bit more about the XMLDB thing because, in one week from now, if nothing serious prevents/delays it, the install/upgrade process will be replaced (more or less, think about it as one transition) by the new one that will use, exclusively XMLDB stuff (exactly now we are in the process of detect all the DDL functions we need to create in order to support any DDL operation against each RDBMS).

Any idea/comment/suggestion/discussion will be welcome. Also, any fix/completion/improvement of the Docs would be, for sure, great.

Happy weekend moodlers, we are going to have some really intense weeks from now until 1.7 release. Amazing!

Ciao smile
Average of ratings: -
In reply to Eloy Lafuente (stronk7)

Re: datalib.php is dead. Long live the new libs

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
Great stuff, Eloy. Yes, this is a historical step code-wise.
In reply to Eloy Lafuente (stronk7)

Re: datalib.php is dead. Long live the new libs

by Carlos Mação -

In a few days, some changes will be performed to both the DDL and DML libraries in order to be able to work against some more RDBMS (MSSQL and Oracle are our goals for 1.7. - apart from MySQL and PostgreSQL, of course piscar ).

What about Firebird ?

In reply to Carlos Mação

Re: datalib.php is dead. Long live the new libs

by Eloy Lafuente (stronk7) -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Testers
Yep, and Sybase, Informix, DB2, Derby, FileMaker .... but not for 1.7.

Once MySQL, PostrgeSQL, MSSQL and Oracle are working properly under the XMLDB schema, we'll be able to expand to the rest. Nothing forbids that.

But, knowing the time spent these past months to analyse, compare and design one model able to represent Moodle's DB schema, and viewing the important differences that each vendor includes in their products, it would be a nightmare to add more DBs now.

Ciao smile
In reply to Eloy Lafuente (stronk7)

Re: datalib.php is dead. Long live the new libs

by roman d -
Dear Developer's Team!
Your work is Great!!!!
How about oracle in Moodle 1.7, it will be in August-September?
Thanks!!!!
In reply to Eloy Lafuente (stronk7)

Re: datalib.php is dead. Long live the new libs

by Jun Yamog -
Great work Eloy, looking forward to test your new stuff soon.
In reply to Eloy Lafuente (stronk7)

Re: datalib.php is dead. Long live the new libs

by Jun Yamog -
Hi Eloy,

I noticed that you are experimenting on fields being nullable.  Yehey!
In reply to Jun Yamog

Re: datalib.php is dead. Long live the new libs

by Eloy Lafuente (stronk7) -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Testers
Yep,

with MySQL 5 not allowing default clauses on TEXT columns and Oracle not supporting NOT NULL DEFAULT '' clauses, I've started to play with some well-known fields (TEXT only, for now) to see what could be wrong.

All this is a bit more explained here:

http://docs.moodle.org/en/XMLDB_Problems#NOT_NULL_fields_using_a_DEFAULT_.27.27_clause

I hope that with this "TEXT experience" we'll be able to detect any possible drawback before starting the move of CHAR fields after 1.7. Note that these are CURRENT plans and everything is subject to change.

Ciao smile