更新时间:2023-02-07 18:08:20
我认为没有更多信息就不可能-仅要插入的行数和受影响的行还不够.
I think it's impossible without more information - not enough with just the count of rows you're about to insert and the affected rows.
mysqli->info
返回一个有用的字符串,该字符串也提供重复计数-我们可以从中得出其余的数字.
mysqli->info
returns a helpful string that also provides a duplicate count - we can work out the rest from this.
list($rec, $dupes, $warns) = sscanf($mysqli->info, "Records: %d Duplicates: %d Warnings: %d"); // courtesy of user at big lake dot com - php.net
$inserts = $total_rows_affected - ($dupes * 2);
$updates = ($total_rows_affected - $inserts)/2;
$skipped = $rec - ($inserts + $updates);
$total = $rec;