From: Rafael Kitover Date: Fri, 26 Mar 2010 22:09:49 +0000 (-0400) Subject: wrap sp_fkeys in an eval for MSSQL X-Git-Tag: 0.06000~26 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=a3e05a4be92a3d075badcb80a614b687f63d4170;p=dbsrgits%2FDBIx-Class-Schema-Loader.git wrap sp_fkeys in an eval for MSSQL --- diff --git a/lib/DBIx/Class/Schema/Loader/DBI/MSSQL.pm b/lib/DBIx/Class/Schema/Loader/DBI/MSSQL.pm index 1023ebd..467cffb 100644 --- a/lib/DBIx/Class/Schema/Loader/DBI/MSSQL.pm +++ b/lib/DBIx/Class/Schema/Loader/DBI/MSSQL.pm @@ -59,12 +59,14 @@ sub _table_pk_info { sub _table_fk_info { my ($self, $table) = @_; - my ($local_cols, $remote_cols, $remote_table, @rels); + my ($local_cols, $remote_cols, $remote_table, @rels, $sth); my $dbh = $self->schema->storage->dbh; - my $sth = $dbh->prepare(qq{sp_fkeys \@FKTABLE_NAME = '$table'}); - $sth->execute; + eval { + $sth = $dbh->prepare(qq{sp_fkeys \@FKTABLE_NAME = '$table'}); + $sth->execute; + }; - while (my $row = $sth->fetchrow_hashref) { + while (my $row = eval { $sth->fetchrow_hashref }) { my $fk = $row->{FK_NAME}; push @{$local_cols->{$fk}}, lc $row->{FKCOLUMN_NAME}; push @{$remote_cols->{$fk}}, lc $row->{PKCOLUMN_NAME};