Add locking and unlocking for warranty serial queue table when deleting an entry. #708

This commit is contained in:
Korina Cordero 2022-09-28 06:19:41 +00:00
parent 21231358d6
commit 815c25a894

View file

@ -392,12 +392,18 @@ class LoadWarrantySerialCommand extends Command
{ {
// prepared statement // prepared statement
$db = $this->em->getConnection(); $db = $this->em->getConnection();
// lock the warranty serial queue table
$db->exec('LOCK TABLES warranty_serial_queue WRITE;');
$delete_stmt = $db->prepare('DELETE FROM warranty_serial_queue $delete_stmt = $db->prepare('DELETE FROM warranty_serial_queue
WHERE id = :id'); WHERE id = :id');
$res = $delete_stmt->execute([ $res = $delete_stmt->execute([
':id' => $id, ':id' => $id,
]); ]);
$db->exec('UNLOCK TABLES;');
} }
protected function setOutputInfo($filename, $file_id, $has_error, $error_message, $entries, $orig_filename) protected function setOutputInfo($filename, $file_id, $has_error, $error_message, $entries, $orig_filename)