mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 22:28:51 +00:00
[ticket/11469] Use buffer with a single element instead of extra code path.
PHPBB3-11469
This commit is contained in:
parent
b88eb3c8e0
commit
4132573088
1 changed files with 3 additions and 11 deletions
|
@ -96,19 +96,11 @@ class phpbb_db_sql_insert_buffer
|
|||
*/
|
||||
public function insert(array $row)
|
||||
{
|
||||
if (!$this->db_supports_multi_insert)
|
||||
{
|
||||
// The database does not support multi inserts.
|
||||
// Pass data on to sql_multi_insert right away which will
|
||||
// immediately send an INSERT INTO query to the database.
|
||||
$this->db->sql_multi_insert($this->table_name, array($row));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
$this->buffer[] = $row;
|
||||
|
||||
if (sizeof($this->buffer) >= $this->max_buffered_rows)
|
||||
// Flush buffer if it is full or when DB does not support multi inserts.
|
||||
// In the later case, the buffer will always only contain one row.
|
||||
if (!$this->db_supports_multi_insert || sizeof($this->buffer) >= $this->max_buffered_rows)
|
||||
{
|
||||
return $this->flush();
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue