fix threads-connected mysql for old version
This commit is contained in:
parent
e6ccb8fe97
commit
d820b9319e
|
@ -85,15 +85,26 @@ sub manage_selection {
|
||||||
$self->{output}->option_exit();
|
$self->{output}->option_exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
my $infos = {};
|
||||||
|
if ($options{sql}->is_version_minimum(version => '5.1.12')) {
|
||||||
$options{sql}->query(query => q{
|
$options{sql}->query(query => q{
|
||||||
SELECT 'max_connections' as name, @@GLOBAL.max_connections as value
|
SELECT 'max_connections' as name, @@GLOBAL.max_connections as value
|
||||||
UNION
|
UNION
|
||||||
SELECT VARIABLE_NAME as name, VARIABLE_VALUE as value fROM information_schema.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Threads_connected'
|
SELECT VARIABLE_NAME as name, VARIABLE_VALUE as value FROM information_schema.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Threads_connected'
|
||||||
});
|
});
|
||||||
my $infos = {};
|
|
||||||
while (my ($name, $value) = $options{sql}->fetchrow_array()) {
|
while (my ($name, $value) = $options{sql}->fetchrow_array()) {
|
||||||
$infos->{lc($name)} = $value;
|
$infos->{lc($name)} = $value;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
$options{sql}->query(query => q{SELECT 'max_connections' as name, @@GLOBAL.max_connections as value});
|
||||||
|
if (my ($name, $value) = $options{sql}->fetchrow_array()) {
|
||||||
|
$infos->{lc($name)} = $value
|
||||||
|
}
|
||||||
|
$options{sql}->query(query => q{SHOW /*!50000 global */ STATUS LIKE 'Threads_connected'});
|
||||||
|
if (my ($name, $value) = $options{sql}->fetchrow_array()) {
|
||||||
|
$infos->{lc($name)} = $value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (scalar(keys %$infos) == 0) {
|
if (scalar(keys %$infos) == 0) {
|
||||||
$self->{output}->add_option_msg(short_msg => "Cannot get number of open connections.");
|
$self->{output}->add_option_msg(short_msg => "Cannot get number of open connections.");
|
||||||
|
|
Loading…
Reference in New Issue