Skip to content

this patch allows us to extract DDL for materialized views for oracle #25

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion lib/DBIx/Class/Schema/Loader/DBI/Oracle.pm
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,17 @@ sub _dbh_tables {
return $self->dbh->tables(undef, $schema, '%', 'TABLE,VIEW');
}

sub _dbh_table_info {
my ($self, $dbh, $table) = @_;
my $info = $self->next::method($dbh, $table);
my ($is_mview) =
$self->dbh->selectrow_array('select name from all_registered_mviews where owner = ? and name = ?',
{}, $self->db_schema->[0], $table);
$info->{TABLE_TYPE} = 'VIEW' if $is_mview;
return $info;
}


sub _filter_tables {
my $self = shift;

Expand Down Expand Up @@ -416,11 +427,20 @@ sub _dbh_column_info {
sub _view_definition {
my ($self, $view) = @_;

return scalar $self->schema->storage->dbh->selectrow_array(<<'EOF', {}, $view->schema, $view->name);
my $viewdef = scalar $self->schema->storage->dbh->selectrow_array(<<'EOF', {}, $view->schema, $view->name);
SELECT text
FROM all_views
WHERE owner = ? AND view_name = ?
EOF

if (! $viewdef) {
$viewdef = scalar $self->schema->storage->dbh->selectrow_array(<<'EOF', {}, $view->schema, $view->name);
SELECT query_txt
FROM all_registered_mviews
WHERE owner = ? AND name = ?
EOF
}
return $viewdef;
}

=head1 SEE ALSO
Expand Down