From 2f5c5c180ebbeb6237039a02e1c18f68d97641d2 Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 7 Apr 2005 08:14:52 +0000 Subject: [PATCH] ask for "public" db schema only from Pg --- Changes | 3 +++ DBSchema.pm | 10 ++++++++-- DBSchema/DBD.pm | 23 ++++++++++++++++++++--- DBSchema/DBD/Pg.pm | 4 +++- 4 files changed, 34 insertions(+), 6 deletions(-) diff --git a/Changes b/Changes index e07b97b..4160b52 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,8 @@ Revision history for Perl extension DBIx::DBSchema. +0.26 Thu Apr 7 01:09:53 PDT 2005 + - ask for "public" db schema only from Pg + 0.25 Wed Apr 6 16:12:38 PDT 2005 - depend on DBD::Pg 1.32 or 1.41+ (1.40 was bunk) diff --git a/DBSchema.pm b/DBSchema.pm index 0e7b543..590cb9c 100644 --- a/DBSchema.pm +++ b/DBSchema.pm @@ -14,7 +14,7 @@ use DBIx::DBSchema::ColGroup::Index; #@ISA = qw(Exporter); @ISA = (); -$VERSION = "0.25"; +$VERSION = "0.26"; =head1 NAME @@ -324,7 +324,13 @@ sub _load_driver { sub _tables_from_dbh { my($dbh) = @_; - my $sth = $dbh->table_info or die $dbh->errstr; + my $driver = _load_driver($dbh); + my $db_catalog = + scalar(eval "DBIx::DBSchema::DBD::$driver->default_db_catalog"); + my $db_schema = + scalar(eval "DBIx::DBSchema::DBD::$driver->default_db_schema"); + my $sth = $dbh->table_info($db_catalog, $db_schema, '', 'TABLE') + or die $dbh->errstr; #map { $_->{TABLE_NAME} } grep { $_->{TABLE_TYPE} eq 'TABLE' } # @{ $sth->fetchall_arrayref({ TABLE_NAME=>1, TABLE_TYPE=>1}) }; map { $_->[0] } grep { $_->[1] =~ /^TABLE$/i } diff --git a/DBSchema/DBD.pm b/DBSchema/DBD.pm index a4c6000..019b3b1 100644 --- a/DBSchema/DBD.pm +++ b/DBSchema/DBD.pm @@ -3,7 +3,7 @@ package DBIx::DBSchema::DBD; use strict; use vars qw($VERSION); -$VERSION = '0.02'; +$VERSION = '0.03'; =head1 NAME @@ -67,6 +67,24 @@ The keys of the hashref are index names, and the values are arrayrefs which point a list of column names for each. See L and L. +=item default_db_catalog + +Returns the default database catalog for the DBI table_info command. +Inheriting from DBIx::DBSchema::DBD will provide the default empty string. + +=cut + +sub default_db_catalog { ''; } + +=item default_db_catalog + +Returns the default database schema for the DBI table_info command. +Inheriting from DBIx::DBSchema::DBD will provide the default empty string. + +=cut + +sub default_db_schema { ''; } + =back =head1 TYPE MAPPING @@ -93,8 +111,7 @@ Ivan Kohler =head1 COPYRIGHT -Copyright (c) 2000 Ivan Kohler -Copyright (c) 2000 Mail Abuse Prevention System LLC +Copyright (c) 2000-2005 Ivan Kohler All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/DBSchema/DBD/Pg.pm b/DBSchema/DBD/Pg.pm index 9e91e5e..3218a26 100644 --- a/DBSchema/DBD/Pg.pm +++ b/DBSchema/DBD/Pg.pm @@ -8,7 +8,7 @@ die "DBD::Pg version 1.32 or 1.41 (or later) required--". if $DBD::Pg::VERSION != 1.32 && $DBD::Pg::VERSION < 1.41; use DBIx::DBSchema::DBD; -$VERSION = '0.09'; +$VERSION = '0.10'; @ISA = qw(DBIx::DBSchema::DBD); %typemap = ( @@ -34,6 +34,8 @@ This module implements a PostgreSQL-native driver for DBIx::DBSchema. =cut +sub default_db_schema { 'public'; } + sub columns { my($proto, $dbh, $table) = @_; my $sth = $dbh->prepare(<errstr; -- 2.20.1