Note:

If you want to create a new page for developers, you should create it on the Moodle Developer Resource site.

DB layer 2.0: Difference between revisions

From MoodleDocs
mNo edit summary
 
(11 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{Work in progress}}
{{Template:Development:dmllib 2.0}}{{Moodle_2.0}}__NOTOC__
{{Template:Development:dmllib 2.0}}
__NOTOC__
== Objectives ==
== Objectives ==


Line 23: Line 21:
* Well documented (PHPDocs + use examples)
* Well documented (PHPDocs + use examples)
* Tasks, bugs and progress tracked in MDL-14679
* Tasks, bugs and progress tracked in MDL-14679
* Due date: June 24th
* Due date: June 24th 2008


== Milestones ==
== See also ==


=== M1: initial commit (due date: May 15th) - HEAD ===
* [[XMLDB Documentation|XMLDB Documentation]]: where both xmldb and ddl stuff is explained.
What is done:
* [[DDL functions|DDL functions]] - Documentation for all the Data Definition Language (DDL) functions available inside Moodle.
:1. API should be stable, tested during conversion of several parts or moodle
* [[DML functions|DML functions]] - Documentation for all the Data Manipulation Language (DML) functions available inside Moodle.
:2. $db-> references are gone
:3. direct adodb function calls should be all gone (except auth and enrol)
:4. some functions from dmllib are deprecated/removed
:5. old ddllib function are not used at all now
:6. XMLDB editor should fully work now
:7. BC compatible 100$
 
 
=== M2: 4 DBs passing all tests (due date: May 27th) - HEAD ===
 
:1. mssql and ora related work
:2. use of adodb in enrol and auth plugins
:3. functional unit tests (own-db and multi-db)
:4. logging/profiling/exceptions
:5. xmldb public API refactoring
:6. install
:7. BC compatible 100$
:8. In general everything titled as [http://tracker.moodle.org/browse/MDL-14679 "M2" in the Bug Tracker*.
 
 
=== M3: core stuff, pre magic_quotes off tasks (due date: June 24th) - HEAD ===
 
:1. Needs to be detailed in [[dmllib 2.0 migration docs|dmllib 2.0 migration docs]].
:2. Tasks between May28th and June 11th
:3. API should be available in the [http://phpdocs.moodle.org phpdocs site]
:4. BC compatible 100$
:5. In general everything titled as [http://tracker.moodle.org/browse/MDL-14679 "M3" in the Bug Tracker].
 
 
=== M4: big hacking, post magic_quotes off tasks (due date: June 24th) - In parallel with M3 - (HEAD, BRANCH, PATCH??) ===
 
:1. BREAKAGE with old code.
:2. Documentation finished (Docs (examples, architecture, migration guide...), PHP Docs).
:3. In general everything titled as [http://tracker.moodle.org/browse/MDL-14679 "M4" in the Bug Tracker].
 
=== M5: Moodle tests using real & mockup dmllib (starting on May 27th...) - In parallel and after M3 and M4 - HEAD ===
 
:1. Needs good documentation for developers
:2. Will be huge but useful
:3. Always try to be able to run tests from cli script (apart from UI) to be able to execute them daily and report status in some URL (html output).
 
 
== Meetings ==
 
* [http://docs.google.com/Doc?id=dgzf39jp_1gkks3pd3 MDM-20080501 Dmllib 2.0] - Penny, Petr and Eloy.
* [http://docs.google.com/Doc?id=dgzf39jp_5fv3j3jd7 MDM-20080508 Dmllib 2.0] - Penny, Petr, Nicolas and Eloy.
* [http://docs.google.com/Doc?id=dgzf39jp_7tmcr5jc5 MDM-20080513 Dmllib 2.0] - Penny, Petr, Nicolas and Eloy.
* [http://docs.google.com/Doc?id=dgzf39jp_11fdj3jhg8 MDM-20080515 Dmllib 2.0] - Penny, Petr, Nicolas, Martin and Eloy.
* [http://docs.google.com/Doc?id=dgzf39jp_12hmwjmzfq MDM-20080522 Dmllib 2.0] - Penny, Petr, Nicolas, Martin and Eloy.
* MDM-20080526 Dmllib 2.0 - Penny, Petr, Nicolas, Martin and Eloy.
 
== Ideas ==
 
* [http://en.wikipedia.org/wiki/Object-relational_mapping Object Relational Mapping style]
* There are already some PHP ORM tools:
** [http://www.phpdoctrine.org/ Doctrine]
** [http://www.phpobjectgenerator.com/ PHP Object Generator]
** [http://propel.phpdb.org/trac/ Propel]

Latest revision as of 23:32, 25 July 2008

Moodle 2.0


Objectives

  • Switch to prepared statements - using placeholders and preparing statements protects against sql injection
  • Remove the need for data to be add/strip slashed all over the place in the code.
  • Enable easier and productive unit tests.

Requirements

  • 100% cross-db
  • OOP implementation:
    • Full abstraction: Hide underlying libraries (adodb, pdo...) and drivers to Moodle developers completely.
    • Make it so that the database object can be subclassed - this means for unit tests that want to test database access, the test framework can override necessary methods
    • support ? and :param parameter types (independently of the param types supported by each driver).
    • global $DB
    • profiling, logging and exceptions
  • Easy to use (consistent and similar to current dmllib 1.0)
  • Easy to migrate (provide documentation and utilities to help on that)
  • Complete unit testing (self)
  • Easy unit testing (moodle - real and mockup)
  • Well documented (PHPDocs + use examples)
  • Tasks, bugs and progress tracked in MDL-14679
  • Due date: June 24th 2008

See also

  • XMLDB Documentation: where both xmldb and ddl stuff is explained.
  • DDL functions - Documentation for all the Data Definition Language (DDL) functions available inside Moodle.
  • DML functions - Documentation for all the Data Manipulation Language (DML) functions available inside Moodle.