DB layer 2.0: Difference between revisions
From MoodleDocs
m (Development:Datalib 2.0 moved to Development:dmllib 2.0) |
(Moved some requirements and added meetings) |
||
Line 1: | Line 1: | ||
{{Work in progress}} | |||
== Objectives == | == Objectives == | ||
* Switch to prepared statements - using placeholders and preparing statements protects against sql injection | * 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. | * Remove the need for data to be add/strip slashed all over the place in the code. | ||
* 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 | * 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 | |||
* Complete unit testing (self) | |||
* Easy unit testing (moodle) | |||
== Meetings == | |||
* [http://docs.google.com/Doc?docid=dgzf39jp_1gkks3pd3&hl=en MDM-20080501 Dmllib 2.0] - Penny, Petr and Eloy. | |||
* MDM-20080508 Dmllib 2.0 - Penny, Petr, Nicolas and Eloy. | |||
== Ideas == | == Ideas == | ||
* [http://en.wikipedia.org/wiki/Object-relational_mapping Object Relational Mapping style] | * [http://en.wikipedia.org/wiki/Object-relational_mapping Object Relational Mapping style] | ||
* There are already some PHP ORM tools: | * There are already some PHP ORM tools: |
Revision as of 01:25, 7 May 2008
Note: This page is a work-in-progress. Feedback and suggested improvements are welcome. Please 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
- Complete unit testing (self)
- Easy unit testing (moodle)
Meetings
- MDM-20080501 Dmllib 2.0 - Penny, Petr and Eloy.
- MDM-20080508 Dmllib 2.0 - Penny, Petr, Nicolas and Eloy.
Ideas
- Object Relational Mapping style
- There are already some PHP ORM tools: