Fix rollbacks calls properly here.
Upon fixing the reference counter thing in the previous commit, this bug caused tests to fail. We have to _rollback() properly any time we've called _begin_work(), particularly before die()'ing after a _begin_work().
This commit is contained in:
		
							parent
							
								
									ea60b11965
								
							
						
					
					
						commit
						031fbab35a
					
				
					 1 changed files with 5 additions and 3 deletions
				
			
		|  | @ -389,15 +389,17 @@ sub addRequestConfigurations($$$) { | |||
| 
 | ||||
|   my $requestId = $self->addRequestType($requestType); | ||||
| 
 | ||||
|   die "addRequestConfigurations: unable to create request configurations" | ||||
|     unless defined $requestType; | ||||
|   if (not defined $requestType) { | ||||
|     $self->_rollback(); | ||||
|     die "addRequestConfigurations: unable to create request configurations"; | ||||
|   } | ||||
| 
 | ||||
|   my %descriptions; | ||||
|   my $sth = $self->dbh->prepare("INSERT INTO request_configuration(request_type_id, description) " . | ||||
|                                                            "VALUES(?,               ?)"); | ||||
|   foreach my $description (@{$descriptionListRef}) { | ||||
|     if (defined $descriptions{$description}) { | ||||
|       $self->dbh->rollback(); | ||||
|       $self->_rollback(); | ||||
|       die "addRequestConfigurations: attempt to create duplicate request_configuration \"$description\" for requestType, \"$requestType\""; | ||||
|     } | ||||
|     $sth->execute($requestId, $description); | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 Bradley M. Kuhn
						Bradley M. Kuhn