forked from codeigniter4/CodeIgniter4
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path092.php
More file actions
30 lines (29 loc) · 770 Bytes
/
Copy path092.php
File metadata and controls
30 lines (29 loc) · 770 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?php
$data = [
[
'title' => 'Title 1',
'author' => 'Author 1',
'name' => 'Name 1',
'date' => 'Date 1',
],
[
'title' => 'Title 2',
'author' => 'Author 2',
'name' => 'Name 2',
'date' => 'Date 2',
],
];
$builder->updateBatch($data, ['title', 'author']);
/*
* Produces:
* UPDATE `mytable`
* INNER JOIN (
* SELECT 'Title 1' `title`, 'Author 1' `author`, 'Name 1' `name`, 'Date 1' `date` UNION ALL
* SELECT 'Title 2' `title`, 'Author 2' `author`, 'Name 2' `name`, 'Date 2' `date`
* ) `u`
* ON `mytable`.`title` = `u`.`title` AND `mytable`.`author` = `u`.`author`
* SET
* `mytable`.`title` = `u`.`title`,
* `mytable`.`name` = `u`.`name`,
* `mytable`.`date` = `u`.`date`
*/