fix postgres databasesize mode, missing empty selection (#1047)

This commit is contained in:
Colin Gagnaire 2018-07-12 11:07:26 +02:00 committed by GitHub
parent 3803de2aa7
commit 97672a5339
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 0 deletions

View File

@ -79,6 +79,8 @@ sub manage_selection {
my $result = $self->{sql}->fetchall_arrayref();
$self->{databases} = {};
foreach my $row (@$result) {
next if (defined($self->{option_results}->{filter_database}) && $self->{option_results}->{filter_database} ne ''
&& $$row[0] !~ /$self->{option_results}->{filter_database}/);
@ -86,6 +88,11 @@ sub manage_selection {
$self->{databases}->{$$row[0]}->{display} = $$row[0];
$self->{databases}->{$$row[0]}->{size} = $$row[1];
}
if (scalar(keys %{$self->{databases}}) <= 0) {
$self->{output}->add_option_msg(short_msg => 'No databases found');
$self->{output}->option_exit();
}
}
1;