From 4132573088c376fcb44cc588d9341c8d38b6d694 Mon Sep 17 00:00:00 2001 From: Andreas Fischer <bantu@phpbb.com> Date: Wed, 27 Mar 2013 23:35:36 +0100 Subject: [ticket/11469] Use buffer with a single element instead of extra code path. PHPBB3-11469 --- phpBB/includes/db/sql_insert_buffer.php | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) (limited to 'phpBB/includes') diff --git a/phpBB/includes/db/sql_insert_buffer.php b/phpBB/includes/db/sql_insert_buffer.php index dd7932c7bd..03c8a875b9 100644 --- a/phpBB/includes/db/sql_insert_buffer.php +++ b/phpBB/includes/db/sql_insert_buffer.php @@ -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(); } -- cgit v1.2.1