fix table fetching for Sybase and SQLite drivers, patch from Nathan Anderson <http...
authorIvan Kohler <ivan@freeside.biz>
Sun, 1 Oct 2017 19:32:48 +0000 (12:32 -0700)
committerIvan Kohler <ivan@freeside.biz>
Sun, 1 Oct 2017 19:32:48 +0000 (12:32 -0700)
Changes
DBSchema.pm
DBSchema/DBD/SQLite.pm
DBSchema/DBD/Sybase.pm

diff --git a/Changes b/Changes
index 02ffdcb..e16d098 100644 (file)
--- 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
-      <http://1id.com/=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 <http://1id.com/=nathan.anderson>
 
 0.45 Wed May  6 22:17:33 PDT 2015
     - MySQL does not support DEFAULT for TEXT/BLOB columns, closes: CPAN#58505
index 7ba1921..afd0310 100644 (file)
@@ -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;
index 6cfb017..c810421 100644 (file)
@@ -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 <jesse@bestpractical.com>
 
+Nathan Anderson <http://1id.com/=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
index 4a74069..f004262 100755 (executable)
@@ -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 <charles.shapiro@numethods.com>
@@ -117,6 +127,8 @@ Mitchell Friedman <mitchell.friedman@numethods.com>
 
 Bernd Dulfer <bernd@widd.de>
 
+Nathan Anderson <http://1id.com/=nathan.anderson>
+
 =head1 COPYRIGHT
 
 Copyright (c) 2001 Charles Shapiro, Mitchell J. Friedman