Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

sql::translator::schema::object(3pm) [debian man page]

SQL::Translator::Schema::Object(3pm)			User Contributed Perl Documentation		      SQL::Translator::Schema::Object(3pm)

NAME
SQL::Translator::Schema::Object - Base class SQL::Translator Schema objects. SYNOPSIS
DESCSIPTION
Base class for Schema objects. Sub classes Class::Base and adds the following extra functionality. Construction Derived classes should declare their attributes using the "_attributes" method. They can then inherit the "init" method from here which will call accessors of the same name for any values given in the hash passed to "new". Note that you will have to impliment the accessors your self and we expect perl style methods; call with no args to get and with arg to set. e.g. If we setup our class as follows; package SQL::Translator::Schema::Table; use base qw/SQL::Translator::Schema::Object/; __PACKAGE__->_attributes( qw/schema name/ ); sub name { ... } sub schema { ... } Then we can construct it with my $table = SQL::Translator::Schema::Table->new( schema => $schema, name => 'foo', ); and init will call "$table->name("foo")" and "$table->schema($schema)" to set it up. Any undefined args will be ignored. Multiple calls to "_attributes" are cumulative and sub classes will inherit their parents attribute names. This is currently experimental, but will hopefull go on to form an introspection API for the Schema objects. Global Attributes The following attributes are defined here, therefore all schema objects will have them. extra Get or set the objects "extra" attibutes (e.g., "ZEROFILL" for MySQL fields). Call with no args to get all the extra data. Call with a single name arg to get the value of the named extra attribute, returned as a scalar. Call with a hash or hashref to set extra attributes. Returns a hash or a hashref. $field->extra( qualifier => 'ZEROFILL' ); $qualifier = $field->extra('qualifier'); %extra = $field->extra; $extra = $field->extra; remove_extra "extra" can only be used to get or set "extra" attributes but not to remove some. Call with no args to remove all extra attributes that have been set before. Call with a list of key names to remove certain extra attributes only. # remove all extra attributes $field->remove_extra(); # remove timezone and locale attributes only $field->remove_extra(qw/timezone locale/); equals Determines if this object is the same as another. my $isIdentical = $object1->equals( $object2 ); SEE ALSO
TODO
BUGS
AUTHOR
Ken Youens-Clark <kclark@cpan.org>, Mark Addison <mark.addison@itn.co.uk>. perl v5.14.2 2012-01-20 SQL::Translator::Schema::Object(3pm)

Check Out this Related Man Page

SQL::Translator::Parser::DBIx::Class(3) 		User Contributed Perl Documentation		   SQL::Translator::Parser::DBIx::Class(3)

NAME
SQL::Translator::Parser::DBIx::Class - Create a SQL::Translator schema from a DBIx::Class::Schema instance SYNOPSIS
## Via DBIx::Class use MyApp::Schema; my $schema = MyApp::Schema->connect("dbi:SQLite:something.db"); $schema->create_ddl_dir(); ## or $schema->deploy(); ## Standalone use MyApp::Schema; use SQL::Translator; my $schema = MyApp::Schema->connect; my $trans = SQL::Translator->new ( parser => 'SQL::Translator::Parser::DBIx::Class', parser_args => { package => $schema, add_fk_index => 0, sources => [qw/ Artist CD /], }, producer => 'SQLite', ) or die SQL::Translator->error; my $out = $trans->translate() or die $trans->error; DESCRIPTION
This class requires SQL::Translator installed to work. "SQL::Translator::Parser::DBIx::Class" reads a DBIx::Class schema, interrogates the columns, and stuffs it all in an $sqlt_schema object. Its primary use is in deploying database layouts described as a set of DBIx::Class classes, to a database. To do this, see "deploy" in DBIx::Class::Schema. This can also be achieved by having DBIx::Class export the schema as a set of SQL files ready for import into your database, or passed to other machines that need to have your application installed but don't have SQL::Translator installed. To do this see "create_ddl_dir" in DBIx::Class::Schema. PARSER OPTIONS
add_fk_index Create an index for each foreign key. Enabled by default, as having indexed foreign key columns is normally the sensible thing to do. sources Arguments: @class_names Limit the amount of parsed sources by supplying an explicit list of source names. SEE ALSO
SQL::Translator, DBIx::Class::Schema AUTHORS
See "CONTRIBUTORS" in DBIx::Class. LICENSE
You may distribute this code under the same terms as Perl itself. perl v5.16.2 2012-08-16 SQL::Translator::Parser::DBIx::Class(3)
Man Page