New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for transactions #84
Conversation
begin and commit are very common database operations. They don't need signposting with comments
| @@ -637,13 +637,17 @@ sub save_data_values | |||
| { | |||
| foreach my $epid ( keys %{$data->{$date}} ) | |||
| { | |||
| $self->{dbh}->begin; #start transaction if DB engine supports it | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Redundant comment
| @@ -230,6 +230,8 @@ sub populate_tables | |||
|
|
|||
| my $eprintid = $eprint->get_id; | |||
|
|
|||
| $self->handler->{dbh}->begin; #make all changes in one transaction if DB engine supports them | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Redundant comment
| @@ -257,6 +259,8 @@ sub populate_tables | |||
| $display_cache->{$set_name}->{$raw_value} = 1; | |||
| } | |||
| } | |||
|
|
|||
| $self->handler->{dbh}->commit; #end transaction | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Redundant comment
| foreach my $value ( keys %{$data->{$date}->{$epid}} ) | ||
| { | ||
| $i = 0; | ||
| $sth->bind_param( ++$i, $_ ) for( ( $counter, $epid, $date, $value, ($data->{$date}->{$epid}->{$value}) ) ); | ||
| $rc &&= $sth->execute(); | ||
| $counter++; | ||
| $counter++; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unrelated whitespace changes
|
Any reason you're using begin over begin_work? Is there a nice Perl dbi function that does automatic transactions/subtransactions with save points and manages exception rollbacks |
|
Hi @graingert - I tried In IRStats2, I think the |
Redundant (review by @graingert).
Fixes #83
The text was updated successfully, but these errors were encountered: