| Title | Foreign Keys: another improvement to PEAR::MDB2_Schema |
|---|---|
| Student | Igor Feghali |
| Mentor | Helgi Þormar Þorbjörnsson |
| Abstract | |
|
PEAR::MDB2_Schema enables users to maintain RDBMS independant schema files
in XML that can be used to create, alter and drop database entities (also called as DDL: Data Definition Language). Reverse engineering database schemas from existing databases is also supported. MDB2_Schema version 0.7.0, which was supported by a Google SoC 2006 project, introduced a new XML syntax to handle data manipulation. The ability to insert data into a database was improved, plus it is now possible to update and delete records (also called as DML: Data Manipulation Language). It is now time to take MDB2_Schema one step higher: Foreign Keys support, which has been a feature frequently requested by PEAR users. The required XML additions has already been defined in conjunction with David Morse, a PEAR::DB_Table developer. The main goal is to keep compatibility between both classes. Methods to read and write MDB2 XML files with the XML syntax for foreign keys described below were recently added to the PEAR::DB_Table package. XML definition: <foreign> <name>constraint_name</name>? <field>field_name</field>+ <references> <table>referenced_table_name</table> <field>referenced_field_id</field>* </references> <match>full|partial|simple</match>? <ondelete>cascade|setnull|setdefault|restrict|noaction</ondelete>? <onupdate>cascade|setnull|setdefault|restrict|noaction</onupdate>? </foreign> Where the symbols denote: ? : optional + : at least one instance * : zero or more instances The referenced key is optional. If it is absent, it is assumed that the referenced key is the primary key of referenced table. The number and types of fields in the referenced key must match those of the foreign key. Before the FK implementation however, I would like to get MDB2_Schema ready to be released as a stable package. Some test units are lacking (comparedefinitions(), initializetable() and parsed definitions) and there is no end user documentation yet, that is, documentation on how to use the API. MDB2 Home: http://pear.php.net/package/MDB2/ MDB2_Schema Home: http://pear.php.net/package/MDB2_Schema/ Detailed Proposal: http://www.novadevel.com/m/ifeghali/soc/2007/proposal/ Project Demonstration: http://www.novadevel.com/m/ifeghali/soc/2007/ Project Download as it was at the Deadline time: http://google-summer-of-code-2007-php.googlecode.com/files/Igor_Feghali.tar.gz |
|