From e80ea87b4e3243d24fc962d497f1e44138078c51 Mon Sep 17 00:00:00 2001 From: Matt Phillips Date: Tue, 3 Sep 2013 12:21:45 -0400 Subject: [PATCH] Support for DBD::DB2 1.85 as well as < 1.85 IBM attempted to become compatible with the DBI spec with their latest release, but seem to have failed. This tweak fixes support for all versions of the DBD. --- Changes | 2 ++ lib/DBIx/Class/Schema/Loader/DBI/DB2.pm | 7 +++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Changes b/Changes index cc2dc0daf..8c05f85dc 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,7 @@ Revision history for Perl extension DBIx::Class::Schema::Loader + - Fix table listing with DBD::DB2 >= 1.85 (RT#91764) + 0.07038 2013-11-20 - Allow coderef maps to call back into the hashref mapping code - Fix MySQL column info detection with multiple schemas (RT#82358) diff --git a/lib/DBIx/Class/Schema/Loader/DBI/DB2.pm b/lib/DBIx/Class/Schema/Loader/DBI/DB2.pm index 328a34825..6d2c9ad3c 100644 --- a/lib/DBIx/Class/Schema/Loader/DBI/DB2.pm +++ b/lib/DBIx/Class/Schema/Loader/DBI/DB2.pm @@ -152,11 +152,14 @@ EOF } -# DBD::DB2 doesn't follow the DBI API for ->tables +# DBD::DB2 doesn't follow the DBI API for ->tables (pre 1.85), but since its +# backwards compatible we don't change it. +# DBD::DB2 1.85 and beyond default TABLE_NAME to '', previously defaulted to +# '%'. so we supply it. sub _dbh_tables { my ($self, $schema) = @_; - return $self->dbh->tables($schema ? { TABLE_SCHEM => $schema } : undef); + return $self->dbh->tables($schema ? { TABLE_SCHEM => $schema, TABLE_NAME => '%' } : undef); } sub _columns_info_for {