0
모두 또는 아무 것도 사용하지 않는 트랜잭션을 사용하여 사용자 계정을 삭제하는 기능을 설정하려고합니다. 다음과 같은 기능의 주요 부분이다 : 나는 별도의 준비된 문에 쿼리를 넣어 시도했습니다PHP PDO 다중 삭제 쿼리가 작동하지 않습니다.
$success = true;
$this->db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 1);
$this->db->beginTransaction();
try
{
if($data = $this->get_ids($account_id)){
$sql = "DELETE FROM table1 WHERE [ID] IN (:loc_ids);
DELETE FROM table2 WHERE [ID] IN (:spid);
";
$success = $success && $this->db->prepare($sql)->execute(array(':loc_ids' => $data['loc_ids'], ':spid' => $data['spid']));
}
$sql = "DELETE FROM table3 WHERE [ACCOUNT_ID] = :account_id;
DELETE FROM table4 WHERE ([ACCOUNT_ID] = :account_id OR [USER_ID] = :user_id);
DELETE FROM table5 WHERE [ACCOUNT_ID] = :account_id;
DELETE FROM table6 WHERE [ACCOUNT_ID] = :account_id;
DELETE FROM table7 WHERE [ACCOUNT_ID] = :account_id;
";
$success = $success && $this->db->prepare($sql)->execute(array(':account_id' => $account_id, ':user_id' => $uid));
if(!$success){
throw new Exception("Error Processing Request", 1);
}
$this->db->commit();
return true;
}
catch (PDOException $exc)
{
echo $exc->getMessage();
$this->db->rollBack();
return false;
}
하지만 어느 쪽이든 나는 this screen에서 끝낸다.
저는 MAMP를 사용 중이며 MSSQL 서버와 상호 작용하려고합니다. PHP 7.06을 사용하고 있고 mysqlnd가 활성화되어 있습니다.
동시에 여러 쿼리를 수행했거나 MAMP-MSSQL 연결과 관련이 있습니까?