| 1 | 1 | ▶ | use strict; use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 2 | |||||||||||
| 3 | package DBIx::Connector::Driver::Oracle; | ||||||||||
| 4 | |||||||||||
| 5 | 1 | ▶ | use DBIx::Connector::Driver; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | 1 | our $VERSION = '0.60'; | |||||||||
| 8 | 1 | our @ISA = qw( DBIx::Connector::Driver ); | |||||||||
| 9 | |||||||||||
| 10 | # Note from https://rt.cpan.org/Ticket/Display.html?id=47005: | ||||||||||
| 11 | # DBD::Oracle has some shutdown state in which it will return 1 on ping as | ||||||||||
| 12 | # long as the socket is still open. This however did not guarantee the server | ||||||||||
| 13 | # is any longer in a state to execute queries. So what happened was: | ||||||||||
| 14 | # | ||||||||||
| 15 | # 1) the weird state is reached | ||||||||||
| 16 | # 2) a txn_do takes place and fails on the first sql command | ||||||||||
| 17 | # 3) the code calls ping() and gets a connected reply | ||||||||||
| 18 | # 4) the txn_do is not retried | ||||||||||
| 19 | # 5) ... | ||||||||||
| 20 | # 6) users lose profit | ||||||||||
| 21 | |||||||||||
| 22 | 0 | ▶ | sub ping { | ||||||||
|
Subroutine
ping: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||
| 23 | 0 | my ($self, $dbh) = @_; | |||||||||
| 24 | 0 | eval { | |||||||||
| 25 | 0 | local $dbh->{RaiseError} = 1; | |||||||||
| 26 | 0 | $dbh->do('select 1 from dual'); | |||||||||
| 27 | }; | ||||||||||
| 28 | 0 | ▶ | return $@ ? 0 : 1; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 29 | } | ||||||||||
| 30 | |||||||||||
| 31 | 0 | ▶ | sub savepoint { | ||||||||
|
Subroutine
savepoint: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 32 | 0 | my ($self, $dbh, $name) = @_; | |||||||||
| 33 | 0 | $dbh->do("SAVEPOINT $name"); | |||||||||
| 34 | } | ||||||||||
| 35 | |||||||||||
| 36 | # Oracle automatically releases a savepoint when you start another one with | ||||||||||
| 37 | # the same name. | ||||||||||
| 38 | 0 | ▶ | sub release { 1 } | ||||||||
|
Subroutine
release: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 39 | |||||||||||
| 40 | 0 | ▶ | sub rollback_to { | ||||||||
|
Subroutine
rollback_to: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 41 | 0 | my ($self, $dbh, $name) = @_; | |||||||||
| 42 | 0 | $dbh->do("ROLLBACK TO SAVEPOINT $name"); | |||||||||
| 43 | } | ||||||||||
| 44 | |||||||||||
| 45 | 1 | 1; | |||||||||
| 46 | |||||||||||
| 47 | __END__ | ||||||||||