my $callback = shift;
my @views = fetch_views($schema);
+ if (scalar @views == 0) {
+ return;
+ }
+
+ print "SELECT views_are(\n";
+ print "\t" . $dbh->quote($schema) . ",\n";
+ print "\tARRAY[\n\t\t";
+ print join(
+ ",\n\t\t",
+ map { $dbh->quote($_) } @views
+ );
+ print "\n\t],\t" . $dbh->quote("Found expected views for schema $schema");
+ print "\n);\n";
+
foreach my $view ( @views ) {
print "\n-- -- view " . $dbh->quote("$schema.$view") . "\n\n";
- print "SELECT has_view(\n";
- print "\t" . $dbh->quote($schema) . ",\n";
- print "\t" . $dbh->quote($view) . ",\n";
- print "\t" . $dbh->quote("Has view $schema.$view") . "\n);\n";
$callback->($schema,$view) if $callback;
}
}