Version bumped to 0.03001
[dbsrgits/DBIx-Class-Schema-Loader.git] / lib / DBIx / Class / Schema / Loader / DBI / DB2.pm
index 5ec113f..18410e7 100644 (file)
@@ -34,14 +34,14 @@ sub _table_uniq_info {
 
     my $dbh = $self->schema->storage->dbh;
 
-    my $sth = $dbh->prepare(<<'SQL') or die;
-SELECT kcu.COLNAME, kcu.CONSTNAME, kcu.COLSEQ
-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'
-SQL
-
-    $sth->execute($self->db_schema, $table) or die;
+    my $sth = $self->{_cache}->{db2_uniq} ||= $dbh->prepare(
+        q{SELECT kcu.COLNAME, kcu.CONSTNAME, kcu.COLSEQ
+        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'}
+    );
+
+    $sth->execute($self->db_schema, $table) or die $DBI::errstr;
 
     my %keydata;
     while(my $row = $sth->fetchrow_arrayref) {