diff options
author | Andreas Fischer <bantu@phpbb.com> | 2013-03-27 23:35:36 +0100 |
---|---|---|
committer | Andreas Fischer <bantu@phpbb.com> | 2013-03-28 00:28:50 +0100 |
commit | 4132573088c376fcb44cc588d9341c8d38b6d694 (patch) | |
tree | 0a6cba15232d5a2799c5bf0df3e6ccdb7ffa5be6 /phpBB/includes | |
parent | b88eb3c8e099e1a0634ab84e9e1c215c00410264 (diff) | |
download | forums-4132573088c376fcb44cc588d9341c8d38b6d694.tar forums-4132573088c376fcb44cc588d9341c8d38b6d694.tar.gz forums-4132573088c376fcb44cc588d9341c8d38b6d694.tar.bz2 forums-4132573088c376fcb44cc588d9341c8d38b6d694.tar.xz forums-4132573088c376fcb44cc588d9341c8d38b6d694.zip |
[ticket/11469] Use buffer with a single element instead of extra code path.
PHPBB3-11469
Diffstat (limited to 'phpBB/includes')
-rw-r--r-- | phpBB/includes/db/sql_insert_buffer.php | 14 |
1 files changed, 3 insertions, 11 deletions
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(); } |