dbmsv4 init...3

This commit is contained in:
최준흠 2025-12-23 14:18:56 +09:00
parent a62bb3a80d
commit a88fb96bd3
2 changed files with 23 additions and 13 deletions

View File

@ -121,13 +121,18 @@ abstract class BaseSource extends DBMigration
);
}
// final public function switchcode(): void
// {
// $this->execute(
// new SWITCHCodeProcess($this->getTargetDB()),
// $this->getSWITCHCode(),
// __FUNCTION__,
// $this->getDBName()
// );
// }
final public function switchcode(): void
{
$this->execute(
new SWITCHCodeProcess($this->getTargetDB()),
$this->getSWITCHCode(),
__FUNCTION__,
$this->getDBName()
);
$processor = new SWITCHCodeProcess($this->getTargetDB());
$processor->make();
}
}

View File

@ -11,14 +11,19 @@ class SwitchCodeProcess implements MigrationProcessInterface
{
$this->db = $db;
}
public function process(string $site, array $row, int $cnt): void
public function process(string $site, array $row, int $cnt): void {}
public function make(): void
{
$temps = [];
$temps['code'] = trim($row['service_sw']);
$temps['status'] = STATUS['AVAILABLE']; // Assuming SWITCHEntity has a STATUS_DEFAULT constant
if (!$this->db->table('switchinfo')->insert($temps)) {
throw new \Exception($this->db->error()['message']);
for ($i = 1; $i <= 88; $i++) {
for ($j = 1; $j <= 48; $j++) {
$temps = [];
$temps['code'] = sprintf("C%02dPA%02d", $i, $j);
$temps['status'] = STATUS['AVAILABLE'];
if (!$this->db->table('switchinfo')->insert($temps)) {
throw new \Exception($this->db->error()['message']);
}
}
}
echo "{$cnt} -> {$temps['code']} SWITCHCODE 완료.\n";
echo "SWITCHCODE 완료.\n";
}
}