Print/save fk errors only if there is one. Fix example --dest table (bug 1075775).

This commit is contained in:
Daniel Nichter
2012-11-07 11:38:09 -07:00
parent e11a7eea41
commit 091d9cf66d
2 changed files with 16 additions and 13 deletions

View File

@@ -3534,7 +3534,9 @@ sub main {
{ {
my $text = $dbh->selectrow_hashref("SHOW /*!40100 ENGINE*/ INNODB STATUS")->{Status}; my $text = $dbh->selectrow_hashref("SHOW /*!40100 ENGINE*/ INNODB STATUS")->{Status};
my ($ts, $fk_error) = get_fk_error($text); my ($ts, $fk_error) = get_fk_error($text);
PTDEBUG && _d('ts:', $ts, 'fk error:', $fk_error);
if ( $ts && $fk_error ) {
# Save and/or print the foreign key error. # Save and/or print the foreign key error.
if ( $ins_sth ) { if ( $ins_sth ) {
my $fk_ts = parse_timestamp($ts); my $fk_ts = parse_timestamp($ts);
@@ -3548,6 +3550,7 @@ sub main {
} }
} }
print "$ts $fk_error\n\n" if $o->get('print') || !$o->got('dest'); print "$ts $fk_error\n\n" if $o->get('print') || !$o->got('dest');
}
# If there's an --interval argument, run forever or till specified. # If there's an --interval argument, run forever or till specified.
# Otherwise just run once. # Otherwise just run once.
@@ -3727,7 +3730,7 @@ The following table is suggested:
CREATE TABLE foreign_key_errors ( CREATE TABLE foreign_key_errors (
ts datetime NOT NULL, ts datetime NOT NULL,
error text NOT NULL, error text NOT NULL,
PRIMARY KEY (ts), PRIMARY KEY (ts)
) )
The only information saved is the timestamp and the foreign key error text. The only information saved is the timestamp and the foreign key error text.

View File

@@ -136,7 +136,7 @@ $output = output(
is( is(
$output, $output,
"", "",
"No foreign key errors, no errors and no output (bug 1075773)" "No foreign key errors, no errors, no output (bug 1075773)"
); );
diag(`$trunk/sandbox/stop-sandbox 12348 >/dev/null`); diag(`$trunk/sandbox/stop-sandbox 12348 >/dev/null`);