--- mytop.sh 2012-03-15 00:29:20.000000000 +0100 +++ mytop.sh 2012-03-16 00:53:10.418317632 +0100 @@ -95,7 +95,8 @@ slow => 10, # slow query time socket => '', sort => 0, # default or reverse sort ("s") - user => 'root' + user => 'root', + fullqueries => 0 ); my %qcache = (); ## The query cache--used for full query info support. @@ -160,7 +161,8 @@ "long_nums!" => \$config{long_nums}, "mode|m=s" => \$config{mode}, "slow=i" => \$config{slow}, - "sort=s" => \$config{sort} + "sort=s" => \$config{sort}, + "fullqueries|L!" => \$config{fullqueries} ); ## User may have put the port with the host. @@ -744,6 +746,25 @@ { $config{mode} = 'status'; } + + ## L - full queries toggle + + if ($key eq 'L') + { + if ($config{fullqueries}) + { + $config{fullqueries} = 0; + print RED(), "-- full queries OFF --", RESET(); + sleep 1; + } + else + { + $config{fullqueries} = 1; + print RED(), "-- full queries ON --", RESET(); + sleep 1; + } + } + } ReadMode($RM_RESET) unless $config{batchmode}; @@ -1115,7 +1136,13 @@ my $state= $width <= 80 ? 6 : int(min(6+($width-80)/3, 15)); my $free = $width - $used - ($state - 6); my $format= "%9s %8s %15s %9s %6s %5s %6s %${state}s %-.${free}s\n"; - my $format2= "%9d %8.8s %15.15s %9.9s %6d %5.1f %6.6s %${state}.${state}s %-${free}.${free}s\n"; + my $format2; + if ($config{fullqueries}) + { + $format2 = "%9d %8.8s %15.15s %9.9s %6d %5.1f %6.6s %${state}.${state}s %-${free}s\n"; + } else { + $format2 = "%9d %8.8s %15.15s %9.9s %6d %5.1f %6.6s %${state}.${state}s %-${free}.${free}s\n"; + } print BOLD() if ($HAS_COLOR); printf $format, @@ -1244,7 +1271,12 @@ if ($thread->{Info}) { - $smInfo = substr $thread->{Info}, 0, $free; + if ($config{fullqueries}) + { + $smInfo = $thread->{Info}; + } else { + $smInfo = substr $thread->{Info}, 0, $free; + } } # if ($thread->{State}) # { @@ -1690,6 +1722,7 @@ u - show only a specific user V - show variablesi : - enter a command (not yet implemented) + L - show full queries (do not strip to terminal width) Base version from ${GREEN}http://www.mysqlfanboy.com/mytop${RESET} This version comes as part of the ${GREEN}MariaDB${RESET} distribution.