我正在执行以下查询:
$sql ='UPDATE
Atable A INNER JOIN
Btable B ON A.name=B.name
SET
A.field=1
WHERE
B.field="wrong"; ';
B.field不是Key列。 Workbench正确地将其停止并显示错误:
Error Code: 1175. You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column To disable safe mode, toggle the option in Preferences -> SQL Editor and reconnect.
但是如果我用Laravel Eloquent执行上述查询:
$affected = DB::update(DB::raw($sql2));
查询将会运行,所以Eloquent是否有任何安全用法我都会丢失,或者一般情况下你需要小心,因为Eloquent能够通过安全更新模式吗?