File tree Expand file tree Collapse file tree 1 file changed +6
-7
lines changed
user_guide_src/source/database/query_builder Expand file tree Collapse file tree 1 file changed +6
-7
lines changed Original file line number Diff line number Diff line change 26
26
->onConstraint (['`mytable`.`title` ' => '`u`.`title` ' , 'author ' => new RawSql ('`u`.`author` ' )])
27
27
->updateBatch ();
28
28
29
- // OR
30
- $ builder ->setData ($ data )
31
- ->setAlias ('u ' )
32
- ->onConstraint (new RawSql ('`mytable`.`title` = `u`.`title` AND `mytable`.`author` = `u`.`author` ' ))
33
- ->updateFields (['last_update ' => new RawSql ('CURRENT_TIMESTAMP() ' )], true )
34
- ->updateBatch ();
35
-
36
29
// OR
37
30
foreach ($ data as $ row ) {
38
31
$ builder ->setData ($ row );
39
32
}
40
33
$ builder ->onConstraint ('title, author ' )->updateBatch ();
34
+
35
+ // OR
36
+ $ builder ->setData ($ data , true , 'u ' )
37
+ ->onConstraint (new RawSql ('`mytable`.`title` = `u`.`title` AND `mytable`.`author` = `u`.`author` ' ))
38
+ ->updateFields (['last_update ' => new RawSql ('CURRENT_TIMESTAMP() ' )], true )
39
+ ->updateBatch ();
41
40
/*
42
41
* Produces:
43
42
* UPDATE `mytable`
You can’t perform that action at this time.
0 commit comments