From: Ivan Kohler Date: Sun, 1 Oct 2017 19:32:48 +0000 (-0700) Subject: fix table fetching for Sybase and SQLite drivers, patch from Nathan Anderson --- diff --git a/Changes b/Changes index 02ffdcb..e16d098 100644 --- a/Changes +++ b/Changes @@ -2,9 +2,9 @@ Revision history for Perl module DBIx::DBSchema 0.46 unreleased - Add IF EXISTS to DROP INDEX (except under MySQL) - - Refactor table fetching into a driver-overridable - DBIx::DBSchema::DBD->tables method, patch from Nathan Anderson - + - Fix table fetching for Sybase and SQLite drivers; refactor table fetching + into a driver-overridable DBIx::DBSchema::DBD->tables method, patches + from Nathan Anderson 0.45 Wed May 6 22:17:33 PDT 2015 - MySQL does not support DEFAULT for TEXT/BLOB columns, closes: CPAN#58505 diff --git a/DBSchema.pm b/DBSchema.pm index 7ba1921..afd0310 100644 --- a/DBSchema.pm +++ b/DBSchema.pm @@ -8,7 +8,7 @@ use DBIx::DBSchema::Index; use DBIx::DBSchema::Column; use DBIx::DBSchema::ForeignKey; -our $VERSION = '0.46_02'; +our $VERSION = '0.46_03'; $VERSION = eval $VERSION; # modperlstyle: convert the string into a number our $DEBUG = 0; diff --git a/DBSchema/DBD/SQLite.pm b/DBSchema/DBD/SQLite.pm index 6cfb017..c810421 100644 --- a/DBSchema/DBD/SQLite.pm +++ b/DBSchema/DBD/SQLite.pm @@ -4,7 +4,7 @@ use base qw( DBIx::DBSchema::DBD ); use strict; use vars qw($VERSION %typemap); -$VERSION = '0.03'; +$VERSION = '0.04'; %typemap = ( 'SERIAL' => 'INTEGER PRIMARY KEY AUTOINCREMENT', @@ -26,10 +26,12 @@ $schema = new_native DBIx::DBSchema $dbh; This module implements a SQLite-native driver for DBIx::DBSchema. -=head1 AUTHOR +=head1 AUTHORS Jesse Vincent +Nathan Anderson + =cut =head1 API @@ -186,6 +188,19 @@ while ( my $row = $sth->fetchrow_hashref ) { } +sub default_db_schema { '%'; } + +sub tables { + my($proto, $dbh) = @_; + my $db_catalog = $proto->default_db_catalog; + my $db_schema = $proto->default_db_schema; + + my $sth = $dbh->table_info($db_catalog, $db_schema, '%', 'TABLE') + or die $dbh->errstr; + + $proto->SUPER::tables($dbh, $sth); +} + =pod =back diff --git a/DBSchema/DBD/Sybase.pm b/DBSchema/DBD/Sybase.pm index 4a74069..f004262 100755 --- a/DBSchema/DBD/Sybase.pm +++ b/DBSchema/DBD/Sybase.pm @@ -4,7 +4,7 @@ use strict; use vars qw($VERSION @ISA %typemap); use DBIx::DBSchema::DBD; -$VERSION = '0.03'; +$VERSION = '0.04'; @ISA = qw(DBIx::DBSchema::DBD); %typemap = ( @@ -108,6 +108,16 @@ sub _is_unique { return $isunique; } +sub tables { + my($proto, $dbh) = @_; + + my $sth = $dbh->prepare("sp_tables NULL, NULL, NULL, \"'TABLE'\""); + $sth->execute + or die $dbh->errstr; + + $proto->SUPER::tables($dbh, $sth); +} + =head1 AUTHOR Charles Shapiro @@ -117,6 +127,8 @@ Mitchell Friedman Bernd Dulfer +Nathan Anderson + =head1 COPYRIGHT Copyright (c) 2001 Charles Shapiro, Mitchell J. Friedman