[Bast-commits] r6928 - in branches/DBIx-Class-Schema-Loader/mssql_tweaks: lib/DBIx/Class/Schema/Loader/DBI t

caelum at dev.catalyst.perl.org caelum at dev.catalyst.perl.org
Thu Jul 2 04:39:38 GMT 2009


Author: caelum
Date: 2009-07-02 04:39:37 +0000 (Thu, 02 Jul 2009)
New Revision: 6928

Modified:
   branches/DBIx-Class-Schema-Loader/mssql_tweaks/lib/DBIx/Class/Schema/Loader/DBI/Sybase.pm
   branches/DBIx-Class-Schema-Loader/mssql_tweaks/t/15sybase_common.t
Log:
merging in sybase branch

Modified: branches/DBIx-Class-Schema-Loader/mssql_tweaks/lib/DBIx/Class/Schema/Loader/DBI/Sybase.pm
===================================================================
--- branches/DBIx-Class-Schema-Loader/mssql_tweaks/lib/DBIx/Class/Schema/Loader/DBI/Sybase.pm	2009-07-01 18:04:16 UTC (rev 6927)
+++ branches/DBIx-Class-Schema-Loader/mssql_tweaks/lib/DBIx/Class/Schema/Loader/DBI/Sybase.pm	2009-07-02 04:39:37 UTC (rev 6928)
@@ -45,6 +45,12 @@
             bless $self, $subclass;
             $self->_rebless;
       }
+    } else {
+        $self->schema->storage->sql_maker->quote_char([qw/[ ]/])
+            unless $self->schema->storage->sql_maker->quote_char;
+
+        $self->schema->storage->sql_maker->name_sep('.')
+            unless $self->schema->storage->sql_maker->name_sep;
     }
 }
 
@@ -111,10 +117,21 @@
 
     my $constraints;
     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} );
+        if (exists $row->{constraint_type}) {
+            my $type = $row->{constraint_type} || '';
+            if ($type =~ /^unique/i) {
+                my $name = lc $row->{constraint_name};
+                push @{$constraints->{$name}},
+                    ( split /,/, lc $row->{constraint_keys} );
+            }
+        } else {
+            my $def = $row->{definition} || next;
+            next unless $def =~ /^unique/i;
+            my $name = lc $row->{name};
+            my ($keys) = $def =~ /\((.*)\)/;
+            $keys =~ s/\s*//g;
+            my @keys = map lc, split /,/ => $keys;
+            push @{$constraints->{$name}}, @keys;
         }
     }
 

Modified: branches/DBIx-Class-Schema-Loader/mssql_tweaks/t/15sybase_common.t
===================================================================
--- branches/DBIx-Class-Schema-Loader/mssql_tweaks/t/15sybase_common.t	2009-07-01 18:04:16 UTC (rev 6927)
+++ branches/DBIx-Class-Schema-Loader/mssql_tweaks/t/15sybase_common.t	2009-07-02 04:39:37 UTC (rev 6928)
@@ -8,7 +8,6 @@
 
 my $tester = dbixcsl_common_tests->new(
     vendor      => 'Sybase',
-    quote_char  => [qw/[ ]/],
     auto_inc_pk => 'INTEGER IDENTITY NOT NULL PRIMARY KEY',
     dsn         => $dsn,
     user        => $user,




More information about the Bast-commits mailing list