From: Brandon Black Date: Mon, 5 Jun 2006 23:17:12 +0000 (+0000) Subject: a few last minute fixes, and release for 0.03001 X-Git-Tag: 0.03001 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=4421d6a300ce7bdd33c1f9a7870b8a2ad2baef53;p=dbsrgits%2FDBIx-Class-Schema-Loader.git a few last minute fixes, and release for 0.03001 --- diff --git a/Changes b/Changes index 653ed6d..bc29ce5 100644 --- a/Changes +++ b/Changes @@ -1,6 +1,6 @@ Revision history for Perl extension DBIx::Class::Schema::Loader -0.03001 XXX not yet released +0.03001 Mon Jun 5 23:17:57 UTC 2006 - load_from_connection deprecation notice now mentions upgrading Catalyst::Model::DBIC::Schema if that module seems to be in use. diff --git a/lib/DBIx/Class/Schema/Loader/DBI/DB2.pm b/lib/DBIx/Class/Schema/Loader/DBI/DB2.pm index 18410e7..b10dcef 100644 --- a/lib/DBIx/Class/Schema/Loader/DBI/DB2.pm +++ b/lib/DBIx/Class/Schema/Loader/DBI/DB2.pm @@ -39,7 +39,7 @@ sub _table_uniq_info { FROM SYSCAT.TABCONST as tc JOIN SYSCAT.KEYCOLUSE as kcu ON tc.CONSTNAME = kcu.CONSTNAME WHERE tc.TABSCHEMA = ? and tc.TABNAME = ? and tc.TYPE = 'U'} - ); + ) or die $DBI::errstr; $sth->execute($self->db_schema, $table) or die $DBI::errstr; @@ -53,6 +53,7 @@ sub _table_uniq_info { @{$keydata{$keyname}}; push(@uniqs, [ $keyname => \@ordered_cols ]); } + $sth->finish; return \@uniqs; diff --git a/lib/DBIx/Class/Schema/Loader/DBI/mysql.pm b/lib/DBIx/Class/Schema/Loader/DBI/mysql.pm index 3767639..b83e2d5 100644 --- a/lib/DBIx/Class/Schema/Loader/DBI/mysql.pm +++ b/lib/DBIx/Class/Schema/Loader/DBI/mysql.pm @@ -30,15 +30,9 @@ sub _table_fk_info { my ($self, $table) = @_; my $dbh = $self->schema->storage->dbh; - my $sth = $dbh->prepare('SHOW CREATE TABLE ?'); - $sth->execute or die("Cannot get table definition for $table" - . " (execute failed): $DBI::errstr"); - - my $table_def_ref = $sth->fetchrow_arrayref - or die ("Cannot get table definition for $table (no rows)"); - + my $table_def_ref = $dbh->selectrow_arrayref("SHOW CREATE TABLE $table") + or die ("Cannot get table definition for $table"); my $table_def = $table_def_ref->[1] || ''; - $sth->finish; my (@reldata) = ($table_def =~ /CONSTRAINT `.*` FOREIGN KEY \(`(.*)`\) REFERENCES `(.*)` \(`(.*)`\)/ig);