[Bast-commits] r5920 - branches/DBIx-Class-Schema-Loader/current/lib/DBIx/Class/Schema/Loader/DBI

arcanez at dev.catalyst.perl.org arcanez at dev.catalyst.perl.org
Tue Apr 21 03:34:49 GMT 2009


Author: arcanez
Date: 2009-04-21 04:34:48 +0100 (Tue, 21 Apr 2009)
New Revision: 5920

Modified:
   branches/DBIx-Class-Schema-Loader/current/lib/DBIx/Class/Schema/Loader/DBI/MSSQL.pm
   branches/DBIx-Class-Schema-Loader/current/lib/DBIx/Class/Schema/Loader/DBI/Sybase.pm
Log:
change spacing
remove commented out code
prevent a potential infinite loop


Modified: branches/DBIx-Class-Schema-Loader/current/lib/DBIx/Class/Schema/Loader/DBI/MSSQL.pm
===================================================================
--- branches/DBIx-Class-Schema-Loader/current/lib/DBIx/Class/Schema/Loader/DBI/MSSQL.pm	2009-04-21 03:34:04 UTC (rev 5919)
+++ branches/DBIx-Class-Schema-Loader/current/lib/DBIx/Class/Schema/Loader/DBI/MSSQL.pm	2009-04-21 03:34:48 UTC (rev 5920)
@@ -43,7 +43,7 @@
     my @keydata;
 
     while (my $row = $sth->fetchrow_hashref) {
-      push @keydata, lc $row->{COLUMN_NAME};
+        push @keydata, lc $row->{COLUMN_NAME};
     }
 
     return \@keydata;
@@ -58,18 +58,18 @@
     $sth->execute;
 
     while (my $row = $sth->fetchrow_hashref) {
-      my $fk = $row->{FK_NAME};
-      push @{$local_cols->{$fk}}, lc $row->{FKCOLUMN_NAME};
-      push @{$remote_cols->{$fk}}, lc $row->{PKCOLUMN_NAME};
-      $remote_table->{$fk} = $row->{PKTABLE_NAME};
+        my $fk = $row->{FK_NAME};
+        push @{$local_cols->{$fk}}, lc $row->{FKCOLUMN_NAME};
+        push @{$remote_cols->{$fk}}, lc $row->{PKCOLUMN_NAME};
+        $remote_table->{$fk} = $row->{PKTABLE_NAME};
     }
 
     foreach my $fk (keys %$remote_table) {
-      push @rels, {
-                    local_columns => \@{$local_cols->{$fk}},
-                    remote_columns => \@{$remote_cols->{$fk}},
-                    remote_table => $remote_table->{$fk},
-                  };
+        push @rels, {
+                      local_columns => \@{$local_cols->{$fk}},
+                      remote_columns => \@{$remote_cols->{$fk}},
+                      remote_table => $remote_table->{$fk},
+                    };
 
     }
     return \@rels;

Modified: branches/DBIx-Class-Schema-Loader/current/lib/DBIx/Class/Schema/Loader/DBI/Sybase.pm
===================================================================
--- branches/DBIx-Class-Schema-Loader/current/lib/DBIx/Class/Schema/Loader/DBI/Sybase.pm	2009-04-21 03:34:04 UTC (rev 5919)
+++ branches/DBIx-Class-Schema-Loader/current/lib/DBIx/Class/Schema/Loader/DBI/Sybase.pm	2009-04-21 03:34:48 UTC (rev 5920)
@@ -40,10 +40,10 @@
     my $dbh = $self->schema->storage->dbh;
     my $DBMS_VERSION = @{$dbh->selectrow_arrayref(qq{sp_server_info \@attribute_id=1})}[2];
     if ($DBMS_VERSION =~ /^Microsoft /i) {
-      my $subclass = 'DBIx::Class::Schema::Loader::DBI::MSSQL';
-      if ($self->load_optional_class($subclass)) {
-        bless $self, $subclass unless $self->isa($subclass);
-        $self->_rebless;
+        my $subclass = 'DBIx::Class::Schema::Loader::DBI::MSSQL';
+        if ($self->load_optional_class($subclass) && !$self->isa($subclass)) {
+            bless $self, $subclass;
+            $self->_rebless;
       }
     }
 }
@@ -67,7 +67,7 @@
     my @keydata;
 
     while (my $row = $sth->fetchrow_hashref) {
-      push @keydata, lc $row->{column_name};
+        push @keydata, lc $row->{column_name};
     }
 
     return \@keydata;
@@ -84,19 +84,19 @@
     $sth->execute;
 
     while (my $row = $sth->fetchrow_hashref) {
-      next unless $row->{FK_NAME};
-      my $fk = $row->{FK_NAME};
-      push @{$local_cols->{$fk}}, lc $row->{FKCOLUMN_NAME};
-      push @{$remote_cols->{$fk}}, lc $row->{PKCOLUMN_NAME};
-      $remote_table->{$fk} = $row->{PKTABLE_NAME};
+        next unless $row->{FK_NAME};
+        my $fk = $row->{FK_NAME};
+        push @{$local_cols->{$fk}}, lc $row->{FKCOLUMN_NAME};
+        push @{$remote_cols->{$fk}}, lc $row->{PKCOLUMN_NAME};
+        $remote_table->{$fk} = $row->{PKTABLE_NAME};
     }
 
     foreach my $fk (keys %$remote_table) {
-      push @rels, {
-                    local_columns => \@{$local_cols->{$fk}},
-                    remote_columns => \@{$remote_cols->{$fk}},
-                    remote_table => $remote_table->{$fk},
-                  };
+        push @rels, {
+                     local_columns => \@{$local_cols->{$fk}},
+                     remote_columns => \@{$remote_cols->{$fk}},
+                     remote_table => $remote_table->{$fk},
+                    };
 
     }
     return \@rels;
@@ -106,10 +106,6 @@
     my ($self, $table) = @_;
 
     my $dbh = $self->schema->storage->dbh;
-#    my $sth = $dbh->prepare(qq{SELECT CCU.CONSTRAINT_NAME, CCU.COLUMN_NAME FROM INFORMATION_SCHEMA.CONSTRAINT_COLUMN_USAGE CCU
-#                               JOIN INFORMATION_SCHEMA.TABLE_CONSTRAINTS TC ON (CCU.CONSTRAINT_NAME = TC.CONSTRAINT_NAME)
-#                               JOIN INFORMATION_SCHEMA.KEY_COLUMN_USAGE KCU ON (CCU.CONSTRAINT_NAME = KCU.CONSTRAINT_NAME AND CCU.COLUMN_NAME = KCU.COLUMN_NAME)
-#                               WHERE CCU.TABLE_NAME = '$table' AND CONSTRAINT_TYPE = 'UNIQUE' ORDER BY KCU.ORDINAL_POSITION});
     my $sth = $dbh->prepare(qq{sp_helpconstraint \@objname='$table', \@nomsg='nomsg'});
     $sth->execute;
 
@@ -117,8 +113,8 @@
     while (my $row = $sth->fetchrow_hashref) {
         my $type = $row->{constraint_type} || '';
         if ($type =~ /^unique/i) {
-          my $name = lc $row->{constraint_name};
-          push @{$constraints->{$name}}, ( split /,/, lc $row->{constraint_keys} );
+            my $name = lc $row->{constraint_name};
+            push @{$constraints->{$name}}, ( split /,/, lc $row->{constraint_keys} );
         }
     }
 




More information about the Bast-commits mailing list