don't set result_namespace if it's 'Result'
[dbsrgits/DBIx-Class-Schema-Loader.git] / lib / DBIx / Class / Schema / Loader / DBI / SQLite.pm
index aadaf57..b9dd3c3 100644 (file)
@@ -10,7 +10,7 @@ use Carp::Clan qw/^DBIx::Class/;
 use Text::Balanced qw( extract_bracketed );
 use Class::C3;
 
-our $VERSION = '0.05003';
+our $VERSION = '0.06000';
 
 =head1 NAME
 
@@ -50,22 +50,20 @@ sub rescan {
 }
 
 sub _extra_column_info {
-    my ($self, $table, $col_name, $sth, $col_num) = @_;
-    ($table, $col_name) = @{$table}{qw/TABLE_NAME COLUMN_NAME/} if ref $table;
+    my ($self, $table, $col_name, $info, $dbi_info) = @_;
     my %extra_info;
 
     my $dbh = $self->schema->storage->dbh;
-    my $get_seq;
-    eval {
-      $get_seq = $self->{_cache}->{sqlite_sequence}
+    my $has_autoinc = eval {
+      my $get_seq = $self->{_cache}{sqlite_sequence}
         ||= $dbh->prepare(q{SELECT count(*) FROM sqlite_sequence WHERE name = ?});
       $get_seq->execute($table);
+      my ($ret) = $get_seq->fetchrow_array;
+      $get_seq->finish;
+      $ret;
     };
-    return {} if $@;
-    my ($has_autoinc) = $get_seq->fetchrow_array;
-    $get_seq->finish;
 
-    if ($has_autoinc) {
+    if (!$@ && $has_autoinc) {
         my $sth = $dbh->prepare(
             "pragma table_info(" . $dbh->quote_identifier($table) . ")"
         );
@@ -134,19 +132,19 @@ sub _table_uniq_info {
 }
 
 sub _tables_list {
-    my $self = shift;
+    my ($self, $opts) = @_;
 
     my $dbh = $self->schema->storage->dbh;
     my $sth = $dbh->prepare("SELECT * FROM sqlite_master");
     $sth->execute;
     my @tables;
     while ( my $row = $sth->fetchrow_hashref ) {
-        next unless lc( $row->{type} ) eq 'table';
+        next unless $row->{type} =~ /^(?:table|view)\z/i;
         next if $row->{tbl_name} =~ /^sqlite_/;
         push @tables, $row->{tbl_name};
     }
     $sth->finish;
-    return @tables;
+    return $self->_filter_tables(\@tables, $opts);
 }
 
 =head1 SEE ALSO