DBIx::DBSchema::DBD - DBIx::DBSchema Driver Writer's Guide and Base Class |
DBIx::DBSchema::DBD - DBIx::DBSchema Driver Writer's Guide and Base Class
perldoc DBIx::DBSchema::DBD
package DBIx::DBSchema::DBD::FooBase use DBIx::DBSchema::DBD; @ISA = qw(DBIx::DBSchema::DBD);
Drivers should be named DBIx::DBSchema::DBD::DatabaseName, where DatabaseName is the same as the DBD:: driver for this database. Drivers should implement the following class methods:
Given an active DBI database handle, return a hashref of unique indices. The keys of the hashref are index names, and the values are arrayrefs which point a list of column names for each. See HASHES OF LISTS in the perldsc manpage and the DBIx::DBSchema::Index manpage.
Given an active DBI database handle, return a hashref of (non-unique) indices. The keys of the hashref are index names, and the values are arrayrefs which point a list of column names for each. See HASHES OF LISTS in the perldsc manpage and the DBIx::DBSchema::Index manpage.
(See the FS::DBIx::DBSchema::Index manpage)
New drivers are advised to implement this method, and existing drivers are advised to (eventually) provide this method instead of index and unique.
For backwards-compatibility with current drivers, the base DBIx::DBSchema::DBD class provides an indices method which uses the old index and unique methods to provide this data.
Should return a hash reference, empty for no action, or with one or more of the following keys defined:
effective_type - Optional type override used during column creation.
explicit_null - Set true to have the column definition declare NULL columns explicitly
effective_default - Optional default override used during column creation.
effective_local - Optional local override used during column creation.
Should return a hash reference, empty for no action, or with one or more of the following keys defined:
effective_type - Optional type override used during column creation.
effective_null - Optional nullability override used during column creation.
sql_after - Array reference of SQL statements to be executed after the column is added.
Should return a hash reference, empty for no action, or with one or more of the following keys defined:
sql_alter_null - Alter SQL statment for changing nullability to be used instead of the default
You can define a %typemap array for your driver to map ``standard'' data types to database-specific types. For example, the MySQL TIMESTAMP field has non-standard auto-updating semantics; the MySQL DATETIME type is what other databases and the ODBC standard call TIMESTAMP, so one of the entries in the MySQL %typemap is:
'TIMESTAMP' => 'DATETIME',
Another example is the Pg %typemap which maps the standard types BLOB and LONG VARBINARY to the Pg-specific BYTEA:
'BLOB' => 'BYTEA', 'LONG VARBINARY' => 'BYTEA',
Make sure you use all uppercase-keys.
Ivan Kohler <ivan-dbix-dbschema@420.am>
Copyright (c) 2000-2005 Ivan Kohler Copyright (c) 2007 Freeside Internet Services, Inc. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
the DBIx::DBSchema manpage, the DBIx::DBSchema::DBD::mysql manpage, the DBIx::DBSchema::DBD::Pg manpage, the DBIx::DBSchema::Index manpage, the DBI manpage, the DBI::DBD manpage, the perllol manpage, HASHES OF LISTS in the perldsc manpage
DBIx::DBSchema::DBD - DBIx::DBSchema Driver Writer's Guide and Base Class |