More refactor

Signed-off-by: Varun Patil <varunpatil@ucla.edu>
pull/563/head
Varun Patil 2023-03-23 18:12:39 -07:00
parent df9bd84c92
commit f1461b720c
4 changed files with 9 additions and 13 deletions

View File

@ -16,10 +16,7 @@ trait TimelineQueryLivePhoto
$qb->expr()->eq('lp.liveid', 'm.liveid'),
))
;
$result = $qb->executeQuery();
$row = $result->fetch();
$result->closeCursor();
return $row;
return $qb->executeQuery()->fetch();
}
}

View File

@ -62,9 +62,7 @@ trait TimelineQueryMap
$this->transformMapBoundsFilter($query, false, $bounds, 'c');
// Execute query
$cursor = $this->executeQueryWithCTEs($query);
$res = $cursor->fetchAll();
$cursor->closeCursor();
$res = $this->executeQueryWithCTEs($query)->fetchAll();
// Post-process results
$clusters = [];

View File

@ -40,9 +40,7 @@ trait TimelineQuerySingleItem
$qb->addSelect('exif');
}
$result = $qb->executeQuery();
$row = $result->fetch();
$result->closeCursor();
$row = $qb->executeQuery()->fetch();
$utcTs = 0;

View File

@ -65,10 +65,11 @@ trait TimelineWritePlaces
$sql = str_replace('*PREFIX*memories_planet_geometry', 'memories_planet_geometry', $query->getSQL());
// Run query
$result = $this->connection->executeQuery($sql);
$rows = $result->fetchAll();
$rows = $this->connection->executeQuery($sql)->fetchAll();
// Insert records in transaction
$this->connection->beginTransaction();
// Insert records
foreach ($rows as $row) {
$query = $this->connection->getQueryBuilder();
$query->insert('memories_places')
@ -79,5 +80,7 @@ trait TimelineWritePlaces
;
$query->executeStatement();
}
$this->connection->commit();
}
}