merging in sybase branch
Rafael Kitover [Thu, 2 Jul 2009 04:39:37 +0000 (04:39 +0000)]
lib/DBIx/Class/Schema/Loader/DBI/Sybase.pm
t/15sybase_common.t

index e45a946..995c561 100644 (file)
@@ -45,6 +45,12 @@ sub _rebless {
             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 @@ sub _table_uniq_info {
 
     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;
         }
     }
 
index 4995752..f0e5f4c 100644 (file)
@@ -8,7 +8,6 @@ my $password = $ENV{DBICTEST_SYBASE_PASS} || '';
 
 my $tester = dbixcsl_common_tests->new(
     vendor      => 'Sybase',
-    quote_char  => [qw/[ ]/],
     auto_inc_pk => 'INTEGER IDENTITY NOT NULL PRIMARY KEY',
     dsn         => $dsn,
     user        => $user,