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

caelum at dev.catalyst.perl.org caelum at dev.catalyst.perl.org
Sat Oct 31 11:19:25 GMT 2009


Author: caelum
Date: 2009-10-31 11:19:24 +0000 (Sat, 31 Oct 2009)
New Revision: 7825

Modified:
   branches/DBIx-Class-Schema-Loader/current/lib/DBIx/Class/Schema/Loader/DBI/MSSQL.pm
   branches/DBIx-Class-Schema-Loader/current/t/lib/dbixcsl_mssql_extra_tests.pm
Log:
fix data_type for identities in MSSQL RT#50523

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-10-29 22:17:28 UTC (rev 7824)
+++ branches/DBIx-Class-Schema-Loader/current/lib/DBIx/Class/Schema/Loader/DBI/MSSQL.pm	2009-10-31 11:19:24 UTC (rev 7825)
@@ -38,6 +38,18 @@
     $self->_set_quote_char_and_name_sep;
 }
 
+# remove 'IDENTITY' from column data_type
+sub _columns_info_for {
+    my $self   = shift;
+    my $result = $self->next::method(@_);
+
+    for my $col (keys %$result) {
+        $result->{$col}->{data_type} =~ s/\s* identity \s*//ix;
+    }
+
+    return $result;
+}
+
 sub _table_pk_info {
     my ($self, $table) = @_;
     my $dbh = $self->schema->storage->dbh;

Modified: branches/DBIx-Class-Schema-Loader/current/t/lib/dbixcsl_mssql_extra_tests.pm
===================================================================
--- branches/DBIx-Class-Schema-Loader/current/t/lib/dbixcsl_mssql_extra_tests.pm	2009-10-29 22:17:28 UTC (rev 7824)
+++ branches/DBIx-Class-Schema-Loader/current/t/lib/dbixcsl_mssql_extra_tests.pm	2009-10-31 11:19:24 UTC (rev 7825)
@@ -19,10 +19,11 @@
         },
     ],
     drop   => [ "[${vendor}_loader_test1.dot]" ],
-    count  => 4,
+    count  => 6,
     run    => sub {
         my ($schema, $monikers, $classes) = @_;
 
+# Test that the table above (with '.' in name) gets loaded correctly.
         my $vendor_titlecased = "\u\L$vendor";
 
         ok((my $rs = eval {
@@ -36,6 +37,17 @@
 
         is eval { $$from }, "[${vendor}_loader_test1.dot]",
             '->table name is correct';
+
+# Test that identity columns do not have 'identity' in the data_type, and do
+# have is_auto_increment.
+        my $identity_col_info = $schema->resultset('LoaderTest10')
+            ->result_source->column_info('id10');
+
+        is $identity_col_info->{data_type}, 'int',
+            q{'INT IDENTITY' column has data_type => 'int'};
+
+        is $identity_col_info->{is_auto_increment}, 1,
+            q{'INT IDENTITY' column has is_auto_increment => 1};
     },
 }}
 




More information about the Bast-commits mailing list