+ add option for empty sql result in sql-string mode

This commit is contained in:
garnier-quentin 2019-04-25 17:35:11 +02:00
parent 8c0327eb66
commit 067f3a2717
1 changed files with 7 additions and 1 deletions

View File

@ -115,6 +115,7 @@ sub new {
"printf-format:s" => { name => 'printf_format' },
"printf-value:s" => { name => 'printf_value' },
"dual-table" => { name => 'dual_table' },
"empty-sql-string:s" => { name => 'empty_sql_string', default => 'No row returned or --key-column/--value-column do not correctly match selected field' },
});
return $self;
@ -159,7 +160,7 @@ sub manage_selection {
}
if (scalar(keys %{$self->{rows}}) <= 0) {
$self->{output}->add_option_msg(short_msg => "No row returned or --key-column/--value-column do not correctly match selected field");
$self->{output}->add_option_msg(short_msg => $self->{option_results}->{empty_sql_string});
$self->{output}->option_exit();
}
@ -211,6 +212,11 @@ Set critical condition (if statement syntax) for status evaluation.
Set this option to ensure compatibility with dual table and Oracle.
=item B<--empty-sql-string>
Set this option to change the output message when the sql statement result is empty.
(Default: 'No row returned or --key-column/--value-column do not correctly match selected field')
=back
=cut