出現錯誤
SQLSTATE [HY000]:一般錯誤:1390 準備陳述句包含太多占位符...
同時更新大資料。
這是我的代碼:
$reportItem = ReportItem::upsert($data->toArray(), ['someId','otherId']);
我認為這個限制是因為 mysql,我嘗試使用塊但沒有成功。有什么幫助嗎?
$reportItem = ReportItem::chunk(1000, upsert($data->toArray(), ['someId','otherId']));
uj5u.com熱心網友回復:
您需要分塊要插入的“$data”集合。
foreach ($data->chunk(100) as $chunk) {
ReportItem::upsert($chunk->toArray(), ['someId','otherId']);
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/534843.html
下一篇:無法使用mongodb/mongodb的最新版本1.13.1,因為它需要ext-mongodb^1.14.0,而您的平臺缺少該版本
