Revision history for Perl extension DBIx::Class::Schema::Loader
+ - do not try to detect driver and rebless when used with a custom
+ loader_class
- suppress 'bad table or view' warnings for filtered tables/views
- croak if several tables reduce to an identical moniker (ribasushi)
- better type info for Sybase ASE
$args->{use_namespaces} = $self->use_namespaces if $self->use_namespaces;
# XXX this only works for relative storage_type, like ::DBI ...
- my $impl = $self->loader_class
- || "DBIx::Class::Schema::Loader" . $self->storage_type;
- $impl = "DBIx::Class::Schema::Loader${impl}" if $impl =~ /^::/;
+ my $loader_class = $self->loader_class;
+ if ($loader_class) {
+ $loader_class = "DBIx::Class::Schema::Loader${loader_class}" if $loader_class =~ /^::/;
+ $args->{loader_class} = $loader_class;
+ };
+
+ my $impl = $loader_class || "DBIx::Class::Schema::Loader" . $self->storage_type;
eval { $self->ensure_class_loaded($impl) };
- croak qq/Could not load storage_type loader "$impl": "$@"/ if $@;
+ croak qq/Could not load loader class "$impl": "$@"/ if $@;
$self->_loader($impl->new(%$args));
$self->_loader->load;
@{$target . '::ISA'} = qw/DBIx::Class::Schema::Loader/;
}
+ eval { $target->_loader_invoked(0) };
+
$target->loader_options($opts);
$target->connection(@$connect_info);
}
=cut
1;
+# vim:et sts=4 sw=4 tw=0:
datetime_timezone
datetime_locale
config_file
+ loader_class
/);
sub new {
my $self = shift->next::method(@_);
- # rebless to vendor-specific class if it exists and loads
- my $dbh = $self->schema->storage->dbh;
- my $driver = $dbh->{Driver}->{Name};
-
- my $subclass = 'DBIx::Class::Schema::Loader::DBI::' . $driver;
- if ($self->load_optional_class($subclass)) {
- bless $self, $subclass unless $self->isa($subclass);
- $self->_rebless;
+ # rebless to vendor-specific class if it exists and loads and we're not in a
+ # custom class.
+ if (not $self->loader_class) {
+ my $dbh = $self->schema->storage->dbh;
+ my $driver = $dbh->{Driver}->{Name};
+
+ my $subclass = 'DBIx::Class::Schema::Loader::DBI::' . $driver;
+ if ($self->load_optional_class($subclass)) {
+ bless $self, $subclass unless $self->isa($subclass);
+ $self->_rebless;
+ }
}
# Set up the default quoting character and name seperators
=head1 SEE ALSO
L<DBIx::Class::Schema::Loader::DBI::ODBC::Microsoft_SQL_Server>,
-L<DBIx::Class::Schema::Loader::DBI::MSSQL>,
+L<DBIx::Class::Schema::Loader::DBI::ODBC::SQL_Anywhere>,
+L<DBIx::Class::Schema::Loader::DBI::ODBC::Firebird>,
L<DBIx::Class::Schema::Loader>, L<DBIx::Class::Schema::Loader::Base>,
L<DBIx::Class::Schema::Loader::DBI>
use lib qw(t/lib);
use make_dbictest_db;
-my %loader_class = ( 'TestLoaderSubclass' => 'TestLoaderSubclass',
- '::DBI::SQLite' => 'DBIx::Class::Schema::Loader::DBI::SQLite'
- );
+my %loader_class = (
+ 'TestLoaderSubclass' => 'TestLoaderSubclass',
+ 'TestLoaderSubclass_NoRebless' => 'TestLoaderSubclass_NoRebless',
+ '::DBI::SQLite' => 'DBIx::Class::Schema::Loader::DBI::SQLite'
+);
my %invocations = (
loader_class => sub {
--- /dev/null
+package TestLoaderSubclass_NoRebless;
+
+use strict;
+use warnings;
+use base qw/DBIx::Class::Schema::Loader::DBI/;
+
+1;