Correct quoting issue and add debugging output.

This commit is contained in:
Bradley M. Kuhn 2015-12-06 16:33:01 -08:00
parent 98b62c7e97
commit 327779a950

View file

@ -29,7 +29,7 @@ my %tShirt0SizeRequestConfigurationIds;
my $sthInsertRequestConfiguration = $dbhNew->prepare("INSERT INTO request_configuration" . my $sthInsertRequestConfiguration = $dbhNew->prepare("INSERT INTO request_configuration" .
"(request_type_id, description) values(?, ?)"); "(request_type_id, description) values(?, ?)");
foreach my $requestTypeId (qw/$tShirt1RequestTypeId $tShirt0RequestTypeId/) { foreach my $requestTypeId ($tShirt1RequestTypeId, $tShirt0RequestTypeId) {
foreach my $size (qw/LadiesS LadiesM LadiesL LadiesXL MenS MenM MenL MenXL Men2XL/) { foreach my $size (qw/LadiesS LadiesM LadiesL LadiesXL MenS MenM MenL MenXL Men2XL/) {
$sthInsertRequestConfiguration->execute($requestTypeId, $size); $sthInsertRequestConfiguration->execute($requestTypeId, $size);
$tShirt0SizeRequestConfigurationIds{$size} = $dbhNew->last_insert_id("","","",""); $tShirt0SizeRequestConfigurationIds{$size} = $dbhNew->last_insert_id("","","","");
@ -43,12 +43,14 @@ $sthInsertRequestType->finish();
# Only one email Adress type so far # Only one email Adress type so far
my $sthNew = $dbhNew->prepare("INSERT INTO address_type(name) values('paypal_payer')"); my $sthNew = $dbhNew->prepare("INSERT INTO address_type(name) values('paypal_payer')");
$sthNew->execute();
my $paypalPayerTypeId = $dbhNew->last_insert_id("","","",""); my $paypalPayerTypeId = $dbhNew->last_insert_id("","","","");
$sthNew->finish(); $sthNew->finish();
# Legacy fulfillment confirmation # Legacy fulfillment confirmation
$sthNew = $dbhNew->prepare("INSERT INTO fulfillment(date, who, how)" . $sthNew = $dbhNew->prepare("INSERT INTO fulfillment(date, who, how)" .
"values(date('now'), 'bkuhn', 'legacy import of old database; exact details of this fulfillment are unknown')"); "values(date('now'), 'bkuhn', 'legacy import of old database; exact details of this fulfillment are unknown')");
$sthNew->execute();
my $fulfillmentId = $dbhNew->last_insert_id("","","",""); my $fulfillmentId = $dbhNew->last_insert_id("","","","");
$sthNew->finish(); $sthNew->finish();
@ -77,6 +79,7 @@ while (my $row = $sthOld->fetchrow_hashref) {
$sthNewInsertSupporter->execute($row->{ledger_entity_id}, $row->{display_name}, $sthNewInsertSupporter->execute($row->{ledger_entity_id}, $row->{display_name},
$row->{public_ack}); $row->{public_ack});
my $supporterId = $dbhNew->last_insert_id("","","",""); my $supporterId = $dbhNew->last_insert_id("","","","");
print STDERR "handling $supporterId ($row->{ledger_entity_id})\n";
die("Database conversion failed on id matching: $row->{ledger_entity_id} had ID $row->{id} now has $supporterId") die("Database conversion failed on id matching: $row->{ledger_entity_id} had ID $row->{id} now has $supporterId")
unless ($row->{id} == $supporterId); unless ($row->{id} == $supporterId);
if ($row->{want_gift}) { if ($row->{want_gift}) {
@ -97,11 +100,12 @@ while (my $row = $sthOld->fetchrow_hashref) {
my $postalId = $dbhNew->last_insert_id("","","",""); my $postalId = $dbhNew->last_insert_id("","","","");
$sthLinkSupporterToPostal->execute($supporterId, $postalId); $sthLinkSupporterToPostal->execute($supporterId, $postalId);
} }
foreach my $sth (qw/$sthOld $sthOld $sthNewInsertSupporter $sthInsertEmailAddress foreach my $sth (($sthOld, $sthOld, $sthNewInsertSupporter, $sthInsertEmailAddress,
$sthLinkSupporterToEmail $sthInsertRequest $sthPostalAddress $sthLinkSupporterToPostal/) { $sthLinkSupporterToEmail, $sthInsertRequest, $sthPostalAddress,
$sthLinkSupporterToPostal,)) {
$sth->finish(); $sth->finish();
} }
foreach my $dbh (qw/$dbhNew $dbhOld/) { foreach my $dbh ($dbhNew, $dbhOld) {
$dbhNew->disconnect(); $dbhNew->disconnect();
} }