Modify updating of rider table. #762
This commit is contained in:
parent
b66c809b01
commit
ce39e66127
1 changed files with 10 additions and 14 deletions
|
|
@ -850,23 +850,19 @@ class GetJobOrderArchiveDataCommand extends Command
|
||||||
|
|
||||||
protected function updateRiderJobOrders($jo_id_list)
|
protected function updateRiderJobOrders($jo_id_list)
|
||||||
{
|
{
|
||||||
// TODO: memory exception while updating rider table.
|
// TODO: test this
|
||||||
// need to figure out how to make this not run out of memory.
|
|
||||||
// first draft had us selecting and finding the rider ids. maybe we should bring
|
|
||||||
// that back with the set attribute? I can't remember if I ran it with that one :(
|
|
||||||
// so that updating will have a smaller result set.
|
|
||||||
$db = $this->em->getConnection();
|
$db = $this->em->getConnection();
|
||||||
$db->getWrappedConnection()->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, false);
|
|
||||||
|
|
||||||
$update_sql = 'UPDATE rider SET current_jo_id = NULL, active_jo_id = NULL WHERE (current_jo_id = :id OR active_jo_id = :id)';
|
$jo_ids = str_repeat('?,', count($jo_id_list) - 1) . '?';
|
||||||
$update_stmt = $db->prepare($update_sql);
|
|
||||||
|
|
||||||
foreach ($jo_id_list as $jo_id)
|
$update_curr_sql = 'UPDATE rider SET current_jo_id = NULL WHERE current_jo_id IN (' . $jo_ids . ')';
|
||||||
{
|
$update_curr_stmt = $db->prepare($update_curr_sql);
|
||||||
$update_stmt->execute([
|
|
||||||
'id' => $jo_id,
|
$update_active_sql = 'UPDATE rider SET active_jo_id = NULL WHERE active_jo_id IN (' . $jo_ids . ')';
|
||||||
]);
|
$udpate_active_stmt = $db->prepare($update_active_sql);
|
||||||
}
|
|
||||||
|
$update_curr_stmt->execute($jo_id_list);
|
||||||
|
$update_active_stmt->execute($jo_id_list);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function loadDataFileForArchiveData($load_stmt)
|
protected function loadDataFileForArchiveData($load_stmt)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue