1SQL::Translator::SchemaU:s:eOrbjCeocntt(r3i)buted Perl DSoQcLu:m:eTnrtaantsiloantor::Schema::Object(3)
2
3
4

NAME

6       SQL::Translator::Schema::Object - Base class SQL::Translator Schema
7       objects.
8

SYNOPSIS

DESCSIPTION

11       Base class for Schema objects. Sub classes Class::Base and adds the
12       following extra functionality.
13

Construction

15       Derived classes should declare their attributes using the "_attributes"
16       method. They can then inherit the "init" method from here which will
17       call accessors of the same name for any values given in the hash passed
18       to "new".  Note that you will have to impliment the accessors your self
19       and we expect perl style methods; call with no args to get and with arg
20       to set.
21
22       e.g. If we setup our class as follows;
23
24        package SQL::Translator::Schema::Table;
25        use base qw/SQL::Translator::Schema::Object/;
26
27        __PACKAGE__->_attributes( qw/schema name/ );
28
29        sub name   { ... }
30        sub schema { ... }
31
32       Then we can construct it with
33
34        my $table  =  SQL::Translator::Schema::Table->new(
35            schema => $schema,
36            name   => 'foo',
37        );
38
39       and init will call "$table->name("foo")" and "$table->schema($schema)"
40       to set it up. Any undefined args will be ignored.
41
42       Multiple calls to "_attributes" are cumulative and sub classes will
43       inherit their parents attribute names.
44
45       This is currently experimental, but will hopefull go on to form an
46       introspection API for the Schema objects.
47

Global Attributes

49       The following attributes are defined here, therefore all schema objects
50       will have them.
51
52   extra
53       Get or set the objects "extra" attibutes (e.g., "ZEROFILL" for MySQL
54       fields).  Call with no args to get all the extra data.  Call with a
55       single name arg to get the value of the named extra attribute, returned
56       as a scalar. Call with a hash or hashref to set extra attributes.
57       Returns a hash or a hashref.
58
59         $field->extra( qualifier => 'ZEROFILL' );
60
61         $qualifier = $field->extra('qualifier');
62
63         %extra = $field->extra;
64         $extra = $field->extra;
65
66   remove_extra
67       "extra" can only be used to get or set "extra" attributes but not to
68       remove some. Call with no args to remove all extra attributes that have
69       been set before. Call with a list of key names to remove certain extra
70       attributes only.
71
72         # remove all extra attributes
73         $field->remove_extra();
74
75         # remove timezone and locale attributes only
76         $field->remove_extra(qw/timezone locale/);
77
78   equals
79       Determines if this object is the same as another.
80
81         my $isIdentical = $object1->equals( $object2 );
82

SEE ALSO

TODO

BUGS

AUTHOR

87       Ken Youens-Clark <kclark@cpan.org>, Mark Addison
88       <mark.addison@itn.co.uk>.
89
90
91
92perl v5.12.0                      2009-08-18SQL::Translator::Schema::Object(3)
Impressum