X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~yarrgweb/git?a=blobdiff_plain;f=yarrg%2Fdb-idempotent-populate;h=1d106f2b4f9ef6924cebc6f19b0677ce8352d008;hb=a9a88c14c5a5bd057932f76ad721b5f0fc845c20;hp=143e2ef9d518e2e733d221365c372971b3ad29e0;hpb=1478fddc005bdaa1fa3ab731a0bd59613502e90d;p=ypp-sc-tools.db-test.git diff --git a/yarrg/db-idempotent-populate b/yarrg/db-idempotent-populate index 143e2ef..1d106f2 100755 --- a/yarrg/db-idempotent-populate +++ b/yarrg/db-idempotent-populate @@ -102,6 +102,13 @@ db_doall(<commit; } -#---------- island list ---------- -#---------- routes ---------- -# now done by yppedia-chart-parser - -__DATA__ +#---------- vessel types ---------- +{ + my $idempotent= $dbh->prepare(<<'END') + INSERT OR REPLACE INTO vessels (name, shot, mass, volume) + VALUES (?,?,?,?) +END + ; + foreach my $name (sort keys %vessels) { + my $v= $vessels{$name}; + my $shotdamage= $shotname2damage{$v->{Shot}}; + die "no shot damage for shot $v->{Shot} for vessel $name" + unless defined $shotdamage; + my @qa= ($name, $shotdamage, map { $v->{$_} } qw(Mass Volume)); + $idempotent->execute(@qa); + } + $dbh->commit; +}