+ add option for empty sql result in sql-string mode
This commit is contained in:
parent
8c0327eb66
commit
067f3a2717
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue