Revision history for Perl extension DBIx::Class::Schema::Loader
+0.01001 Fri Feb 3 05:15:41 UTC 2006
+ - Fixed up some documentation issues
+ - Load C3 at the right time
+
0.01 Fri Feb 3 01:53:46 UTC 2006
- original release
- created from DBIx::Class::Loader 0.14
---
name: DBIx-Class-Schema-Loader
-version: 0.01000
+version: 0.01001
author:
- 'Brandon Black, C<bblack@gmail.com>'
abstract: Dynamic definition of a DBIx::Class::Schema
provides:
DBIx::Class::Schema::Loader:
file: lib/DBIx/Class/Schema/Loader.pm
- version: 0.01000
+ version: 0.01001
DBIx::Class::Schema::Loader::DB2:
file: lib/DBIx/Class/Schema/Loader/DB2.pm
DBIx::Class::Schema::Loader::Generic:
# table-to-classname mappings.
my $classes = $schema1->loader->classes;
- # Use the schema as per normal for L<DBIx::Class::Schema>
+ # Use the schema as per normal for DBIx::Class::Schema
my $rs = $schema1->resultset($monikers->{table_table})->search(...);
DESCRIPTION
- THIS IS A DEVELOPMENT RELEASE. This is 0.01000, the first public
- release. Expect things to be broken in various ways. Expect the entire
+ THIS IS A DEVELOPMENT RELEASE. This is 0.01xxx, the first public
+ releases. Expect things to be broken in various ways. Expect the entire
design to be fatally flawed. Expect the interfaces to change if it
becomes neccessary. It's mostly here for people to poke at it and find
the flaws in it. 0.02 will hopefully have some sanity when we get there.
DBIx::Class::Schema::Loader::Writing for notes on writing your own
db-specific subclass for an unsupported db.
- This module requires DBIx::Class::Loader 0.5 or later, and obsoletes
- DBIx::Class::Loader for DBIx::Class version 0.5 and later.
+ This module requires DBIx::Class 0.05 or later, and obsoletes
+ DBIx::Class::Loader for DBIx::Class version 0.05 and later.
METHODS
load_from_connection
detailed information on the arguments, see the
DBIx::Class::Schema::Loader::Generic documentation.
+ loader
+ This is an accessor in the generated Schema class for accessing the
+ DBIx::Class::Schema::Loader::Generic -based loader object that was used
+ during construction. See the DBIx::Class::Schema::Loader::Generic docs
+ for more information on the available loader methods there.
+
AUTHOR
Brandon Black, "bblack@gmail.com"
use strict;
use warnings;
-use Carp;
-use UNIVERSAL::require;
-
use base qw/DBIx::Class::Schema/;
use base qw/Class::Data::Accessor/;
-
-__PACKAGE__->mk_classaccessor('loader');
-
-use vars qw($VERSION);
+use Carp;
+use UNIVERSAL::require;
# Always remember to do all digits for the version even if they're 0
# i.e. first release of 0.XX *must* be 0.XX000. This avoids fBSD ports
# brain damage and presumably various other packaging systems too
-$VERSION = '0.01000';
+use vars qw($VERSION);
+$VERSION = '0.01001';
+
+__PACKAGE__->mk_classaccessor('loader');
=head1 NAME
# table-to-classname mappings.
my $classes = $schema1->loader->classes;
- # Use the schema as per normal for L<DBIx::Class::Schema>
+ # Use the schema as per normal for DBIx::Class::Schema
my $rs = $schema1->resultset($monikers->{table_table})->search(...);
=head1 DESCRIPTION
-THIS IS A DEVELOPMENT RELEASE. This is 0.01000, the first public
-release. Expect things to be broken in various ways. Expect the
+THIS IS A DEVELOPMENT RELEASE. This is 0.01xxx, the first public
+releases. Expect things to be broken in various ways. Expect the
entire design to be fatally flawed. Expect the interfaces to change if
it becomes neccessary. It's mostly here for people to poke at it and
find the flaws in it. 0.02 will hopefully have some sanity when we get
L<DBIx::Class::Schema::Loader::Writing> for notes on writing your own
db-specific subclass for an unsupported db.
-This module requires DBIx::Class::Loader 0.5 or later, and obsoletes
-L<DBIx::Class::Loader> for L<DBIx::Class> version 0.5 and later.
-
-=cut
+This module requires L<DBIx::Class> 0.05 or later, and obsoletes
+L<DBIx::Class::Loader> for L<DBIx::Class> version 0.05 and later.
=head1 METHODS
$class->loader->load;
}
+=head2 loader
+
+This is an accessor in the generated Schema class for accessing
+the L<DBIx::Class::Schema::Loader::Generic> -based loader object
+that was used during construction. See the
+L<DBIx::Class::Schema::Loader::Generic> docs for more information
+on the available loader methods there.
+
=head1 AUTHOR
Brandon Black, C<bblack@gmail.com>
use strict;
use warnings;
-use Class::C3;
use base 'DBIx::Class::Schema::Loader::Generic';
+use Class::C3;
=head1 NAME
=head1 SYNOPSIS
- use DBIx::Schema::Class::Loader;
+ package My::Schema;
+ use base qw/DBIx::Class::Schema::Loader/;
- # $loader is a DBIx::Class::Schema::Loader::DB2
- my $loader = DBIx::Class::Schema::Loader->new(
+ __PACKAGE__->load_from_connection(
dsn => "dbi:DB2:dbname",
user => "myuser",
password => "",
drop_schema => 1,
);
+ 1;
+
=head1 DESCRIPTION
See L<DBIx::Class::Schema::Loader>.
use strict;
use warnings;
+use base qw/Class::Accessor::Fast/;
use Class::C3;
-
use Carp;
use Lingua::EN::Inflect;
-use base qw/Class::Accessor::Fast/;
-
require DBIx::Class::Core;
# The first group are all arguments which are may be defaulted within,
=head1 DESCRIPTION
-=head2 OPTIONS
+This is the base class for the vendor-specific C<DBIx::Class::Schema::*>
+classes, and implements the common functionality between them.
+
+=head1 OPTIONS
Available constructor options are:
-=head3 additional_base_classes
+=head2 additional_base_classes
List of additional base classes your table classes will use.
-=head3 left_base_classes
+=head2 left_base_classes
List of additional base classes, that need to be leftmost.
-=head3 additional_classes
+=head2 additional_classes
List of additional classes which your table classes will use.
-=head3 constraint
+=head2 constraint
Only load tables matching regex.
-=head3 exclude
+=head2 exclude
Exclude tables matching regex.
-=head3 debug
+=head2 debug
Enable debug messages.
-=head3 dsn
+=head2 dsn
DBI Data Source Name.
-=head3 password
+=head2 password
Password.
-=head3 relationships
+=head2 relationships
Try to automatically detect/setup has_a and has_many relationships.
-=head3 inflect
+=head2 inflect
An hashref, which contains exceptions to Lingua::EN::Inflect::PL().
Useful for foreign language column names.
-=head3 user
+=head2 user
Username.
-=head2 METHODS
-
-=cut
-
-=head3 new
-
-Constructor for L<DBIx::Class::Schema::Loader::Generic>, used internally
-by L<DBIx::Class::Schema::Loader>.
-
-=head3 load
-
-Does the actual schema-construction work, used internally by
-L<DBIx::Class::Schema::Loader> right after object construction.
+=head1 METHODS
=cut
}
}
+=head2 new
+
+Constructor for L<DBIx::Class::Schema::Loader::Generic>, used internally
+by L<DBIx::Class::Schema::Loader>.
+
+=cut
+
sub new {
my ( $class, %args ) = @_;
$self;
}
+=head2 load
+
+Does the actual schema-construction work, used internally by
+L<DBIx::Class::Schema::Loader> right after object construction.
+
+=cut
+
sub load {
my $self = shift;
}
}
-=head3 tables
+=head2 tables
Returns a sorted list of loaded tables, using the original database table
names. Actually generated from the keys of the C<monikers> hash below.
- my @tables = $schema->loader->tables;
-
-=head3 monikers
-
-Returns a hashref of loaded table-to-moniker mappings for the original
-database table names.
-
- my $monikers = $schema->loader->monikers;
- my $foo_tbl_moniker = $monikers->{foo_tbl};
- # -or-
- my $foo_tbl_moniker = $schema->loader->monikers->{foo_tbl};
- # $foo_tbl_moniker would look like "FooTbl"
-
-=head3 classes
-
-Returns a hashref of table-to-classname mappings for the original database
-table names. You probably shouldn't be using this for any normal or simple
-usage of your Schema. The usual way to run queries on your tables is via
-C<$schema-E<gt>resultset('FooTbl')>, where C<FooTbl> is a moniker as
-returned by C<monikers> above.
-
- my $classes = $schema->loader->classes;
- my $foo_tbl_class = $classes->{foo_tbl};
- # -or-
- my $foo_tbl_class = $schema->loader->classes->{foo_tbl};
- # $foo_tbl_class would look like "My::Schema::FooTbl",
- # assuming the schema class is "My::Schema"
+ my @tables = $schema->loader->tables;
=cut
sub _table_info { croak "ABSTRACT METHOD" }
+=head2 monikers
+
+Returns a hashref of loaded table-to-moniker mappings for the original
+database table names.
+
+ my $monikers = $schema->loader->monikers;
+ my $foo_tbl_moniker = $monikers->{foo_tbl};
+ # -or-
+ my $foo_tbl_moniker = $schema->loader->monikers->{foo_tbl};
+ # $foo_tbl_moniker would look like "FooTbl"
+
+=head2 classes
+
+Returns a hashref of table-to-classname mappings for the original database
+table names. You probably shouldn't be using this for any normal or simple
+usage of your Schema. The usual way to run queries on your tables is via
+C<$schema-E<gt>resultset('FooTbl')>, where C<FooTbl> is a moniker as
+returned by C<monikers> above.
+
+ my $classes = $schema->loader->classes;
+ my $foo_tbl_class = $classes->{foo_tbl};
+ # -or-
+ my $foo_tbl_class = $schema->loader->classes->{foo_tbl};
+ # $foo_tbl_class would look like "My::Schema::FooTbl",
+ # assuming the schema class is "My::Schema"
+
=head1 SEE ALSO
L<DBIx::Class::Schema::Loader>
use strict;
use warnings;
use Class::C3;
-
use base 'DBIx::Class::Schema::Loader::Generic';
=head1 NAME
=head1 SYNOPSIS
- use DBIx::Class::Schema::Loader;
+ package My::Schema;
+ use base qw/DBIx::Class::Schema::Loader/;
- # $loader is a DBIx::Class::Schema::Loader::Pg
- my $loader = DBIx::Class::Schema::Loader->new(
+ __PACKAGE__->load_from_connection(
dsn => "dbi:Pg:dbname=dbname",
user => "postgres",
password => "",
);
+ 1;
+
=head1 DESCRIPTION
See L<DBIx::Class::Schema::Loader>.
=head1 METHODS
-=head3 new
+=head2 new
Overrides L<DBIx::Class::Schema::Loader::Generic>'s C<new()> to default the postgres
schema to C<public> rather than blank.
use strict;
use warnings;
-use Class::C3;
use base qw/DBIx::Class::Schema::Loader::Generic/;
-
+use Class::C3;
use Text::Balanced qw( extract_bracketed );
=head1 NAME
=head1 SYNOPSIS
- use DBIx::Class::Schema::Loader;
+ package My::Schema;
+ use base qw/DBIx::Class::Schema::Loader/;
- # $loader is a DBIx::Class::Schema::Loader::SQLite
- my $loader = DBIx::Class::Schema::Loader->new(
+ __PACKAGE__->load_from_connection(
dsn => "dbi:SQLite:dbname=/path/to/dbfile",
);
+ 1;
+
=head1 DESCRIPTION
See L<DBIx::Class::Schema::Loader>.
use strict;
use warnings;
- use Class::C3;
use base 'DBIx::Class::Schema::Loader::Generic';
+ use Class::C3;
sub _db_classes {
return qw/DBIx::Class::PK::Auto::Foo/;
...
}
+ 1;
+
=cut
use strict;
use warnings;
-use Class::C3;
use base 'DBIx::Class::Schema::Loader::Generic';
+use Class::C3;
=head1 NAME
=head1 SYNOPSIS
- use DBIx::Class::Schema::Loader;
+ package My::Schema;
+ use base qw/DBIx::Class::Schema::Loader/;
- # $loader is a DBIx::Class::Schema::Loader::mysql
- my $loader = DBIx::Class::Schema::Loader->new(
+ __PACKAGE__->load_from_connection(
dsn => "dbi:mysql:dbname",
user => "root",
password => "",
);
+ 1;
+
=head1 DESCRIPTION
See L<DBIx::Class::Schema::Loader>.