|
Alzabo::RDBMSRules - Base class for Alzabo RDBMS rulesets |
Alzabo::Create::Schema object)Alzabo::Create::Index object)Alzabo::Create::Table object)Alzabo::Create::Index object)Alzabo::Schema object)Alzabo::Create::Table object)Alzabo::Create::Column object)Alzabo::Create::Column object)Alzabo::Create::Column object)Alzabo::Create::Index object)Alzabo::Create::Table object)Alzabo::Create::Column object)Alzabo::Create::ForeignKey object)Alzabo::Create::Column object)Alzabo::Create::ForeignKey object)Alzabo::Create::Column object)Alzabo::Create::Schema object)
Alzabo::RDBMSRules - Base class for Alzabo RDBMS rulesets
use Alzabo::RDBMSRules;
my $rules = Alzabo::RDBMSRules( rules => 'MySQL' );
This class is the base class for all Alzabo::RDBMSRules modules.
To instantiate a subclass call this class's new method. See the
SUBCLASSING Alzabo::RDBMSRules section for information on how to
make a ruleset for the RDBMS of your choice.
A list of names representing the available Alzabo::RDBMSRules
subclasses. Any one of these names would be appropriate as the
rdbms parameter for the
Alzabo::RDBMSRules->new method.
Some subclasses may accept additional values.
A new Alzabo::RDBMSRules object of the appropriate subclass.
Alzabo::Create::Schema object)
A list of SQL statements.
Alzabo::Create::Index object)
A list of SQL statements.
Alzabo::Create::Table object)
A list of SQL statements.
Alzabo::Create::Index object)
A list of SQL statements.
Given two schema objects, this method compares them and generates the SQL necessary to turn the 'old' one into the 'new' one.
An array of SQL statements.
Given two table objects, this method compares them and generates the SQL necessary to turn the 'old' one into the 'new' one.
An array of SQL statements.
The following methods are not implemented in the Alzabo::RDBMSRules
class itself and must be implemented in its subclasses.
A list of valid column type specifiers.
Given a string defining a feature, this method indicates whether or not the given RDBMS supports that feature. By default, this method always returns false unless overridden in the subclass.
Features that may be asked for:
Alzabo::Schema object)
A boolean value indicate whether the object's name is valid.
Alzabo::Create::Table object)
A boolean value indicate whether the object's name is valid.
Alzabo::Create::Column object)
A boolean value indicate whether the object's name is valid.
A canonized version of the type.
This method is a bit different from the others in that it takes an existing column object and a potential attribute.
A boolean value indicating whether or not this attribute is acceptable for the column.
Alzabo::Create::Column object)
Returns a boolean value indicating whether or not the given column can be part of its table's primary key.
Alzabo::Create::Column object)Given a column object, indicates whether or not the column can be sequenced.
Alzabo::Create::Index object)
A boolean value indicating whether or not the index is valid.
Alzabo::Create::Table object)
A list of SQL statements.
Alzabo::Create::Column object)
A list of SQL statements.
Alzabo::Create::ForeignKey object)
A list of SQL statements.
Alzabo::Create::Column object)
A list of SQL statements.
Alzabo::Create::ForeignKey object)
A list of SQL statements.
Alzabo::Create::Column object)
A list of SQL statements.
Given two column objects, this method compares them and generates the SQL necessary to turn the 'old' one into the 'new' one.
A list of SQL statements.
Given two index objects, this method compares them and generates the SQL necessary to turn the 'old' one into the 'new' one.
A list of SQL statements.
Given two foreign key objects, this method compares them and generates the SQL necessary to turn the 'old' one into the 'new' one.
A list of SQL statements.
Alzabo::Create::Table objectAlzabo::Create::Table objectGiven two table objects, this method compares them and generates the SQL necessary to give change the primary key from the 'old' one's primary key to the 'new' one's primary key.
A list of SQL statements.
Alzabo::Create::Schema object)Given a schema object (which presumably has no tables), this method
uses the schema's Alzabo::Driver object to
connect to an existing database and reverse engineer it into the
appopriate Alzabo objects.
To create a subclass of Alzabo::RDBMSRules for your particular
RDBMS is fairly simple.
Here's a sample header to the module using a fictional RDBMS called FooDB:
package Alzabo::RDBMSRules::FooDB;
use strict; use vars qw($VERSION);
use Alzabo::RDBMSRules;
use base qw(Alzabo::RDBMSRules);
The next step is to implement a new method and the methods listed
under the section Virtual Methods. The new method should look a
bit like this:
1: sub new
2: {
3: my $proto = shift;
4: my $class = ref $proto || $proto;
5: my %p = @_;
6:
7: my $self = bless {}, $self;
8:
9: return $self;
10: }
The hash %p contains any values passed to the
Alzabo::RDBMSRules->new method by its
caller.
Lines 1-7 should probably be copied verbatim into your own new
method. Line 5 can be deleted if you don't need to look at the
parameters.
The rest of your module should simply implement the methods listed under the Virtual Methods section of this documentation.
Look at the included Alzabo::RDBMSRules subclasses for examples.
Feel free to contact me for further help if you get stuck. Please
tell me what database you're attempting to implement, and include the
code you've written so far.
Dave Rolsky, <dave@urth.org>
|
Alzabo::RDBMSRules - Base class for Alzabo RDBMS rulesets |