Wrap addSupporter operations in transaction
All of the addSupporter must now succeed (including sub-operations like addEmailAddress). This causes one failing test to now pass: ok 55 - addSupporter: fails if email_address given but email cannot be inserted
This commit is contained in:
		
							parent
							
								
									74146a15c9
								
							
						
					
					
						commit
						6e10f76d5a
					
				
					 1 changed files with 2 additions and 0 deletions
				
			
		|  | @ -96,6 +96,7 @@ sub addSupporter ($$) { | |||
|   if ($sp->{public_ack}) { | ||||
|     die "display_name required if public_ack requested" unless defined $sp->{display_name}; | ||||
|   } | ||||
|   $this->_beginWork; | ||||
|   my $sth = $this->dbh->prepare( | ||||
|                       "INSERT INTO supporter(ledger_entity_id, display_name, public_ack)" . | ||||
|                                     " values(?,                ?,            ?)"); | ||||
|  | @ -107,6 +108,7 @@ sub addSupporter ($$) { | |||
|   $this->addEmailAddress($id, $sp->{email_address}, $sp->{email_address_type}) | ||||
|     if defined $sp->{email_address}; | ||||
| 
 | ||||
|   $this->_commit; | ||||
|   return $id; | ||||
| } | ||||
| ###################################################################### | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 Bradley M. Kuhn
						Bradley M. Kuhn