From 327779a950e2f2108096ba6e5ba9a78cd7470068 Mon Sep 17 00:00:00 2001 From: "Bradley M. Kuhn" Date: Sun, 6 Dec 2015 16:33:01 -0800 Subject: [PATCH] Correct quoting issue and add debugging output. --- scripts/db-convert-0.1-to-0.2.plx | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/scripts/db-convert-0.1-to-0.2.plx b/scripts/db-convert-0.1-to-0.2.plx index 04db400..43064a0 100644 --- a/scripts/db-convert-0.1-to-0.2.plx +++ b/scripts/db-convert-0.1-to-0.2.plx @@ -29,7 +29,7 @@ my %tShirt0SizeRequestConfigurationIds; my $sthInsertRequestConfiguration = $dbhNew->prepare("INSERT INTO request_configuration" . "(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/) { $sthInsertRequestConfiguration->execute($requestTypeId, $size); $tShirt0SizeRequestConfigurationIds{$size} = $dbhNew->last_insert_id("","","",""); @@ -43,12 +43,14 @@ $sthInsertRequestType->finish(); # Only one email Adress type so far my $sthNew = $dbhNew->prepare("INSERT INTO address_type(name) values('paypal_payer')"); +$sthNew->execute(); my $paypalPayerTypeId = $dbhNew->last_insert_id("","","",""); $sthNew->finish(); # Legacy fulfillment confirmation $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')"); +$sthNew->execute(); my $fulfillmentId = $dbhNew->last_insert_id("","","",""); $sthNew->finish(); @@ -77,6 +79,7 @@ while (my $row = $sthOld->fetchrow_hashref) { $sthNewInsertSupporter->execute($row->{ledger_entity_id}, $row->{display_name}, $row->{public_ack}); 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") unless ($row->{id} == $supporterId); if ($row->{want_gift}) { @@ -97,11 +100,12 @@ while (my $row = $sthOld->fetchrow_hashref) { my $postalId = $dbhNew->last_insert_id("","","",""); $sthLinkSupporterToPostal->execute($supporterId, $postalId); } -foreach my $sth (qw/$sthOld $sthOld $sthNewInsertSupporter $sthInsertEmailAddress - $sthLinkSupporterToEmail $sthInsertRequest $sthPostalAddress $sthLinkSupporterToPostal/) { +foreach my $sth (($sthOld, $sthOld, $sthNewInsertSupporter, $sthInsertEmailAddress, + $sthLinkSupporterToEmail, $sthInsertRequest, $sthPostalAddress, + $sthLinkSupporterToPostal,)) { $sth->finish(); } -foreach my $dbh (qw/$dbhNew $dbhOld/) { +foreach my $dbh ($dbhNew, $dbhOld) { $dbhNew->disconnect(); }