Tweaked the report format, which now includes the number of INSERTs

This commit is contained in:
Brian Fraser
2012-11-06 14:22:56 -03:00
parent cb3fb74082
commit 74cd9233c3
3 changed files with 28 additions and 17 deletions

View File

@@ -8583,30 +8583,29 @@ sub main {
line_width => 74,
);
$report->set_columns(
{ name => 'Error Code', },
{ name => 'Event', },
{ name => 'Count', right_justify => 1 },
{ name => 'Type', right_justify => 1 },
);
$report->add_line(
"INSERTS",
$statistics{INSERTS},
);
foreach my $code (keys %{$statistics{ignored_code}}) {
next unless $statistics{ignored_code}->{$code};
$report->add_line(
$code,
"Error $code",
$statistics{ignored_code}->{$code},
"Ignorable",
)
}
my $warnings_seen;
foreach my $code (keys %{$statistics{warned_code}}) {
$report->add_line(
$code,
scalar @{$statistics{warned_code}->{$code}},
"Warning",
"Error $code",
$statistics{warned_code}->{$code},
);
$warnings_seen .= join "\n",
map { "# $_" }
@{$statistics{warned_code}->{$code}};
}
print $report->get_report();
@@ -9475,6 +9474,8 @@ sub exec_nibble {
);
my $t_end = time;
$statistics{INSERTS}++;
# ###################################################################
# End timing the query.
# ###################################################################
@@ -9508,8 +9509,7 @@ sub exec_nibble {
. "a total count will be shown if --statistics was "
. "specified.\n";
}
push @{ $statistics{warned_code}->{$code} ||= [] },
$sth->{nibble}->{Statement};
$statistics{warned_code}->{$code}++;
}
else {
# This die will propagate to fail which will return 0

View File

@@ -657,10 +657,11 @@ like(
like(
$output,
qr/\#\Q Error Code Count Type\E\s*
\#\Q ========== ===== =========\E\s*
\#\Q 1592 1 Ignorable\E\s*
\#\Q 1265 1 Warning\E\s*/x,
qr/\#\Q Event Count\E\s*
\#\Q ========== =====\E\s*
\#\Q INSERTS 1\E\s*
\#\Q Error 1592 1\E\s*
\#\Q Error 1265 1\E\s*/x,
"--statistics works as expected with 1 ignore & 1 warning"
);

View File

@@ -0,0 +1,10 @@
DROP DATABASE IF EXISTS bug_1045317;
CREATE DATABASE bug_1045317;
USE bug_1045317;
CREATE TABLE `bits` (
`id` int,
`val` ENUM('M','E','H') NOT NULL,
PRIMARY KEY (`id`)
);
INSERT INTO `bits` VALUES (1, 'M'), (2, 'E'), (3, 'H');