From 105a48bbfc97be5902dbe80f90f8936fe174c9cf Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Thu, 4 Feb 2016 15:45:10 +0200 Subject: Add batch_size param to insert_batch(), update_batch() This should resolve #42 --- user_guide_src/source/database/query_builder.rst | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'user_guide_src/source/database') diff --git a/user_guide_src/source/database/query_builder.rst b/user_guide_src/source/database/query_builder.rst index 5d9ae4592..3135f76da 100644 --- a/user_guide_src/source/database/query_builder.rst +++ b/user_guide_src/source/database/query_builder.rst @@ -1433,15 +1433,20 @@ Class Reference Compiles and executes an INSERT statement. - .. php:method:: insert_batch([$table = ''[, $set = NULL[, $escape = NULL]]]) + .. php:method:: insert_batch($table[, $set = NULL[, $escape = NULL[, $batch_size = 100]]]) :param string $table: Table name :param array $set: Data to insert :param bool $escape: Whether to escape values and identifiers + :param int $batch_size: Count of rows to insert at once :returns: Number of rows inserted or FALSE on failure :rtype: mixed - Compiles and executes batch INSERT statements. + Compiles and executes batch ``INSERT`` statements. + + .. note:: When more than ``$batch_size`` rows are provided, multiple + ``INSERT`` queries will be executed, each trying to insert + up to ``$batch_size`` rows. .. php:method:: set_insert_batch($key[, $value = ''[, $escape = NULL]]) @@ -1464,15 +1469,20 @@ Class Reference Compiles and executes an UPDATE statement. - .. php:method:: update_batch([$table = ''[, $set = NULL[, $value = NULL]]]) + .. php:method:: update_batch($table[, $set = NULL[, $value = NULL[, $batch_size = 100]]]) :param string $table: Table name :param array $set: Field name, or an associative array of field/value pairs :param string $value: Field value, if $set is a single field + :param int $batch_size: Count of conditions to group in a single query :returns: Number of rows updated or FALSE on failure :rtype: mixed - Compiles and executes batch UPDATE statements. + Compiles and executes batch ``UPDATE`` statements. + + .. note:: When more than ``$batch_size`` field/value pairs are provided, + multiple queries will be executed, each handling up to + ``$batch_size`` field/value pairs. .. php:method:: set_update_batch($key[, $value = ''[, $escape = NULL]]) -- cgit v1.2.3-24-g4f1b