Begin switch to use API rather than direct DB call
This commit is contained in:
		
							parent
							
								
									19d513280f
								
							
						
					
					
						commit
						302b2b6f8b
					
				
					 1 changed files with 8 additions and 4 deletions
				
			
		|  | @ -5,6 +5,7 @@ use warnings; | ||||||
| 
 | 
 | ||||||
| use DBI; | use DBI; | ||||||
| use Encode qw(encode decode); | use Encode qw(encode decode); | ||||||
|  | use Supporter; | ||||||
| 
 | 
 | ||||||
| my($OLD_SUPPORTERS_SQLITE_DB_FILE, $NEW_SUPPORTERS_SQLITE_DB_FILE) = @ARGV; | my($OLD_SUPPORTERS_SQLITE_DB_FILE, $NEW_SUPPORTERS_SQLITE_DB_FILE) = @ARGV; | ||||||
| 
 | 
 | ||||||
|  | @ -75,11 +76,14 @@ my $sthPostalAddress = $dbhNew->prepare('INSERT INTO postal_address(formatted_ad | ||||||
| 
 | 
 | ||||||
| my $sthOld = $dbhOld->prepare('SELECT * from supporters order by id;'); | my $sthOld = $dbhOld->prepare('SELECT * from supporters order by id;'); | ||||||
| $sthOld->execute(); | $sthOld->execute(); | ||||||
|  | 
 | ||||||
|  | my $sp = new Supporter($dbhNew, "/usr/bin/ledger"); | ||||||
|  | 
 | ||||||
| while (my $row = $sthOld->fetchrow_hashref) { | while (my $row = $sthOld->fetchrow_hashref) { | ||||||
|   $sthNewInsertSupporter->execute($row->{ledger_entity_id}, $row->{display_name}, |   $row->{email_address_type} = 'paypal'; | ||||||
|                                   $row->{public_ack}); |   $row->{email_address} = $row->{paypal_payer}; | ||||||
|   my $supporterId = $dbhNew->last_insert_id("","","",""); |   my $supporterId = $sp->addSupporter($row); | ||||||
|   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}) { | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 Bradley M. Kuhn
						Bradley M. Kuhn