X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FSchema%2FLoader%2FDBI%2FSybase.pm;h=c1cef54f18af6c9851bbd115fbd405e7c1c7f4bb;hb=db4d62ad76d4158da4d2de5228f63435459c4509;hp=e6643d6da8a8c469612367095d3a8b8a7e11f3a8;hpb=de82711a0abb69a8f67fc81e5e27f627d7053bf2;p=dbsrgits%2FDBIx-Class-Schema-Loader.git diff --git a/lib/DBIx/Class/Schema/Loader/DBI/Sybase.pm b/lib/DBIx/Class/Schema/Loader/DBI/Sybase.pm index e6643d6..c1cef54 100644 --- a/lib/DBIx/Class/Schema/Loader/DBI/Sybase.pm +++ b/lib/DBIx/Class/Schema/Loader/DBI/Sybase.pm @@ -229,6 +229,31 @@ sub _table_uniq_info { 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;