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 final public function switchcode(): void
{ {
$this->execute( $processor = new SWITCHCodeProcess($this->getTargetDB());
new SWITCHCodeProcess($this->getTargetDB()), $processor->make();
$this->getSWITCHCode(),
__FUNCTION__,
$this->getDBName()
);
} }
} }

View File

@ -11,14 +11,19 @@ class SwitchCodeProcess implements MigrationProcessInterface
{ {
$this->db = $db; $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 = []; for ($i = 1; $i <= 88; $i++) {
$temps['code'] = trim($row['service_sw']); for ($j = 1; $j <= 48; $j++) {
$temps['status'] = STATUS['AVAILABLE']; // Assuming SWITCHEntity has a STATUS_DEFAULT constant $temps = [];
if (!$this->db->table('switchinfo')->insert($temps)) { $temps['code'] = sprintf("C%02dPA%02d", $i, $j);
throw new \Exception($this->db->error()['message']); $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";
} }
} }