r18428 - in /branches/upstream/libdbix-class-schema-loader-perl/current: ./ inc/Module/ inc/Module/Install/ lib/DBIx/Class/Schema/ lib/DBIx/Class/Schema/Loader/ lib/DBIx/Class/Schema/Loader/DBI/ t/ t/lib/
eloy at users.alioth.debian.org
eloy at users.alioth.debian.org
Wed Apr 9 09:06:22 UTC 2008
Author: eloy
Date: Wed Apr 9 09:06:21 2008
New Revision: 18428
URL: http://svn.debian.org/wsvn/?sc=1&rev=18428
Log:
[svn-upgrade] Integrating new upstream version, libdbix-class-schema-loader-perl (0.04005)
Modified:
branches/upstream/libdbix-class-schema-loader-perl/current/Changes
branches/upstream/libdbix-class-schema-loader-perl/current/META.yml
branches/upstream/libdbix-class-schema-loader-perl/current/inc/Module/Install.pm
branches/upstream/libdbix-class-schema-loader-perl/current/inc/Module/Install/AutoInstall.pm
branches/upstream/libdbix-class-schema-loader-perl/current/inc/Module/Install/Base.pm
branches/upstream/libdbix-class-schema-loader-perl/current/inc/Module/Install/Build.pm
branches/upstream/libdbix-class-schema-loader-perl/current/inc/Module/Install/Can.pm
branches/upstream/libdbix-class-schema-loader-perl/current/inc/Module/Install/Fetch.pm
branches/upstream/libdbix-class-schema-loader-perl/current/inc/Module/Install/Include.pm
branches/upstream/libdbix-class-schema-loader-perl/current/inc/Module/Install/Makefile.pm
branches/upstream/libdbix-class-schema-loader-perl/current/inc/Module/Install/Metadata.pm
branches/upstream/libdbix-class-schema-loader-perl/current/inc/Module/Install/Win32.pm
branches/upstream/libdbix-class-schema-loader-perl/current/inc/Module/Install/WriteAll.pm
branches/upstream/libdbix-class-schema-loader-perl/current/lib/DBIx/Class/Schema/Loader.pm
branches/upstream/libdbix-class-schema-loader-perl/current/lib/DBIx/Class/Schema/Loader/Base.pm
branches/upstream/libdbix-class-schema-loader-perl/current/lib/DBIx/Class/Schema/Loader/DBI.pm
branches/upstream/libdbix-class-schema-loader-perl/current/lib/DBIx/Class/Schema/Loader/DBI/DB2.pm
branches/upstream/libdbix-class-schema-loader-perl/current/lib/DBIx/Class/Schema/Loader/DBI/Oracle.pm
branches/upstream/libdbix-class-schema-loader-perl/current/lib/DBIx/Class/Schema/Loader/DBI/Pg.pm
branches/upstream/libdbix-class-schema-loader-perl/current/lib/DBIx/Class/Schema/Loader/DBI/SQLite.pm
branches/upstream/libdbix-class-schema-loader-perl/current/lib/DBIx/Class/Schema/Loader/DBI/Writing.pm
branches/upstream/libdbix-class-schema-loader-perl/current/lib/DBIx/Class/Schema/Loader/DBI/mysql.pm
branches/upstream/libdbix-class-schema-loader-perl/current/lib/DBIx/Class/Schema/Loader/RelBuilder.pm
branches/upstream/libdbix-class-schema-loader-perl/current/t/14ora_common.t
branches/upstream/libdbix-class-schema-loader-perl/current/t/23dumpmore.t
branches/upstream/libdbix-class-schema-loader-perl/current/t/lib/dbixcsl_common_tests.pm
Modified: branches/upstream/libdbix-class-schema-loader-perl/current/Changes
URL: http://svn.debian.org/wsvn/branches/upstream/libdbix-class-schema-loader-perl/current/Changes?rev=18428&op=diff
==============================================================================
--- branches/upstream/libdbix-class-schema-loader-perl/current/Changes (original)
+++ branches/upstream/libdbix-class-schema-loader-perl/current/Changes Wed Apr 9 09:06:21 2008
@@ -1,4 +1,10 @@
Revision history for Perl extension DBIx::Class::Schema::Loader
+
+0.04005 Sat Apr 05, 2008
+ - Fix DB2 support
+ - Add support for load_namespaces-style class layout
+ - Fix test skip count for main skip_rels block
+ - Fix auto-inc column creation for the Oracle tests
0.04004 Thu Nov 15, 2007
- Fix Win32 test skip counts for good (RT #30568, Kenichi Ishigaki)
Modified: branches/upstream/libdbix-class-schema-loader-perl/current/META.yml
URL: http://svn.debian.org/wsvn/branches/upstream/libdbix-class-schema-loader-perl/current/META.yml?rev=18428&op=diff
==============================================================================
--- branches/upstream/libdbix-class-schema-loader-perl/current/META.yml (original)
+++ branches/upstream/libdbix-class-schema-loader-perl/current/META.yml Wed Apr 9 09:06:21 2008
@@ -1,13 +1,14 @@
---
abstract: Dynamic definition of a DBIx::Class::Schema
-author: Brandon Black, C<blblack at gmail.com>
+author:
+ - Brandon Black, C<blblack at gmail.com>
build_requires:
DBD::SQLite: 1.12
DBI: 1.56
File::Path: 0
Test::More: 0.47
distribution_type: module
-generated_by: Module::Install version 0.67
+generated_by: Module::Install version 0.68
license: perl
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.3.html
@@ -20,31 +21,31 @@
provides:
DBIx::Class::Schema::Loader:
file: lib/DBIx/Class/Schema/Loader.pm
- version: 0.04004
+ version: 0.04005
DBIx::Class::Schema::Loader::Base:
file: lib/DBIx/Class/Schema/Loader/Base.pm
- version: 0.04004
+ version: 0.04005
DBIx::Class::Schema::Loader::DBI:
file: lib/DBIx/Class/Schema/Loader/DBI.pm
- version: 0.04004
+ version: 0.04005
DBIx::Class::Schema::Loader::DBI::DB2:
file: lib/DBIx/Class/Schema/Loader/DBI/DB2.pm
- version: 0.04004
+ version: 0.04005
DBIx::Class::Schema::Loader::DBI::Pg:
file: lib/DBIx/Class/Schema/Loader/DBI/Pg.pm
- version: 0.04004
+ version: 0.04005
DBIx::Class::Schema::Loader::DBI::SQLite:
file: lib/DBIx/Class/Schema/Loader/DBI/SQLite.pm
- version: 0.04004
+ version: 0.04005
DBIx::Class::Schema::Loader::DBI::Writing:
file: lib/DBIx/Class/Schema/Loader/DBI/Writing.pm
- version: 0.04004
+ version: 0.04005
DBIx::Class::Schema::Loader::DBI::mysql:
file: lib/DBIx/Class/Schema/Loader/DBI/mysql.pm
- version: 0.04004
+ version: 0.04005
DBIx::Class::Schema::Loader::RelBuilder:
file: lib/DBIx/Class/Schema/Loader/RelBuilder.pm
- version: 0.04004
+ version: 0.04005
requires:
Carp::Clan: 0
Class::Accessor::Fast: 0.30
@@ -59,4 +60,4 @@
Scalar::Util: 0
Text::Balanced: 0
UNIVERSAL::require: 0.11
-version: 0.04004
+version: 0.04005
Modified: branches/upstream/libdbix-class-schema-loader-perl/current/inc/Module/Install.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libdbix-class-schema-loader-perl/current/inc/Module/Install.pm?rev=18428&op=diff
==============================================================================
--- branches/upstream/libdbix-class-schema-loader-perl/current/inc/Module/Install.pm (original)
+++ branches/upstream/libdbix-class-schema-loader-perl/current/inc/Module/Install.pm Wed Apr 9 09:06:21 2008
@@ -28,7 +28,7 @@
# This is not enforced yet, but will be some time in the next few
# releases once we can make sure it won't clash with custom
# Module::Install extensions.
- $VERSION = '0.67';
+ $VERSION = '0.68';
}
# Whether or not inc::Module::Install is actually loaded, the
Modified: branches/upstream/libdbix-class-schema-loader-perl/current/inc/Module/Install/AutoInstall.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libdbix-class-schema-loader-perl/current/inc/Module/Install/AutoInstall.pm?rev=18428&op=diff
==============================================================================
--- branches/upstream/libdbix-class-schema-loader-perl/current/inc/Module/Install/AutoInstall.pm (original)
+++ branches/upstream/libdbix-class-schema-loader-perl/current/inc/Module/Install/AutoInstall.pm Wed Apr 9 09:06:21 2008
@@ -6,7 +6,7 @@
use vars qw{$VERSION $ISCORE @ISA};
BEGIN {
- $VERSION = '0.67';
+ $VERSION = '0.68';
$ISCORE = 1;
@ISA = qw{Module::Install::Base};
}
Modified: branches/upstream/libdbix-class-schema-loader-perl/current/inc/Module/Install/Base.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libdbix-class-schema-loader-perl/current/inc/Module/Install/Base.pm?rev=18428&op=diff
==============================================================================
--- branches/upstream/libdbix-class-schema-loader-perl/current/inc/Module/Install/Base.pm (original)
+++ branches/upstream/libdbix-class-schema-loader-perl/current/inc/Module/Install/Base.pm Wed Apr 9 09:06:21 2008
@@ -1,7 +1,7 @@
#line 1
package Module::Install::Base;
-$VERSION = '0.67';
+$VERSION = '0.68';
# Suspend handler for "redefined" warnings
BEGIN {
Modified: branches/upstream/libdbix-class-schema-loader-perl/current/inc/Module/Install/Build.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libdbix-class-schema-loader-perl/current/inc/Module/Install/Build.pm?rev=18428&op=diff
==============================================================================
--- branches/upstream/libdbix-class-schema-loader-perl/current/inc/Module/Install/Build.pm (original)
+++ branches/upstream/libdbix-class-schema-loader-perl/current/inc/Module/Install/Build.pm Wed Apr 9 09:06:21 2008
@@ -6,7 +6,7 @@
use vars qw{$VERSION $ISCORE @ISA};
BEGIN {
- $VERSION = '0.67';
+ $VERSION = '0.68';
$ISCORE = 1;
@ISA = qw{Module::Install::Base};
}
Modified: branches/upstream/libdbix-class-schema-loader-perl/current/inc/Module/Install/Can.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libdbix-class-schema-loader-perl/current/inc/Module/Install/Can.pm?rev=18428&op=diff
==============================================================================
--- branches/upstream/libdbix-class-schema-loader-perl/current/inc/Module/Install/Can.pm (original)
+++ branches/upstream/libdbix-class-schema-loader-perl/current/inc/Module/Install/Can.pm Wed Apr 9 09:06:21 2008
@@ -11,7 +11,7 @@
use vars qw{$VERSION $ISCORE @ISA};
BEGIN {
- $VERSION = '0.67';
+ $VERSION = '0.68';
$ISCORE = 1;
@ISA = qw{Module::Install::Base};
}
Modified: branches/upstream/libdbix-class-schema-loader-perl/current/inc/Module/Install/Fetch.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libdbix-class-schema-loader-perl/current/inc/Module/Install/Fetch.pm?rev=18428&op=diff
==============================================================================
--- branches/upstream/libdbix-class-schema-loader-perl/current/inc/Module/Install/Fetch.pm (original)
+++ branches/upstream/libdbix-class-schema-loader-perl/current/inc/Module/Install/Fetch.pm Wed Apr 9 09:06:21 2008
@@ -6,7 +6,7 @@
use vars qw{$VERSION $ISCORE @ISA};
BEGIN {
- $VERSION = '0.67';
+ $VERSION = '0.68';
$ISCORE = 1;
@ISA = qw{Module::Install::Base};
}
Modified: branches/upstream/libdbix-class-schema-loader-perl/current/inc/Module/Install/Include.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libdbix-class-schema-loader-perl/current/inc/Module/Install/Include.pm?rev=18428&op=diff
==============================================================================
--- branches/upstream/libdbix-class-schema-loader-perl/current/inc/Module/Install/Include.pm (original)
+++ branches/upstream/libdbix-class-schema-loader-perl/current/inc/Module/Install/Include.pm Wed Apr 9 09:06:21 2008
@@ -6,7 +6,7 @@
use vars qw{$VERSION $ISCORE @ISA};
BEGIN {
- $VERSION = '0.67';
+ $VERSION = '0.68';
$ISCORE = 1;
@ISA = qw{Module::Install::Base};
}
Modified: branches/upstream/libdbix-class-schema-loader-perl/current/inc/Module/Install/Makefile.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libdbix-class-schema-loader-perl/current/inc/Module/Install/Makefile.pm?rev=18428&op=diff
==============================================================================
--- branches/upstream/libdbix-class-schema-loader-perl/current/inc/Module/Install/Makefile.pm (original)
+++ branches/upstream/libdbix-class-schema-loader-perl/current/inc/Module/Install/Makefile.pm Wed Apr 9 09:06:21 2008
@@ -7,7 +7,7 @@
use vars qw{$VERSION $ISCORE @ISA};
BEGIN {
- $VERSION = '0.67';
+ $VERSION = '0.68';
$ISCORE = 1;
@ISA = qw{Module::Install::Base};
}
Modified: branches/upstream/libdbix-class-schema-loader-perl/current/inc/Module/Install/Metadata.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libdbix-class-schema-loader-perl/current/inc/Module/Install/Metadata.pm?rev=18428&op=diff
==============================================================================
--- branches/upstream/libdbix-class-schema-loader-perl/current/inc/Module/Install/Metadata.pm (original)
+++ branches/upstream/libdbix-class-schema-loader-perl/current/inc/Module/Install/Metadata.pm Wed Apr 9 09:06:21 2008
@@ -6,7 +6,7 @@
use vars qw{$VERSION $ISCORE @ISA};
BEGIN {
- $VERSION = '0.67';
+ $VERSION = '0.68';
$ISCORE = 1;
@ISA = qw{Module::Install::Base};
}
Modified: branches/upstream/libdbix-class-schema-loader-perl/current/inc/Module/Install/Win32.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libdbix-class-schema-loader-perl/current/inc/Module/Install/Win32.pm?rev=18428&op=diff
==============================================================================
--- branches/upstream/libdbix-class-schema-loader-perl/current/inc/Module/Install/Win32.pm (original)
+++ branches/upstream/libdbix-class-schema-loader-perl/current/inc/Module/Install/Win32.pm Wed Apr 9 09:06:21 2008
@@ -6,7 +6,7 @@
use vars qw{$VERSION $ISCORE @ISA};
BEGIN {
- $VERSION = '0.67';
+ $VERSION = '0.68';
$ISCORE = 1;
@ISA = qw{Module::Install::Base};
}
Modified: branches/upstream/libdbix-class-schema-loader-perl/current/inc/Module/Install/WriteAll.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libdbix-class-schema-loader-perl/current/inc/Module/Install/WriteAll.pm?rev=18428&op=diff
==============================================================================
--- branches/upstream/libdbix-class-schema-loader-perl/current/inc/Module/Install/WriteAll.pm (original)
+++ branches/upstream/libdbix-class-schema-loader-perl/current/inc/Module/Install/WriteAll.pm Wed Apr 9 09:06:21 2008
@@ -6,7 +6,7 @@
use vars qw{$VERSION $ISCORE @ISA};
BEGIN {
- $VERSION = '0.67';
+ $VERSION = '0.68';
$ISCORE = 1;
@ISA = qw{Module::Install::Base};
}
Modified: branches/upstream/libdbix-class-schema-loader-perl/current/lib/DBIx/Class/Schema/Loader.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libdbix-class-schema-loader-perl/current/lib/DBIx/Class/Schema/Loader.pm?rev=18428&op=diff
==============================================================================
--- branches/upstream/libdbix-class-schema-loader-perl/current/lib/DBIx/Class/Schema/Loader.pm (original)
+++ branches/upstream/libdbix-class-schema-loader-perl/current/lib/DBIx/Class/Schema/Loader.pm Wed Apr 9 09:06:21 2008
@@ -11,7 +11,7 @@
# 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
-our $VERSION = '0.04004';
+our $VERSION = '0.04005';
__PACKAGE__->mk_classaccessor('_loader_args' => {});
__PACKAGE__->mk_classaccessors(qw/dump_to_dir _loader_invoked _loader/);
Modified: branches/upstream/libdbix-class-schema-loader-perl/current/lib/DBIx/Class/Schema/Loader/Base.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libdbix-class-schema-loader-perl/current/lib/DBIx/Class/Schema/Loader/Base.pm?rev=18428&op=diff
==============================================================================
--- branches/upstream/libdbix-class-schema-loader-perl/current/lib/DBIx/Class/Schema/Loader/Base.pm (original)
+++ branches/upstream/libdbix-class-schema-loader-perl/current/lib/DBIx/Class/Schema/Loader/Base.pm Wed Apr 9 09:06:21 2008
@@ -14,7 +14,7 @@
use Digest::MD5 qw//;
require DBIx::Class;
-our $VERSION = '0.04004';
+our $VERSION = '0.04005';
__PACKAGE__->mk_ro_accessors(qw/
schema
@@ -35,6 +35,10 @@
dump_directory
dump_overwrite
really_erase_my_files
+ use_namespaces
+ result_namespace
+ resultset_namespace
+ default_resultset_class
db_schema
_tables
@@ -140,6 +144,15 @@
classes. A good example would be C<AlwaysRS>. Component
C<ResultSetManager> will be automatically added to the above
C<components> list if this option is set.
+
+=head2 use_namespaces
+
+Generate result class names suitable for
+L<DBIx::Class::Schema/load_namespaces> and call that instead of
+L<DBIx::Class::Schema/load_classes>. When using this option you can also
+specify any of the options for C<load_namespaces> (i.e. C<result_namespace>,
+C<resultset_namespace>, C<default_resultset_class>), and they will be added
+to the call (and the generated result class names adjusted appropriately).
=head2 dump_directory
@@ -440,8 +453,26 @@
my $schema_text =
qq|package $schema_class;\n\n|
. qq|use strict;\nuse warnings;\n\n|
- . qq|use base 'DBIx::Class::Schema';\n\n|
- . qq|__PACKAGE__->load_classes;\n|;
+ . qq|use base 'DBIx::Class::Schema';\n\n|;
+
+
+ if ($self->use_namespaces) {
+ $schema_text .= qq|__PACKAGE__->load_namespaces|;
+ my $namespace_options;
+ for my $attr (qw(result_namespace
+ resultset_namespace
+ default_resultset_class)) {
+ if ($self->$attr) {
+ $namespace_options .= qq| $attr => '| . $self->$attr . qq|',\n|
+ }
+ }
+ $schema_text .= qq|(\n$namespace_options)| if $namespace_options;
+ $schema_text .= qq|;\n|;
+ }
+ else {
+ $schema_text .= qq|__PACKAGE__->load_classes;\n|;
+
+ }
$self->_write_classfile($schema_class, $schema_text);
@@ -569,7 +600,19 @@
my $schema_class = $self->schema_class;
my $table_moniker = $self->_table2moniker($table);
- my $table_class = $schema_class . q{::} . $table_moniker;
+ my @result_namespace = ($schema_class);
+ if ($self->use_namespaces) {
+ my $result_namespace = $self->result_namespace || 'Result';
+ if ($result_namespace =~ /^\+(.*)/) {
+ # Fully qualified namespace
+ @result_namespace = ($1)
+ }
+ else {
+ # Relative namespace
+ push @result_namespace, $result_namespace;
+ }
+ }
+ my $table_class = join(q{::}, @result_namespace, $table_moniker);
my $table_normalized = lc $table;
$self->classes->{$table} = $table_class;
Modified: branches/upstream/libdbix-class-schema-loader-perl/current/lib/DBIx/Class/Schema/Loader/DBI.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libdbix-class-schema-loader-perl/current/lib/DBIx/Class/Schema/Loader/DBI.pm?rev=18428&op=diff
==============================================================================
--- branches/upstream/libdbix-class-schema-loader-perl/current/lib/DBIx/Class/Schema/Loader/DBI.pm (original)
+++ branches/upstream/libdbix-class-schema-loader-perl/current/lib/DBIx/Class/Schema/Loader/DBI.pm Wed Apr 9 09:06:21 2008
@@ -7,7 +7,7 @@
use Carp::Clan qw/^DBIx::Class/;
use UNIVERSAL::require;
-our $VERSION = '0.04004';
+our $VERSION = '0.04005';
=head1 NAME
@@ -169,8 +169,8 @@
my ($self, $table) = @_;
my $dbh = $self->schema->storage->dbh;
- my $sth = $dbh->foreign_key_info( '', '', '', '',
- $self->db_schema, $table );
+ my $sth = $dbh->foreign_key_info( '', $self->db_schema, '',
+ '', $self->db_schema, $table );
return [] if !$sth;
my %rels;
@@ -212,7 +212,6 @@
my %result;
eval {
my $sth = $dbh->column_info( undef, $self->db_schema, $table, '%' );
- $sth->execute();
while ( my $info = $sth->fetchrow_hashref() ){
my %column_info;
$column_info{data_type} = $info->{TYPE_NAME};
Modified: branches/upstream/libdbix-class-schema-loader-perl/current/lib/DBIx/Class/Schema/Loader/DBI/DB2.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libdbix-class-schema-loader-perl/current/lib/DBIx/Class/Schema/Loader/DBI/DB2.pm?rev=18428&op=diff
==============================================================================
--- branches/upstream/libdbix-class-schema-loader-perl/current/lib/DBIx/Class/Schema/Loader/DBI/DB2.pm (original)
+++ branches/upstream/libdbix-class-schema-loader-perl/current/lib/DBIx/Class/Schema/Loader/DBI/DB2.pm Wed Apr 9 09:06:21 2008
@@ -6,7 +6,7 @@
use Carp::Clan qw/^DBIx::Class/;
use Class::C3;
-our $VERSION = '0.04004';
+our $VERSION = '0.04005';
=head1 NAME
@@ -41,7 +41,7 @@
WHERE tc.TABSCHEMA = ? and tc.TABNAME = ? and tc.TYPE = 'U'}
) or die $DBI::errstr;
- $sth->execute($self->db_schema, $table) or die $DBI::errstr;
+ $sth->execute($self->db_schema, uc $table) or die $DBI::errstr;
my %keydata;
while(my $row = $sth->fetchrow_arrayref) {
@@ -59,6 +59,33 @@
return \@uniqs;
}
+sub _tables_list {
+ my $self = shift;
+ return map lc, $self->next::method;
+}
+
+sub _table_pk_info {
+ my ($self, $table) = @_;
+ return $self->next::method(uc $table);
+}
+
+sub _table_fk_info {
+ my ($self, $table) = @_;
+
+ my $rels = $self->next::method(uc $table);
+
+ foreach my $rel (@$rels) {
+ $rel->{remote_table} = lc $rel->{remote_table};
+ }
+
+ return $rels;
+}
+
+sub _columns_info_for {
+ my ($self, $table) = @_;
+ return $self->next::method(uc $table);
+}
+
=head1 SEE ALSO
L<DBIx::Class::Schema::Loader>, L<DBIx::Class::Schema::Loader::Base>,
Modified: branches/upstream/libdbix-class-schema-loader-perl/current/lib/DBIx/Class/Schema/Loader/DBI/Oracle.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libdbix-class-schema-loader-perl/current/lib/DBIx/Class/Schema/Loader/DBI/Oracle.pm?rev=18428&op=diff
==============================================================================
--- branches/upstream/libdbix-class-schema-loader-perl/current/lib/DBIx/Class/Schema/Loader/DBI/Oracle.pm (original)
+++ branches/upstream/libdbix-class-schema-loader-perl/current/lib/DBIx/Class/Schema/Loader/DBI/Oracle.pm Wed Apr 9 09:06:21 2008
@@ -8,7 +8,7 @@
use Carp::Clan qw/^DBIx::Class/;
use Class::C3;
-our $VERSION = '0.04004';
+our $VERSION = '0.04005';
=head1 NAME
@@ -76,68 +76,51 @@
sub _table_uniq_info {
my ($self, $table) = @_;
- my @uniqs;
my $dbh = $self->schema->storage->dbh;
my $sth = $dbh->prepare_cached(
- qq{SELECT constraint_name, ucc.column_name FROM user_constraints JOIN user_cons_columns ucc USING (constraint_name) WHERE ucc.table_name=? AND constraint_type='U'}
- ,{}, 1);
+ q{
+ SELECT constraint_name, ucc.column_name
+ FROM user_constraints JOIN user_cons_columns ucc USING (constraint_name)
+ WHERE ucc.table_name=? AND constraint_type='U'
+ ORDER BY ucc.position
+ },
+ {}, 1);
$sth->execute(uc $table);
my %constr_names;
while(my $constr = $sth->fetchrow_arrayref) {
- my $constr_name = $constr->[0];
- my $constr_def = $constr->[1];
+ my $constr_name = lc $constr->[0];
+ my $constr_def = lc $constr->[1];
$constr_name =~ s/\Q$self->{_quoter}\E//;
$constr_def =~ s/\Q$self->{_quoter}\E//;
- push @{$constr_names{$constr_name}}, lc $constr_def;
+ push @{$constr_names{$constr_name}}, $constr_def;
}
- map {
- push(@uniqs, [ lc $_ => $constr_names{$_} ]);
- } keys %constr_names;
-
+
+ my @uniqs = map { [ $_ => $constr_names{$_} ] } keys %constr_names;
return \@uniqs;
}
sub _table_pk_info {
- my ( $self, $table ) = @_;
- return $self->SUPER::_table_pk_info(uc $table);
+ my ($self, $table) = @_;
+ return $self->next::method(uc $table);
}
sub _table_fk_info {
my ($self, $table) = @_;
- my $dbh = $self->schema->storage->dbh;
- my $sth = $dbh->foreign_key_info( '', '', '', '',
- $self->db_schema, uc $table );
- return [] if !$sth;
+ my $rels = $self->next::method(uc $table);
- my %rels;
-
- my $i = 1; # for unnamed rels, which hopefully have only 1 column ...
- while(my $raw_rel = $sth->fetchrow_arrayref) {
- my $uk_tbl = lc $raw_rel->[2];
- my $uk_col = lc $raw_rel->[3];
- my $fk_col = lc $raw_rel->[7];
- my $relid = ($raw_rel->[11] || ( "__dcsld__" . $i++ ));
- $uk_tbl =~ s/\Q$self->{_quoter}\E//g;
- $uk_col =~ s/\Q$self->{_quoter}\E//g;
- $fk_col =~ s/\Q$self->{_quoter}\E//g;
- $relid =~ s/\Q$self->{_quoter}\E//g;
- $rels{$relid}->{tbl} = $uk_tbl;
- $rels{$relid}->{cols}->{$uk_col} = $fk_col;
+ foreach my $rel (@$rels) {
+ $rel->{remote_table} = lc $rel->{remote_table};
}
- my @rels;
- foreach my $relid (keys %rels) {
- push(@rels, {
- remote_columns => [ keys %{$rels{$relid}->{cols}} ],
- local_columns => [ values %{$rels{$relid}->{cols}} ],
- remote_table => $rels{$relid}->{tbl},
- });
- }
+ return $rels;
+}
- return \@rels;
+sub _columns_info_for {
+ my ($self, $table) = @_;
+ return $self->next::method(uc $table);
}
=head1 SEE ALSO
Modified: branches/upstream/libdbix-class-schema-loader-perl/current/lib/DBIx/Class/Schema/Loader/DBI/Pg.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libdbix-class-schema-loader-perl/current/lib/DBIx/Class/Schema/Loader/DBI/Pg.pm?rev=18428&op=diff
==============================================================================
--- branches/upstream/libdbix-class-schema-loader-perl/current/lib/DBIx/Class/Schema/Loader/DBI/Pg.pm (original)
+++ branches/upstream/libdbix-class-schema-loader-perl/current/lib/DBIx/Class/Schema/Loader/DBI/Pg.pm Wed Apr 9 09:06:21 2008
@@ -6,7 +6,7 @@
use Carp::Clan qw/^DBIx::Class/;
use Class::C3;
-our $VERSION = '0.04004';
+our $VERSION = '0.04005';
=head1 NAME
Modified: branches/upstream/libdbix-class-schema-loader-perl/current/lib/DBIx/Class/Schema/Loader/DBI/SQLite.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libdbix-class-schema-loader-perl/current/lib/DBIx/Class/Schema/Loader/DBI/SQLite.pm?rev=18428&op=diff
==============================================================================
--- branches/upstream/libdbix-class-schema-loader-perl/current/lib/DBIx/Class/Schema/Loader/DBI/SQLite.pm (original)
+++ branches/upstream/libdbix-class-schema-loader-perl/current/lib/DBIx/Class/Schema/Loader/DBI/SQLite.pm Wed Apr 9 09:06:21 2008
@@ -7,7 +7,7 @@
use Text::Balanced qw( extract_bracketed );
use Class::C3;
-our $VERSION = '0.04004';
+our $VERSION = '0.04005';
=head1 NAME
Modified: branches/upstream/libdbix-class-schema-loader-perl/current/lib/DBIx/Class/Schema/Loader/DBI/Writing.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libdbix-class-schema-loader-perl/current/lib/DBIx/Class/Schema/Loader/DBI/Writing.pm?rev=18428&op=diff
==============================================================================
--- branches/upstream/libdbix-class-schema-loader-perl/current/lib/DBIx/Class/Schema/Loader/DBI/Writing.pm (original)
+++ branches/upstream/libdbix-class-schema-loader-perl/current/lib/DBIx/Class/Schema/Loader/DBI/Writing.pm Wed Apr 9 09:06:21 2008
@@ -1,7 +1,7 @@
package DBIx::Class::Schema::Loader::DBI::Writing;
use strict;
-our $VERSION = '0.04004';
+our $VERSION = '0.04005';
# Empty. POD only.
@@ -51,8 +51,9 @@
The base DBI Loader contains generic methods that *should* work for
everything else in theory, although in practice some DBDs need to
override one or more of the other methods. The other methods one might
-likely want to override are: C<_table_pk_info>, C<_table_fk_info>, and
-C<_tables_list>. See the included DBD drivers for examples of these.
+likely want to override are: C<_table_pk_info>, C<_table_fk_info>,
+C<_tables_list> and C<_extra_column_info>. See the included DBD drivers
+for examples of these.
=cut
Modified: branches/upstream/libdbix-class-schema-loader-perl/current/lib/DBIx/Class/Schema/Loader/DBI/mysql.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libdbix-class-schema-loader-perl/current/lib/DBIx/Class/Schema/Loader/DBI/mysql.pm?rev=18428&op=diff
==============================================================================
--- branches/upstream/libdbix-class-schema-loader-perl/current/lib/DBIx/Class/Schema/Loader/DBI/mysql.pm (original)
+++ branches/upstream/libdbix-class-schema-loader-perl/current/lib/DBIx/Class/Schema/Loader/DBI/mysql.pm Wed Apr 9 09:06:21 2008
@@ -6,7 +6,7 @@
use Carp::Clan qw/^DBIx::Class/;
use Class::C3;
-our $VERSION = '0.04004';
+our $VERSION = '0.04005';
=head1 NAME
Modified: branches/upstream/libdbix-class-schema-loader-perl/current/lib/DBIx/Class/Schema/Loader/RelBuilder.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libdbix-class-schema-loader-perl/current/lib/DBIx/Class/Schema/Loader/RelBuilder.pm?rev=18428&op=diff
==============================================================================
--- branches/upstream/libdbix-class-schema-loader-perl/current/lib/DBIx/Class/Schema/Loader/RelBuilder.pm (original)
+++ branches/upstream/libdbix-class-schema-loader-perl/current/lib/DBIx/Class/Schema/Loader/RelBuilder.pm Wed Apr 9 09:06:21 2008
@@ -5,7 +5,7 @@
use Carp::Clan qw/^DBIx::Class/;
use Lingua::EN::Inflect::Number ();
-our $VERSION = '0.04004';
+our $VERSION = '0.04005';
=head1 NAME
Modified: branches/upstream/libdbix-class-schema-loader-perl/current/t/14ora_common.t
URL: http://svn.debian.org/wsvn/branches/upstream/libdbix-class-schema-loader-perl/current/t/14ora_common.t?rev=18428&op=diff
==============================================================================
--- branches/upstream/libdbix-class-schema-loader-perl/current/t/14ora_common.t (original)
+++ branches/upstream/libdbix-class-schema-loader-perl/current/t/14ora_common.t Wed Apr 9 09:06:21 2008
@@ -8,7 +8,25 @@
my $tester = dbixcsl_common_tests->new(
vendor => 'Oracle',
- auto_inc_pk => 'SERIAL NOT NULL PRIMARY KEY',
+ auto_inc_pk => 'INTEGER NOT NULL PRIMARY KEY',
+ auto_inc_cb => sub {
+ my ($table, $col) = @_;
+ return (
+ qq{ CREATE SEQUENCE ${table}_${col}_seq START WITH 1 INCREMENT BY 1},
+ qq{
+ CREATE OR REPLACE TRIGGER ${table}_${col}_trigger
+ BEFORE INSERT ON ${table}
+ FOR EACH ROW
+ BEGIN
+ SELECT ${table}_${col}_seq.nextval INTO :NEW.${col} FROM dual;
+ END;
+ }
+ );
+ },
+ auto_inc_drop_cb => sub {
+ my ($table, $col) = @_;
+ return qq{ DROP SEQUENCE ${table}_${col}_seq };
+ },
dsn => $dsn,
user => $user,
password => $password,
Modified: branches/upstream/libdbix-class-schema-loader-perl/current/t/23dumpmore.t
URL: http://svn.debian.org/wsvn/branches/upstream/libdbix-class-schema-loader-perl/current/t/23dumpmore.t?rev=18428&op=diff
==============================================================================
--- branches/upstream/libdbix-class-schema-loader-perl/current/t/23dumpmore.t (original)
+++ branches/upstream/libdbix-class-schema-loader-perl/current/t/23dumpmore.t Wed Apr 9 09:06:21 2008
@@ -7,7 +7,7 @@
$^O eq 'MSWin32'
? plan(skip_all => "ActiveState perl produces additional warnings, and this test uses unix paths")
- : plan(tests => 40);
+ : plan(tests => 82);
my $DUMP_PATH = './t/_dump';
@@ -169,4 +169,96 @@
},
);
+do_dump_test(
+ classname => 'DBICTest::DumpMore::1',
+ options => { use_namespaces => 1 },
+ error => '',
+ warnings => [
+ qr/Dumping manual schema for DBICTest::DumpMore::1 to directory /,
+ qr/Schema dump completed/,
+ ],
+ regexes => {
+ schema => [
+ qr/package DBICTest::DumpMore::1;/,
+ qr/->load_namespaces/,
+ ],
+ 'Result/Foo' => [
+ qr/package DBICTest::DumpMore::1::Result::Foo;/,
+ qr/->set_primary_key/,
+ qr/1;\n$/,
+ ],
+ 'Result/Bar' => [
+ qr/package DBICTest::DumpMore::1::Result::Bar;/,
+ qr/->set_primary_key/,
+ qr/1;\n$/,
+ ],
+ },
+);
+
+do_dump_test(
+ classname => 'DBICTest::DumpMore::1',
+ options => { use_namespaces => 1,
+ result_namespace => 'Res',
+ resultset_namespace => 'RSet',
+ default_resultset_class => 'RSetBase',
+ },
+ error => '',
+ warnings => [
+ qr/Dumping manual schema for DBICTest::DumpMore::1 to directory /,
+ qr/Schema dump completed/,
+ ],
+ regexes => {
+ schema => [
+ qr/package DBICTest::DumpMore::1;/,
+ qr/->load_namespaces/,
+ qr/result_namespace => 'Res'/,
+ qr/resultset_namespace => 'RSet'/,
+ qr/default_resultset_class => 'RSetBase'/,
+ ],
+ 'Res/Foo' => [
+ qr/package DBICTest::DumpMore::1::Res::Foo;/,
+ qr/->set_primary_key/,
+ qr/1;\n$/,
+ ],
+ 'Res/Bar' => [
+ qr/package DBICTest::DumpMore::1::Res::Bar;/,
+ qr/->set_primary_key/,
+ qr/1;\n$/,
+ ],
+ },
+);
+
+do_dump_test(
+ classname => 'DBICTest::DumpMore::1',
+ options => { use_namespaces => 1,
+ result_namespace => '+DBICTest::DumpMore::1::Res',
+ resultset_namespace => 'RSet',
+ default_resultset_class => 'RSetBase',
+ },
+ error => '',
+ warnings => [
+ qr/Dumping manual schema for DBICTest::DumpMore::1 to directory /,
+ qr/Schema dump completed/,
+ ],
+ regexes => {
+ schema => [
+ qr/package DBICTest::DumpMore::1;/,
+ qr/->load_namespaces/,
+ qr/result_namespace => '\+DBICTest::DumpMore::1::Res'/,
+ qr/resultset_namespace => 'RSet'/,
+ qr/default_resultset_class => 'RSetBase'/,
+ ],
+ 'Res/Foo' => [
+ qr/package DBICTest::DumpMore::1::Res::Foo;/,
+ qr/->set_primary_key/,
+ qr/1;\n$/,
+ ],
+ 'Res/Bar' => [
+ qr/package DBICTest::DumpMore::1::Res::Bar;/,
+ qr/->set_primary_key/,
+ qr/1;\n$/,
+ ],
+ },
+);
+
END { rmtree($DUMP_PATH, 1, 1); }
Modified: branches/upstream/libdbix-class-schema-loader-perl/current/t/lib/dbixcsl_common_tests.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libdbix-class-schema-loader-perl/current/t/lib/dbixcsl_common_tests.pm?rev=18428&op=diff
==============================================================================
--- branches/upstream/libdbix-class-schema-loader-perl/current/t/lib/dbixcsl_common_tests.pm (original)
+++ branches/upstream/libdbix-class-schema-loader-perl/current/t/lib/dbixcsl_common_tests.pm Wed Apr 9 09:06:21 2008
@@ -244,7 +244,7 @@
is( $obj2->id, 2 );
SKIP: {
- skip $self->{skip_rels}, 42 if $self->{skip_rels};
+ skip $self->{skip_rels}, 50 if $self->{skip_rels};
my $moniker3 = $monikers->{loader_test3};
my $class3 = $classes->{loader_test3};
@@ -526,6 +526,7 @@
$self->{_created} = 1;
+ my $make_auto_inc = $self->{auto_inc_cb} || sub {};
my @statements = (
qq{
CREATE TABLE loader_test1 (
@@ -533,6 +534,7 @@
dat VARCHAR(32) NOT NULL UNIQUE
) $self->{innodb}
},
+ $make_auto_inc->(qw/loader_test1 id/),
q{ INSERT INTO loader_test1 (dat) VALUES('foo') },
q{ INSERT INTO loader_test1 (dat) VALUES('bar') },
@@ -546,6 +548,7 @@
UNIQUE (dat2, dat)
) $self->{innodb}
},
+ $make_auto_inc->(qw/loader_test2 id/),
q{ INSERT INTO loader_test2 (dat, dat2) VALUES('aaa', 'zzz') },
q{ INSERT INTO loader_test2 (dat, dat2) VALUES('bbb', 'yyy') },
@@ -768,6 +771,7 @@
loader_test11 INTEGER
) $self->{innodb}
},
+ $make_auto_inc->(qw/loader_test10 id10/),
qq{
CREATE TABLE loader_test11 (
@@ -777,6 +781,7 @@
FOREIGN KEY (loader_test10) REFERENCES loader_test10 (id10)
) $self->{innodb}
},
+ $make_auto_inc->(qw/loader_test11 id11/),
(q{ ALTER TABLE loader_test10 ADD CONSTRAINT } .
q{ loader_test11_fk FOREIGN KEY (loader_test11) } .
@@ -866,6 +871,11 @@
LOADER_TEST23
LoAdEr_test24
/;
+
+ my @tables_auto_inc = (
+ [ qw/loader_test1 id/ ],
+ [ qw/loader_test2 id/ ],
+ );
my @tables_reltests = qw/
loader_test4
@@ -890,6 +900,11 @@
loader_test11
loader_test10
/;
+
+ my @tables_advanced_auto_inc = (
+ [ qw/loader_test10 id10/ ],
+ [ qw/loader_test11 id11/ ],
+ );
my @tables_inline_rels = qw/
loader_test13
@@ -904,12 +919,14 @@
my @tables_rescan = qw/ loader_test30 /;
my $drop_fk_mysql =
- q{ALTER TABLE loader_test10 DROP FOREIGN KEY loader_test11_fk;};
+ q{ALTER TABLE loader_test10 DROP FOREIGN KEY loader_test11_fk};
my $drop_fk =
- q{ALTER TABLE loader_test10 DROP CONSTRAINT loader_test11_fk;};
+ q{ALTER TABLE loader_test10 DROP CONSTRAINT loader_test11_fk};
my $dbh = $self->dbconnect(0);
+
+ my $drop_auto_inc = $self->{auto_inc_drop_cb} || sub {};
unless($self->{skip_rels}) {
$dbh->do("DROP TABLE $_") for (@tables_reltests);
@@ -921,6 +938,7 @@
$dbh->do($drop_fk);
}
$dbh->do("DROP TABLE $_") for (@tables_advanced);
+ $dbh->do($_) for map { $drop_auto_inc->(@$_) } @tables_advanced_auto_inc;
}
unless($self->{no_inline_rels}) {
$dbh->do("DROP TABLE $_") for (@tables_inline_rels);
@@ -931,6 +949,7 @@
$dbh->do("DROP TABLE $_") for (@tables_rescan);
}
$dbh->do("DROP TABLE $_") for (@tables);
+ $dbh->do($_) for map { $drop_auto_inc->(@$_) } @tables_auto_inc;
$dbh->disconnect;
}
More information about the Pkg-perl-cvs-commits
mailing list