From: Justin Hunter Date: Sun, 12 Jul 2009 16:40:32 +0000 (-0700) Subject: track temporary tables X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=e3280be83bd5725598bd97aac0e23175e6345739;p=dbsrgits%2FSQL-Translator-2.0-ish.git track temporary tables --- diff --git a/lib/SQL/Translator/Parser/DBI.pm b/lib/SQL/Translator/Parser/DBI.pm index 43dd657..532c5fd 100644 --- a/lib/SQL/Translator/Parser/DBI.pm +++ b/lib/SQL/Translator/Parser/DBI.pm @@ -63,10 +63,11 @@ sub _add_tables { my $self = shift; my $schema = shift; - my $sth = $self->dbh->table_info($self->catalog_name, $self->schema_name, '%', 'TABLE,VIEW'); + my $sth = $self->dbh->table_info($self->catalog_name, $self->schema_name, '%', "TABLE,VIEW,'LOCAL TEMPORARY','GLOBAL TEMPORARY'"); while (my $table_info = $sth->fetchrow_hashref) { - if ($table_info->{TABLE_TYPE} eq 'TABLE') { - my $table = Table->new({ name => $table_info->{TABLE_NAME} }); + if ($table_info->{TABLE_TYPE} =~ /^(TABLE|LOCAL TEMPORARY|GLOBAL TEMPORARY)$/) { + my $temp = $table_info->{TABLE_TYPE} =~ /TEMPORARY$/ ? 1 : 0; + my $table = Table->new({ name => $table_info->{TABLE_NAME}, temporary => $temp }); $schema->add_table($table); $self->_add_columns($table); $self->_add_primary_key($table);