Skip to content

docs: update QueryBuilder *Batch methods #6597

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Sep 27, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 15 additions & 5 deletions user_guide_src/source/database/query_builder.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1612,18 +1612,20 @@ Class Reference

.. php:method:: updateBatch([$set = null[, $constraints = null[, $batchSize = 100]]])

:param array $set: Field name, or an associative array of field/value pairs
:param mixed $constraints: The field or fields used as keys to update on.
:param array|object|null $set: Field name, or an associative array of field/value pairs
:param array|RawSql|string|null $constraints: The field or fields used as keys to update on.
:param int $batchSize: Count of conditions to group in a single query
:returns: Number of rows updated or ``false`` on failure
:rtype: int|false

.. note:: Since v4.3.0, the types of the parameters ``$set`` and ``$constraints`` have changed.

Compiles and executes batch ``UPDATE`` statements.
The ``$constraints`` parameter takes a comma delimited string of columns, an array, an associative array, or RawSql.
The ``$constraints`` parameter takes a comma delimited string of columns, an array, an associative array, or ``RawSql``.

.. note:: When more than ``$batchSize`` field/value pairs are provided,
multiple queries will be executed, each handling up to ``$batchSize``
field/value pairs. If we set ``$batchSize`` to 0, then all field/value
multiple queries will be executed, each handling up to ``$batchSize``
field/value pairs. If we set ``$batchSize`` to 0, then all field/value
pairs will be executed in one query.

.. php:method:: updateFields($set, [$addToDefault = false, [$ignore = null]])
Expand All @@ -1634,6 +1636,8 @@ Class Reference
:returns: ``BaseBuilder`` instance (method chaining)
:rtype: ``BaseBuilder``

.. versionadded:: 4.3.0

Used with ``updateBatch()`` and ``upsertBatch()`` methods. This defines the fields which will be updated.

.. php:method:: onConstraint($set)
Expand All @@ -1642,6 +1646,8 @@ Class Reference
:returns: ``BaseBuilder`` instance (method chaining)
:rtype: ``BaseBuilder``

.. versionadded:: 4.3.0

Used with ``updateBatch()`` and ``upsertBatch()`` methods. This takes a comma delimited string of columns, and array, associative array, or RawSql.

.. php:method:: setData($set, [$escape = null, [$alias = '']])
Expand All @@ -1652,6 +1658,8 @@ Class Reference
:returns: ``BaseBuilder`` instance (method chaining)
:rtype: ``BaseBuilder``

.. versionadded:: 4.3.0

Used for ``*Batch()`` methods to set data for insert, update, upsert.

.. php:method:: setAlias($alias)
Expand All @@ -1660,6 +1668,8 @@ Class Reference
:returns: ``BaseBuilder`` instance (method chaining)
:rtype: ``BaseBuilder``

.. versionadded:: 4.3.0

This allows setting an alias for the psuedo table generated with ``setData()``.

.. php:method:: setUpdateBatch($key[, $value = ''[, $escape = null]])
Expand Down