try fix error cannot insert multiple commands into prepared statement

This commit is contained in:
2023-09-11 11:23:21 +02:00
parent 92b1b17679
commit c1d70ec63e
6 changed files with 19 additions and 13 deletions

View File

@@ -52,12 +52,17 @@ class PersonMoveCenterHistoryHandler implements PersonMoveSqlHandlerInterface
}
}
$sqlDelete = sprintf("delete FROM chill_person_person_center_history WHERE person_id = %d", $from->getId());
$sqlDelete = sprintf(<<<'SQL'
DELETE FROM chill_person_person_center_history WHERE person_id = %d;
SQL, $from->getId());
$sqlStatements = [$sqlDelete];
if ((null !== $oldestDateA && null !== $oldestDateB) && $oldestDateA <= $oldestDateB) {
$sqlInsert = sprintf("update chill_person_person_center_history set startDate = '%s' WHERE id = %d", $oldestDateA->format('Y-m-d'), $oldestCenterHistoryB->getId());
$sqlInsert = sprintf(<<<'SQL'
UPDATE chill_person_person_center_history SET startDate = '%s' WHERE id = %d;
SQL, $oldestDateA->format('Y-m-d'), $oldestCenterHistoryB->getId());
$sqlStatements = [$sqlInsert, $sqlDelete];
}