Files
mytop/mytop_five_o.patch
Martin Pluskal b166aa6974 - Modernise spec file
- Do not use url for patch mytop_five_o.patch as its no longer
  accessible

OBS-URL: https://build.opensuse.org/package/show/server:database/mytop?expand=0&rev=17
2024-02-23 08:38:12 +00:00

43 lines
994 B
Diff

Index: mytop-1.6/mytop
===================================================================
--- mytop-1.6.orig/mytop
+++ mytop-1.6/mytop
@@ -262,18 +262,21 @@ ReadMode($RM_RESET) unless $config{batch
## Get static data
-my $db_version;
my $have_query_cache;
-my @variables = Hashes("show variables");
+my @ver = Hashes("select version() as ver");
+my $db_version = $ver[0]->{ver};
+my $global = '';
+
+if ($db_version =~ /^5/)
+{
+ $global = 'global';
+}
+
+my @variables = Hashes("show $global variables");
foreach (@variables)
{
- if ($_->{Variable_name} eq "version")
- {
- $db_version = $_->{Value};
- next;
- }
if ($_->{Variable_name} eq "have_query_cache")
{
if ($_->{Value} eq 'YES')
@@ -710,7 +713,7 @@ sub GetData()
##
if ($config{header})
{
- my @recs = Hashes("show status");
+ my @recs = Hashes("show $global status");
## if the server died or we lost connectivity
if (not @recs)