Skip to content

Commit a046931

Browse files
authored
Merge pull request #6690 from kenjis/update-coding-style
[4.3] style: update coding style
2 parents 00d2b2a + 30d23ae commit a046931

File tree

6 files changed

+22
-25
lines changed

6 files changed

+22
-25
lines changed

system/Database/BaseBuilder.php

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1938,19 +1938,16 @@ protected function _upsertBatch(string $table, array $keys, array $values): stri
19381938
if ($sql === '') {
19391939
$updateFields = $this->QBOptions['updateFields'] ?? $this->updateFields($keys)->QBOptions['updateFields'] ?? [];
19401940

1941-
$sql = 'INSERT INTO ' . $table . ' (' . implode(', ', $keys) . ')' . "\n"
1942-
. '{:_table_:}'
1943-
. 'ON DUPLICATE KEY UPDATE' . "\n"
1944-
. implode(
1945-
",\n",
1946-
array_map(
1947-
static fn ($key, $value) => $table . '.' . $key . ($value instanceof RawSql ?
1948-
' = ' . $value :
1949-
' = ' . 'VALUES(' . $value . ')'),
1950-
array_keys($updateFields),
1951-
$updateFields
1952-
)
1953-
);
1941+
$sql = 'INSERT INTO ' . $table . ' (' . implode(', ', $keys) . ")\n{:_table_:}ON DUPLICATE KEY UPDATE\n" . implode(
1942+
",\n",
1943+
array_map(
1944+
static fn ($key, $value) => $table . '.' . $key . ($value instanceof RawSql ?
1945+
' = ' . $value :
1946+
' = VALUES(' . $value . ')'),
1947+
array_keys($updateFields),
1948+
$updateFields
1949+
)
1950+
);
19541951

19551952
$this->QBOptions['sql'] = $sql;
19561953
}
@@ -2443,7 +2440,7 @@ protected function _updateBatch(string $table, array $keys, array $values): stri
24432440

24442441
$sql = 'UPDATE ' . $this->compileIgnore('update') . $table . "\n";
24452442

2446-
$sql .= 'SET' . "\n";
2443+
$sql .= "SET\n";
24472444

24482445
$sql .= implode(
24492446
",\n",
@@ -2456,7 +2453,7 @@ protected function _updateBatch(string $table, array $keys, array $values): stri
24562453
)
24572454
) . "\n";
24582455

2459-
$sql .= 'FROM (' . "\n{:_table_:}";
2456+
$sql .= "FROM (\n{:_table_:}";
24602457

24612458
$sql .= ') ' . $alias . "\n";
24622459

system/Database/MySQLi/Builder.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ protected function _updateBatch(string $table, array $keys, array $values): stri
8383

8484
$sql = 'UPDATE ' . $this->compileIgnore('update') . $table . "\n";
8585

86-
$sql .= 'INNER JOIN (' . "\n{:_table_:}";
86+
$sql .= "INNER JOIN (\n{:_table_:}";
8787

8888
$sql .= ') ' . $alias . "\n";
8989

@@ -97,7 +97,7 @@ protected function _updateBatch(string $table, array $keys, array $values): stri
9797
)
9898
) . "\n";
9999

100-
$sql .= 'SET' . "\n";
100+
$sql .= "SET\n";
101101

102102
$sql .= implode(
103103
",\n",

system/Database/OCI8/Builder.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ protected function _updateBatch(string $table, array $keys, array $values): stri
264264
// Oracle doesn't support ignore on updates so we will use MERGE
265265
$sql = 'MERGE INTO ' . $table . "\n";
266266

267-
$sql .= 'USING (' . "\n{:_table_:}";
267+
$sql .= "USING (\n{:_table_:}";
268268

269269
$sql .= ') ' . $alias . "\n";
270270

@@ -280,7 +280,7 @@ protected function _updateBatch(string $table, array $keys, array $values): stri
280280

281281
$sql .= "WHEN MATCHED THEN UPDATE\n";
282282

283-
$sql .= 'SET' . "\n";
283+
$sql .= "SET\n";
284284

285285
$sql .= implode(
286286
",\n",
@@ -365,7 +365,7 @@ protected function _upsertBatch(string $table, array $keys, array $values): stri
365365
array_map(
366366
static fn ($key) => ($key instanceof RawSql ?
367367
$key :
368-
$table . '.' . $key . ' = ' . '"_upsert".' . $key),
368+
$table . '.' . $key . ' = "_upsert".' . $key),
369369
$constraints
370370
)
371371
) . ")\n";
@@ -377,7 +377,7 @@ protected function _upsertBatch(string $table, array $keys, array $values): stri
377377
array_map(
378378
static fn ($key, $value) => $key . ($value instanceof RawSql ?
379379
' = ' . $value :
380-
' = ' . '"_upsert".' . $value),
380+
' = "_upsert".' . $value),
381381
array_keys($updateFields),
382382
$updateFields
383383
)

system/Database/Postgre/Builder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ protected function _upsertBatch(string $table, array $keys, array $values): stri
383383
array_map(
384384
static fn ($key, $value) => $key . ($value instanceof RawSql ?
385385
' = ' . $value :
386-
' = ' . '"excluded".' . $value),
386+
' = "excluded".' . $value),
387387
array_keys($updateFields),
388388
$updateFields
389389
)

system/Database/SQLSRV/Builder.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -704,7 +704,7 @@ protected function _upsertBatch(string $table, array $keys, array $values): stri
704704
array_map(
705705
static fn ($key) => ($key instanceof RawSql ?
706706
$key :
707-
$fullTableName . '.' . $key . ' = ' . '"_upsert".' . $key),
707+
$fullTableName . '.' . $key . ' = "_upsert".' . $key),
708708
$constraints
709709
)
710710
) . ")\n";
@@ -716,7 +716,7 @@ protected function _upsertBatch(string $table, array $keys, array $values): stri
716716
array_map(
717717
static fn ($key, $value) => $key . ($value instanceof RawSql ?
718718
' = ' . $value :
719-
' = ' . '"_upsert".' . $value),
719+
' = "_upsert".' . $value),
720720
array_keys($updateFields),
721721
$updateFields
722722
)

system/Database/SQLite3/Builder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ protected function _upsertBatch(string $table, array $keys, array $values): stri
185185
array_map(
186186
static fn ($key, $value) => $key . ($value instanceof RawSql ?
187187
' = ' . $value :
188-
' = ' . '`excluded`.' . $value),
188+
' = `excluded`.' . $value),
189189
array_keys($updateFields),
190190
$updateFields
191191
)

0 commit comments

Comments
 (0)