Skip to content

Commit e2f86a5

Browse files
committed
misc fixes
1 parent ab4b9f7 commit e2f86a5

File tree

4 files changed

+9
-13
lines changed

4 files changed

+9
-13
lines changed

system/Database/BaseBuilder.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1919,15 +1919,13 @@ protected function _upsertBatch(string $table, array $keys, array $values): stri
19191919

19201920
$sql .= 'ON DUPLICATE KEY UPDATE' . "\n";
19211921

1922-
$sql .= implode(
1922+
return $sql . implode(
19231923
",\n",
19241924
array_map(
19251925
static fn ($columnName) => '`' . $columnName . '` = VALUES(`' . $columnName . '`)',
19261926
$updateFields
19271927
)
19281928
);
1929-
1930-
return $sql;
19311929
}
19321930

19331931
/**

system/Database/OCI8/Builder.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,8 @@ protected function _upsertBatch(string $table, array $keys, array $values): stri
139139
foreach ($values as $value) {
140140
$sql .= 'SELECT ';
141141
$sql .= implode(', ', array_map(
142-
static fn ($columnName, $value) => $value . ' ' . $columnName, $keys,
142+
static fn ($columnName, $value) => $value . ' ' . $columnName,
143+
$keys,
143144
$value
144145
));
145146
$sql .= " FROM DUAL UNION ALL\n";
@@ -169,9 +170,9 @@ protected function _upsertBatch(string $table, array $keys, array $values): stri
169170

170171
$sql .= "\nWHEN NOT MATCHED THEN INSERT (" . implode(', ', $keys) . ")\nVALUES ";
171172

172-
$sql .= (' (' . implode(', ', array_map(static fn ($columnName) => '"_upsert".' . $columnName, $keys)) . ')');
173-
174-
return $sql;
173+
return $sql . (' ('
174+
. implode(', ', array_map(static fn ($columnName) => '"_upsert".' . $columnName, $keys))
175+
. ')');
175176
}
176177

177178
/**

system/Database/Postgre/Builder.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -260,15 +260,13 @@ protected function _upsertBatch(string $table, array $keys, array $values): stri
260260

261261
$sql .= "DO UPDATE SET\n";
262262

263-
$sql .= implode(
263+
return $sql . implode(
264264
",\n",
265265
array_map(
266266
static fn ($updateField) => '"' . $updateField . '" = "excluded"."' . $updateField . '"',
267267
$updateFields
268268
)
269269
);
270-
271-
return $sql;
272270
}
273271

274272
/**

system/Database/SQLite3/Builder.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace CodeIgniter\Database\SQLite3;
1313

1414
use CodeIgniter\Database\BaseBuilder;
15+
use CodeIgniter\Database\Exceptions\DatabaseException;
1516

1617
/**
1718
* Builder for SQLite3
@@ -118,14 +119,12 @@ protected function _upsertBatch(string $table, array $keys, array $values): stri
118119

119120
$sql .= "DO UPDATE SET\n";
120121

121-
$sql .= implode(
122+
return $sql . implode(
122123
",\n",
123124
array_map(
124125
static fn ($updateField) => '`' . $updateField . '` = `excluded`.`' . $updateField . '`',
125126
$updateFields
126127
)
127128
);
128-
129-
return $sql;
130129
}
131130
}

0 commit comments

Comments
 (0)