diff options
author | Andreas Fischer <bantu@phpbb.com> | 2013-03-27 19:19:26 +0100 |
---|---|---|
committer | Andreas Fischer <bantu@phpbb.com> | 2013-03-27 19:19:26 +0100 |
commit | dc766f29b4381e3cecfacbfeb848b4e13c3e48f9 (patch) | |
tree | eae18b69912603beb5adad7faa07dcb65318d8b2 /phpBB/includes | |
parent | 8c5fcac2325356bacb72517f6fbd95f9bfdaf16d (diff) | |
download | forums-dc766f29b4381e3cecfacbfeb848b4e13c3e48f9.tar forums-dc766f29b4381e3cecfacbfeb848b4e13c3e48f9.tar.gz forums-dc766f29b4381e3cecfacbfeb848b4e13c3e48f9.tar.bz2 forums-dc766f29b4381e3cecfacbfeb848b4e13c3e48f9.tar.xz forums-dc766f29b4381e3cecfacbfeb848b4e13c3e48f9.zip |
[ticket/11469] Have all methods of phpbb_db_sql_insert_buffer provide feedback.
PHPBB3-11469
Diffstat (limited to 'phpBB/includes')
-rw-r--r-- | phpBB/includes/db/sql_insert_buffer.php | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/phpBB/includes/db/sql_insert_buffer.php b/phpBB/includes/db/sql_insert_buffer.php index 4bf0608227..dd4a62a948 100644 --- a/phpBB/includes/db/sql_insert_buffer.php +++ b/phpBB/includes/db/sql_insert_buffer.php @@ -86,7 +86,8 @@ class phpbb_db_sql_insert_buffer * * @param array $row * - * @return null + * @return bool True when some data was flushed to the database. + * False otherwise. */ public function insert(array $row) { @@ -96,15 +97,18 @@ class phpbb_db_sql_insert_buffer // 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; + + return true; } $this->buffer[] = $row; if (sizeof($this->buffer) >= $this->max_buffered_rows) { - $this->flush(); + return $this->flush(); } + + return false; } /** @@ -116,20 +120,26 @@ class phpbb_db_sql_insert_buffer * * @param array $rows * - * @return null + * @return bool True when some data was flushed to the database. + * False otherwise. */ public function insert_all(array $rows) { + $result = false; + foreach ($rows as $row) { - $this->insert($row); + $result |= $this->insert($row); } + + return $result; } /** * Flushes the buffer content to the DB and clears the buffer. * - * @return null + * @return bool True when some data was flushed to the database. + * False otherwise. */ public function flush() { @@ -137,6 +147,10 @@ class phpbb_db_sql_insert_buffer { $this->db->sql_multi_insert($this->table_name, $this->buffer); $this->buffer = array(); + + return true; } + + return false; } } |