tw: use transaction for delete
Signed-off-by: Varun Patil <radialapps@gmail.com>pull/653/head
parent
ad5a75b2f6
commit
fe8fb6b164
|
@ -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();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue