At a glance

Some updates on recent MDB2 developement: FOREIGN KEY support in the Manager and Reverse modules, etc. Also: updated SQL technical articles on INFORMATION_SCHEMA for Firebird, PostgreSQL, SQL Server and Oracle.

print this page Print     permalink Permalink

Latest articles

PEAR MDB2 updates (FOREIGN KEY support!)

I recently committed to CVS some changes to add full FOREIGN KEY constraints support to PEAR::MDB2, both in the Manager (createConstraint()) and in the Reverse module (getTableConstraintDefinition()). The constraint definition is translated to this array structure (some key names could change slightly before an official release, so they are in sync with MDB2_Schema):

array (
    [primary] => true|false
    [unique]  => true|false
    [foreign] => true|false
    [check]   => true|false
    [fields] => array (
        [field1name] => array() // one entry per each field covered by the constraint
        [field2name] => array()
        [field3name] => array(
            [sorting] => ascending|descending
        )
    )
    [references] => array(
        [table] => name
        [fields] => array(
            [field1name] => position //one entry for each referenced field
            [field2name] => position
            [field3name] => position
        )
    [deferrable] => true|false
    [initially_deferred] => true|false
    [on_update] => CASCADE|RESTRICT|SET NULL|SET DEFAULT|NO ACTION
    [on_delete] => CASCADE|RESTRICT|SET NULL|SET DEFAULT|NO ACTION
    [match] => SIMPLE|PARTIAL|FULL
);

The next step will be adding CHECK constraint support. If you feel brave enough, please fetch the CVS version of MDB2 and give it a go. And of course send me some feedback ;-)

Updated INFORMATION_SCHEMA tutorials

On a side note, I've updated my tutorials on INFORMATION_SCHEMA and system tables for Firebird/Interbase, PostgreSQL and SQL Server, and added one for Oracle:



Enjoy!

Bookmark and Share

Leave a reply

(it will NOT be published)
No HTML tags. All comments need to be approved before they appear on the site - this is not to weed out critical comments, but just spam.