File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11{{$NEXT}}
22 - wal_mode is now off by default, but can be enabled with the wal_mode option.
3+ - Fix issue where a transaction that failed to begin would rollback and clear the database handle error.
34
453.009 2022-03-22 20:16:03 EDT
56 - Fix race condition in Mojo::SQLite::Migrations where two processes could attempt to create the same migration. (#25, Oliver Kurz)
Original file line number Diff line number Diff line change @@ -10,14 +10,15 @@ has db => undef, weak => 1;
1010my %behaviors = map { ($_ => 1) } qw( deferred immediate exclusive) ;
1111
1212sub new {
13- my $self = shift -> SUPER::new(@_ , rollback => 1 );
13+ my $self = shift -> SUPER::new(@_ );
1414 my $dbh = $self -> {dbh } = $self -> db-> dbh;
1515 if (my $behavior = $self -> {behavior }) {
1616 croak qq{ Invalid transaction behavior $behavior } unless exists $behaviors {lc $behavior };
1717 $dbh -> do(" begin $behavior transaction" );
1818 } else {
1919 $dbh -> begin_work;
2020 }
21+ $self -> {rollback } = 1;
2122 return $self ;
2223}
2324
Original file line number Diff line number Diff line change @@ -148,6 +148,18 @@ my $sql = Mojo::SQLite->new;
148148 like $@ , qr / does_not_exist/ , ' right error' ;
149149 is_deeply $db -> query(' select * from results_test where name = ?' , ' tx3' )
150150 -> hashes-> to_array, [], ' no results' ;
151+ {
152+ my $timeout = $db -> dbh-> sqlite_busy_timeout // 0;
153+ $db -> dbh-> sqlite_busy_timeout(100);
154+ my $tx ;
155+ eval {
156+ $tx = $db -> begin(' immediate' );
157+ $db -> begin(' immediate' );
158+ };
159+ ok $@ , ' transaction failed' ;
160+ ok $db -> dbh-> err, ' database error code retained' ;
161+ $db -> dbh-> sqlite_busy_timeout($timeout );
162+ }
151163 };
152164
153165 subtest ' Issue #2' => sub {
You can’t perform that action at this time.
0 commit comments