From: Jason Etheridge Date: Wed, 24 Jul 2013 20:14:43 +0000 (-0400) Subject: better view membership test X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=7472c75bfdee4616196882f822d38f48bfa1040a;p=working%2FEvergreen.git better view membership test Signed-off-by: Jason Etheridge --- diff --git a/Open-ILS/src/sql/Pg/make-pgtap-tests.pl b/Open-ILS/src/sql/Pg/make-pgtap-tests.pl index cd1ef8692e..a6ec7846d8 100755 --- a/Open-ILS/src/sql/Pg/make-pgtap-tests.pl +++ b/Open-ILS/src/sql/Pg/make-pgtap-tests.pl @@ -217,12 +217,22 @@ sub handle_views { 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; } }