eee
This commit is contained in:
+12
-15
@@ -63,24 +63,21 @@ class ImplodeCommand extends Command
|
|||||||
}
|
}
|
||||||
|
|
||||||
$waite = new Coroutine\WaitGroup();
|
$waite = new Coroutine\WaitGroup();
|
||||||
|
|
||||||
|
|
||||||
$stream = fopen($path, 'r');
|
$stream = fopen($path, 'r');
|
||||||
if (!$stream) {
|
if ($stream) {
|
||||||
return 0;
|
while (($line = fgets($stream)) !== false) {
|
||||||
}
|
$insert = html_entity_decode($line);
|
||||||
while (($line = fgets($stream)) !== false) {
|
if (!str_starts_with(strtoupper($insert), 'INSERT INTO')) {
|
||||||
$insert = html_entity_decode($line);
|
continue;
|
||||||
if (!str_starts_with(strtoupper($insert), 'INSERT INTO')) {
|
}
|
||||||
continue;
|
$waite->add();
|
||||||
|
Coroutine::create(function () use ($waite, $insert, $data) {
|
||||||
|
Coroutine\defer(fn() => $waite->done());
|
||||||
|
$data->createCommand($insert)->exec();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
$waite->add();
|
fclose($stream);
|
||||||
Coroutine::create(function () use ($waite, $insert, $data) {
|
|
||||||
Coroutine\defer(fn() => $waite->done());
|
|
||||||
$data->createCommand($insert)->exec();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
fclose($stream);
|
|
||||||
$waite->wait();
|
$waite->wait();
|
||||||
|
|
||||||
$output->write('dump data success');
|
$output->write('dump data success');
|
||||||
|
|||||||
Reference in New Issue
Block a user