I've got the following bits of code
my $status_UPDATE = $dbh->prepare(<<END_SQL) || die("Can't prepare UPDATE: $DBI::errstr");
UPDATE orders_batches AS ob
INNER JOIN orders AS o
ON o.order_id = ob.order_id
SET o.status_id = ?
WHERE ob.batch_id = ?
END_SQL
which is called from
sub ChangeBatchStatus {
my $B = shift;
my $S = shift;
LogIt(DEBUG, "$proof ChangeBatchStatus => $B -> $S");
eval { $status_UPDATE->execute($S, $B) };
if ($@) {
LogIt(ERROR, "$proof Could not update status_id to <$S> for batch_id [$B] => $@");
LogIt(ERROR, "DBI::err: $DBI::err");
LogIt(ERROR, "DBI::errstr $DBI::errstr");
LogIt(ERROR, "DBI::state $DBI::state");
$dbh->rollback;
return 0;
}
$dbh->commit;
return 1;
}
99.9% of the time it properly handles the update where the batch contains up to 10,000 items.. the remaining 0.1% of the update returns
Err 1172 DBD::mysql::st execute failed: Result consisted of more than one row
Any thought or suggestions? I'm stumped.
Edited 1 time(s). Last edit at 09/12/2011 10:45AM by Mike Moran.