@@ -908,6 +908,8 @@ Upsert
908908$builder->upsert()
909909------------------
910910
911+ .. versionadded :: 4.3.0
912+
911913Generates an upsert string based on the data you supply, and runs the
912914query. You can either pass an **array ** or an **object ** to the
913915method. By default a constraint will be defined in order. A primary
@@ -929,6 +931,8 @@ The first parameter is an object.
929931$builder->getCompiledUpsert()
930932-----------------------------
931933
934+ .. versionadded :: 4.3.0
935+
932936Compiles the upsert query just like ``$builder->upsert() `` but does not
933937*run * the query. This method simply returns the SQL query as a string.
934938
@@ -944,10 +948,12 @@ upsertBatch
944948$builder->upsertBatch()
945949-----------------------
946950
951+ .. versionadded :: 4.3.0
952+
947953Generates an upsert string based on the data you supply, and runs the
948954query. You can either pass an **array ** or an **object ** to the
949955method. By default a constraint will be defined in order. A primary
950- key will be selected first and then unique keys. Mysql will use any
956+ key will be selected first and then unique keys. MySQL will use any
951957constraint by default. Here is an example using an array:
952958
953959.. literalinclude :: query_builder/108.php
@@ -960,13 +966,16 @@ You can also upsert from a query:
960966
961967.. literalinclude :: query_builder/115.php
962968
963- .. note :: ``setQueryAsData()`` can be used since v4.3.0.
969+ .. note :: The ``setQueryAsData()``, ``onConstraint()``, and ``updateFields()``
970+ methods can be used since v4.3.0.
964971
965972.. note :: It is required to alias the columns of the select query to match those of the target table.
966973
967974$builder->onConstraint()
968975------------------------
969976
977+ .. versionadded :: 4.3.0
978+
970979Allows manually setting constraint to be used for upsert. This does
971980not work with MySQL because MySQL checks all constraints by default.
972981
@@ -976,6 +985,9 @@ This method accepts a string or an array of columns.
976985
977986$builder->updateFields()
978987------------------------
988+
989+ .. versionadded :: 4.3.0
990+
979991Allows manually setting the fields to be updated when performing upserts.
980992
981993.. literalinclude :: query_builder/110.php
@@ -1084,14 +1096,24 @@ UpdateBatch
10841096$builder->updateBatch()
10851097-----------------------
10861098
1099+ .. note :: Since v4.3.0, the second parameter ``$index`` of ``updateBatch()`` has
1100+ changed to ``$constraints ``. It now accepts types array, string, or ``RawSql ``.
1101+
10871102Generates an update string based on the data you supply, and runs the query.
10881103You can either pass an **array ** or an **object ** to the method.
10891104Here is an example using an array:
10901105
10911106.. literalinclude :: query_builder/092.php
10921107
1108+ .. note :: Since v4.3.0, the generated SQL structure has been Improved.
1109+
10931110The first parameter is an associative array of values, the second parameter is the where key.
10941111
1112+ Since v4.3.0, you can also use the ``setQueryAsData() ``, ``onConstraint() ``, and
1113+ ``updateFields() `` methods:
1114+
1115+ .. literalinclude :: query_builder/120.php
1116+
10951117.. note :: All values except ``RawSql`` are escaped automatically producing safer queries.
10961118
10971119.. warning :: When you use ``RawSql``, you MUST escape the data manually. Failure to do so could result in SQL injections.
@@ -1104,7 +1126,8 @@ You can also update from a query:
11041126
11051127.. literalinclude :: query_builder/116.php
11061128
1107- .. note :: ``setQueryAsData()`` can be used since v4.3.0.
1129+ .. note :: The ``setQueryAsData()``, ``onConstraint()``, and ``updateFields()``
1130+ methods can be used since v4.3.0.
11081131
11091132.. note :: It is required to alias the columns of the select query to match those of the target table.
11101133
@@ -1146,6 +1169,8 @@ method, or ``emptyTable()``.
11461169$builder->deleteBatch()
11471170-----------------------
11481171
1172+ .. versionadded :: 4.3.0
1173+
11491174Generates a batch **DELETE ** statement based on a set of data.
11501175
11511176.. literalinclude :: query_builder/118.php
@@ -1198,6 +1223,8 @@ When
11981223$builder->when()
11991224----------------
12001225
1226+ .. versionadded :: 4.3.0
1227+
12011228This allows modifying the query based on a condition without breaking out of the
12021229query builder chain. The first parameter is the condition, and it should evaluate
12031230to a boolean. The second parameter is a callable that will be ran
@@ -1223,6 +1250,8 @@ WhenNot
12231250$builder->whenNot()
12241251-------------------
12251252
1253+ .. versionadded :: 4.3.0
1254+
12261255This works exactly the same way as ``$builder->when() `` except that it will
12271256only run the callable when the condition evaluates to ``false ``, instead of ``true `` like ``when() ``.
12281257
@@ -1415,6 +1444,8 @@ Class Reference
14151444
14161445 .. php :method :: setQueryAsData($query[, $alias[, $columns = null]])
14171446
1447+ .. versionadded :: 4.3.0
1448+
14181449 :param BaseBuilder|RawSql $query: Instance of the BaseBuilder or RawSql
14191450 :param string|null $alias: Alias for query
14201451 :param array|string|null $columns: Array or comma delimited string of columns in the query
0 commit comments