From: Dagfinn Ilmari Mannsåker Date: Tue, 19 Aug 2014 17:31:03 +0000 (+0100) Subject: Use undef instead of '%' fore the table and type arguments to $dbh->tables X-Git-Tag: 0.07042~3 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=36c8c37c10fbb9a3f6578a8df14cd6cde1bb774f;hp=7c304e590cd0eac21aed4c62266e43129d6ff9ce;p=dbsrgits%2FDBIx-Class-Schema-Loader.git Use undef instead of '%' fore the table and type arguments to $dbh->tables Neither the DBI documentation nor the ODBC specification allow '%' for the type, but some DBDs do (or did, DBD::Pg 3.4.0 no longer does) allow it. For the ones that didn't, the loader subclass used override ->_tables_list to pass undef explicitly. Instead, use undef in the default implementation, but allow subclasses to override as needed (none currently do). Also change the table argument to default to undef, since that's equivalent according to the spec and all the DBDs I've tested with or looked at (SQLite, MySQL, Pg, Oracle, FireBird, ODBC, InterBase). --- diff --git a/Changes b/Changes index 7f6066b..4b29d53 100644 --- a/Changes +++ b/Changes @@ -1,6 +1,8 @@ Revision history for Perl extension DBIx::Class::Schema::Loader - Fix unescaped left braces in regexes in tests + - Use undef instead of '%' fore the table and type arguments + to $dbh->tables (fixes breakage with DBD::Pg 3.4.0) 0.07041 2014-08-09 - Fix many_to_many bridges going back to the same table diff --git a/lib/DBIx/Class/Schema/Loader/DBI.pm b/lib/DBIx/Class/Schema/Loader/DBI.pm index 9e4e03a..3a399e3 100644 --- a/lib/DBIx/Class/Schema/Loader/DBI.pm +++ b/lib/DBIx/Class/Schema/Loader/DBI.pm @@ -108,11 +108,9 @@ sub _system_tables { } sub _dbh_tables { - my ($self, $schema) = (shift, shift); - - my ($table_pattern, $table_type_pattern) = @_ ? @_ : ('%', '%'); + my $self = shift; - return $self->dbh->tables(undef, $schema, $table_pattern, $table_type_pattern); + return $self->dbh->tables(undef, @_); } # default to be overridden in subclasses if necessary diff --git a/lib/DBIx/Class/Schema/Loader/DBI/ADO.pm b/lib/DBIx/Class/Schema/Loader/DBI/ADO.pm index e531865..c6898ed 100644 --- a/lib/DBIx/Class/Schema/Loader/DBI/ADO.pm +++ b/lib/DBIx/Class/Schema/Loader/DBI/ADO.pm @@ -37,12 +37,6 @@ sub _rebless { } } -sub _tables_list { - my ($self, $opts) = @_; - - return $self->next::method($opts, undef, undef); -} - sub _filter_tables { my $self = shift; diff --git a/lib/DBIx/Class/Schema/Loader/DBI/ODBC.pm b/lib/DBIx/Class/Schema/Loader/DBI/ODBC.pm index cdee92e..0858b5b 100644 --- a/lib/DBIx/Class/Schema/Loader/DBI/ODBC.pm +++ b/lib/DBIx/Class/Schema/Loader/DBI/ODBC.pm @@ -40,12 +40,6 @@ sub _rebless { } } -sub _tables_list { - my ($self, $opts) = @_; - - return $self->next::method($opts, undef, undef); -} - =head1 SEE ALSO L, diff --git a/lib/DBIx/Class/Schema/Loader/DBI/mysql.pm b/lib/DBIx/Class/Schema/Loader/DBI/mysql.pm index 12410bd..e7e49a6 100644 --- a/lib/DBIx/Class/Schema/Loader/DBI/mysql.pm +++ b/lib/DBIx/Class/Schema/Loader/DBI/mysql.pm @@ -66,12 +66,6 @@ sub _system_schemas { return ($self->next::method(@_), 'mysql'); } -sub _tables_list { - my ($self, $opts) = @_; - - return $self->next::method($opts, undef, undef); -} - sub _table_fk_info { my ($self, $table) = @_;