tw: use transaction for delete

Signed-off-by: Varun Patil <radialapps@gmail.com>
pull/653/head
Varun Patil 2023-04-24 16:58:34 -07:00
parent ad5a75b2f6
commit fe8fb6b164
1 changed files with 6 additions and 0 deletions

View File

@ -192,6 +192,9 @@ class TimelineWrite
; ;
$record = $query->executeQuery()->fetch(); $record = $query->executeQuery()->fetch();
// Begin transaction
$this->connection->beginTransaction();
// Delete all records regardless of existence // Delete all records regardless of existence
foreach (DELETE_TABLES as $table) { foreach (DELETE_TABLES as $table) {
$query = $this->connection->getQueryBuilder(); $query = $this->connection->getQueryBuilder();
@ -205,6 +208,9 @@ class TimelineWrite
if ($record && ($cid = (int) $record['mapcluster']) > 0) { if ($record && ($cid = (int) $record['mapcluster']) > 0) {
$this->mapRemoveFromCluster($cid, (float) $record['lat'], (float) $record['lon']); $this->mapRemoveFromCluster($cid, (float) $record['lat'], (float) $record['lon']);
} }
// Commit transaction
$this->connection->commit();
} }
/** /**