[Bast-commits] r4178 - in branches/DBIx-Class-Schema-Loader/current: . lib/DBIx/Class/Schema/Loader lib/DBIx/Class/Schema/Loader/DBI

ilmari at dev.catalyst.perl.org ilmari at dev.catalyst.perl.org
Wed Mar 12 02:22:37 GMT 2008


Author: ilmari
Date: 2008-03-12 02:22:36 +0000 (Wed, 12 Mar 2008)
New Revision: 4178

Modified:
   branches/DBIx-Class-Schema-Loader/current/
   branches/DBIx-Class-Schema-Loader/current/Changes
   branches/DBIx-Class-Schema-Loader/current/lib/DBIx/Class/Schema/Loader/DBI.pm
   branches/DBIx-Class-Schema-Loader/current/lib/DBIx/Class/Schema/Loader/DBI/DB2.pm
Log:
 r36739 at vesla (orig r4176):  ilmari | 2008-03-12 01:49:17 +0000
 Fix DB2 support:
  - foreign_key_info needs the PK schema name
  - up/down-case table names when going to/from the DB



Property changes on: branches/DBIx-Class-Schema-Loader/current
___________________________________________________________________
Name: svk:merge
   - bd8105ee-0ff8-0310-8827-fb3f25b6796d:/trunk/DBIx-Class-Schema-Loader:4035
   + bd8105ee-0ff8-0310-8827-fb3f25b6796d:/trunk/DBIx-Class-Schema-Loader:4176

Modified: branches/DBIx-Class-Schema-Loader/current/Changes
===================================================================
--- branches/DBIx-Class-Schema-Loader/current/Changes	2008-03-12 02:18:13 UTC (rev 4177)
+++ branches/DBIx-Class-Schema-Loader/current/Changes	2008-03-12 02:22:36 UTC (rev 4178)
@@ -15,6 +15,7 @@
         - Set is_auto_increment for auto-increment columns (RT #31473)
           (Only SQLite, MySQL and PostgreSQL are currently supported)
         - Generate one-to-one accessors for unique foreign keys (ilmari)
+        - 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

Modified: branches/DBIx-Class-Schema-Loader/current/lib/DBIx/Class/Schema/Loader/DBI/DB2.pm
===================================================================
--- branches/DBIx-Class-Schema-Loader/current/lib/DBIx/Class/Schema/Loader/DBI/DB2.pm	2008-03-12 02:18:13 UTC (rev 4177)
+++ branches/DBIx-Class-Schema-Loader/current/lib/DBIx/Class/Schema/Loader/DBI/DB2.pm	2008-03-12 02:22:36 UTC (rev 4178)
@@ -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/DBIx-Class-Schema-Loader/current/lib/DBIx/Class/Schema/Loader/DBI.pm
===================================================================
--- branches/DBIx-Class-Schema-Loader/current/lib/DBIx/Class/Schema/Loader/DBI.pm	2008-03-12 02:18:13 UTC (rev 4177)
+++ branches/DBIx-Class-Schema-Loader/current/lib/DBIx/Class/Schema/Loader/DBI.pm	2008-03-12 02:22:36 UTC (rev 4178)
@@ -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;




More information about the Bast-commits mailing list