This commit is contained in:
2023-09-30 20:09:18 +08:00
parent 735801f756
commit b5b5db4d2c
+2 -16
View File
@@ -70,23 +70,9 @@ class ImplodeCommand extends Command
continue;
}
$waite->add();
[$one, $two] = explode('VALUES', $line);
$foreach = explode(',', $two);
$array = [];
foreach ($foreach as $item) {
$values = explode('),(', trim($item, '()'));
$tmp = [];
foreach ($values as $date) {
if (is_string($date)) {
$tmp[] = '\'' . html_entity_decode(trim($date, '\'')) . '\'';
} else {
$tmp[] = $data;
}
}
$array[] = implode(',', $tmp);
}
$insert = $one . ' VALUES ('.implode('),(', $array).')';
$insert = str_replace($line,'"','"');
$insert = str_replace($insert,''',"\'");
Coroutine::create(function () use ($waite, $insert, $data) {
Coroutine\defer(fn() => $waite->done());
$data->createCommand($insert)->exec();