Note: You are currently viewing documentation for Moodle 3.8. Up-to-date documentation for the latest stable version of Moodle may be available here: DB layer 2.0.

Development:DB layer 2.0: Difference between revisions

From MoodleDocs
Line 16: Line 16:
** global $DB
** global $DB
* Easy to use
* Easy to use
* Easy to migrate (provide documentation and utilities to help on that)
* Complete unit testing (self)
* Complete unit testing (self)
* Easy unit testing (moodle)
* Easy unit testing (moodle)
* Well documented (PHPDocs + use examples)
* Tasks, bugs and progress tracked in MDL-14679
* Due date: N/D
* Due date: N/D



Revision as of 01:35, 7 May 2008

Note: This page is a work-in-progress. Feedback and suggested improvements are welcome. Please [ http://moodle.org/course/view.php?id=5 join the discussion on moodle.org] or use the page comments.



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 both ? and :param parameter types
    • global $DB
  • Easy to use
  • Easy to migrate (provide documentation and utilities to help on that)
  • Complete unit testing (self)
  • Easy unit testing (moodle)
  • Well documented (PHPDocs + use examples)
  • Tasks, bugs and progress tracked in MDL-14679
  • Due date: N/D

Meetings


Ideas