2 DBIx::Class::Schema::Loader - Dynamic definition of a
7 use base qw/DBIx::Class::Schema::Loader/;
9 __PACKAGE__->load_from_connection(
10 dsn => "dbi:mysql:dbname",
13 additional_classes => [qw/DBIx::Class::Foo/],
14 additional_base_classes => [qw/My::Stuff/],
15 left_base_classes => [qw/DBIx::Class::Bar/],
16 constraint => '^foo.*',
18 options => { AutoCommit => 1 },
19 inflect => { child => 'children' },
23 # in seperate application code ...
27 my $schema1 = My::Schema->connect( $dsn, $user, $password, $attrs);
29 my $schema1 = "My::Schema";
30 # ^^ defaults to dsn/user/pass from load_from_connection()
32 # Get a list of the original (database) names of the tables that
34 my @tables = $schema1->loader->tables;
36 # Get a hashref of table_name => 'TableName' table-to-moniker
38 my $monikers = $schema1->loader->monikers;
40 # Get a hashref of table_name => 'My::Schema::TableName'
41 # table-to-classname mappings.
42 my $classes = $schema1->loader->classes;
44 # Use the schema as per normal for DBIx::Class::Schema
45 my $rs = $schema1->resultset($monikers->{table_table})->search(...);
48 THIS IS A DEVELOPMENT RELEASE. This is 0.01xxx, the first public
49 releases. Expect things to be broken in various ways. Expect the entire
50 design to be fatally flawed. Expect the interfaces to change if it
51 becomes neccessary. It's mostly here for people to poke at it and find
52 the flaws in it. 0.02 will hopefully have some sanity when we get there.
54 DBIx::Class::Schema::Loader automates the definition of a
55 DBIx::Class::Schema by scanning table schemas and setting up columns and
58 DBIx::Class::Schema::Loader supports MySQL, Postgres, SQLite and DB2.
59 See DBIx::Class::Schema::Loader::Generic for more, and
60 DBIx::Class::Schema::Loader::Writing for notes on writing your own
61 db-specific subclass for an unsupported db.
63 This module requires DBIx::Class 0.05 or later, and obsoletes
64 DBIx::Class::Loader for DBIx::Class version 0.05 and later.
68 Example in Synopsis above demonstrates the available arguments. For
69 detailed information on the arguments, see the
70 DBIx::Class::Schema::Loader::Generic documentation.
73 This is an accessor in the generated Schema class for accessing the
74 DBIx::Class::Schema::Loader::Generic -based loader object that was used
75 during construction. See the DBIx::Class::Schema::Loader::Generic docs
76 for more information on the available loader methods there.
79 Brandon Black, "blblack@gmail.com"
81 Based on DBIx::Class::Loader by Sebastian Riedel
83 Based upon the work of IKEBE Tomohiro
86 Adam Anderson, Andy Grundman, Autrijus Tang, Dan Kubb, David Naughton,
87 Randal Schwartz, Simon Flack and all the others who've helped.
90 This library is free software; you can redistribute it and/or modify it
91 under the same terms as Perl itself.