[Bast-commits] r8479 - in branches/DBIx-Class-Schema-Loader/current:
lib/DBIx/Class/Schema/Loader/DBI t
caelum at dev.catalyst.perl.org
caelum at dev.catalyst.perl.org
Sat Jan 30 23:25:47 GMT 2010
Author: caelum
Date: 2010-01-30 23:25:47 +0000 (Sat, 30 Jan 2010)
New Revision: 8479
Modified:
branches/DBIx-Class-Schema-Loader/current/lib/DBIx/Class/Schema/Loader/DBI/Sybase.pm
branches/DBIx-Class-Schema-Loader/current/t/15sybase_common.t
Log:
set data_type to undef for Sybase computed columns
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 2010-01-30 22:24:55 UTC (rev 8478)
+++ branches/DBIx-Class-Schema-Loader/current/lib/DBIx/Class/Schema/Loader/DBI/Sybase.pm 2010-01-30 23:25:47 UTC (rev 8479)
@@ -229,6 +229,31 @@
return \@uniqs;
}
+# set data_type to 'undef' for computed columns
+sub _columns_info_for {
+ my $self = shift;
+ my ($table) = @_;
+ my $result = $self->next::method(@_);
+
+ my $dbh = $self->schema->storage->dbh;
+ my $sth = $dbh->prepare(qq{
+SELECT c.name name, c.computedcol computedcol
+FROM syscolumns c
+JOIN sysobjects o ON c.id = o.id
+WHERE o.name = @{[ $dbh->quote($table) ]} AND o.type = 'U'
+});
+ $sth->execute;
+ local $dbh->{FetchHashKeyName} = 'NAME_lc';
+ my $computed_info = $sth->fetchall_hashref('name');
+
+ for my $col (keys %$result) {
+ $result->{$col}{data_type} = undef
+ if $computed_info->{$col}{computedcol};
+ }
+
+ return $result;
+}
+
sub _extra_column_info {
my ($self, $info) = @_;
my %extra_info;
Modified: branches/DBIx-Class-Schema-Loader/current/t/15sybase_common.t
===================================================================
--- branches/DBIx-Class-Schema-Loader/current/t/15sybase_common.t 2010-01-30 22:24:55 UTC (rev 8478)
+++ branches/DBIx-Class-Schema-Loader/current/t/15sybase_common.t 2010-01-30 23:25:47 UTC (rev 8479)
@@ -64,16 +64,12 @@
10,
'VARCHAR(10) has correct size';
- {
- local $TODO = 'data_type for computed columns';
-
- ok ((exists $rsrc->column_info('computed_dt')->{data_type}
- && (not defined $rsrc->column_info('computed_dt')->{data_type})),
- 'data_type for computed column exists and is undef')
-# or diag "Data type is: ",
-# $rsrc->column_info('computed_dt')->{data_type}
- ;
- }
+ ok ((exists $rsrc->column_info('computed_dt')->{data_type}
+ && (not defined $rsrc->column_info('computed_dt')->{data_type})),
+ 'data_type for computed column exists and is undef')
+ or diag "Data type is: ",
+ $rsrc->column_info('computed_dt')->{data_type}
+ ;
},
},
);
More information about the Bast-commits
mailing list