| 1 | package DBIx::Connector::Driver::Oracle; | ||||||||||
| 2 | |||||||||||
| 3 | 2 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 2 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 2 | ▶ | use base 'DBIx::Connector::Driver'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 2 | our $VERSION = '0.55'; | |||||||||
| 7 | |||||||||||
| 8 | # Note from https://rt.cpan.org/Ticket/Display.html?id=47005: | ||||||||||
| 9 | # DBD::Oracle has some shutdown state in which it will return 1 on ping as | ||||||||||
| 10 | # long as the socket is still open. This however did not guarantee the server | ||||||||||
| 11 | # is any longer in a state to execute queries. So what happened was: | ||||||||||
| 12 | # | ||||||||||
| 13 | # 1) the weird state is reached | ||||||||||
| 14 | # 2) a txn_do takes place and fails on the first sql command | ||||||||||
| 15 | # 3) the code calls ping() and gets a connected reply | ||||||||||
| 16 | # 4) the txn_do is not retried | ||||||||||
| 17 | # 5) ... | ||||||||||
| 18 | # 6) users lose profit | ||||||||||
| 19 | |||||||||||
| 20 | sub ping { | ||||||||||
| 21 | 0 | ▶ | my ($self, $dbh) = @_; | ||||||||
|
Subroutine
ping: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||
| 22 | 0 | eval { | |||||||||
| 23 | 0 | local $dbh->{RaiseError} = 1; | |||||||||
| 24 | 0 | $dbh->do('select 1 from dual'); | |||||||||
| 25 | }; | ||||||||||
| 26 | 0 | ▶ | return $@ ? 0 : 1; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 27 | } | ||||||||||
| 28 | |||||||||||
| 29 | sub savepoint { | ||||||||||
| 30 | 0 | ▶ | my ($self, $dbh, $name) = @_; | ||||||||
|
Subroutine
savepoint: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 31 | 0 | $dbh->do("SAVEPOINT $name"); | |||||||||
| 32 | } | ||||||||||
| 33 | |||||||||||
| 34 | # Oracle automatically releases a savepoint when you start another one with | ||||||||||
| 35 | # the same name. | ||||||||||
| 36 | 0 | ▶ | sub release { 1 } | ||||||||
|
Subroutine
release: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 37 | |||||||||||
| 38 | sub rollback_to { | ||||||||||
| 39 | 0 | ▶ | my ($self, $dbh, $name) = @_; | ||||||||
|
Subroutine
rollback_to: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 40 | 0 | $dbh->do("ROLLBACK TO SAVEPOINT $name"); | |||||||||
| 41 | } | ||||||||||
| 42 | |||||||||||
| 43 | 2 | 1; | |||||||||
| 44 | __END__ | ||||||||||
| 45 | |||||||||||
| 46 | =head1 Name | ||||||||||
| 47 | |||||||||||
| 48 | DBIx::Connector::Driver::Oracle - Oracle-specific connection interface | ||||||||||
| 49 | |||||||||||
| 50 | =head1 Description | ||||||||||
| 51 | |||||||||||
| 52 | This subclass of L<DBIx::Connector::Driver|DBIx::Connector::Driver> provides | ||||||||||
| 53 | Oracle-specific implementations of the following methods: | ||||||||||
| 54 | |||||||||||
| 55 | =over | ||||||||||
| 56 | |||||||||||
| 57 | =item C<ping> | ||||||||||
| 58 | |||||||||||
| 59 | =item C<savepoint> | ||||||||||
| 60 | |||||||||||
| 61 | =item C<release> | ||||||||||
| 62 | |||||||||||
| 63 | =item C<rollback_to> | ||||||||||
| 64 | |||||||||||
| 65 | =back | ||||||||||
| 66 | |||||||||||
| 67 | =head1 Authors | ||||||||||
| 68 | |||||||||||
| 69 | This module was written and is maintained by: | ||||||||||
| 70 | |||||||||||
| 71 | =over | ||||||||||
| 72 | |||||||||||
| 73 | =item David E. Wheeler <david@kineticode.com> | ||||||||||
| 74 | |||||||||||
| 75 | =back | ||||||||||
| 76 | |||||||||||
| 77 | It is based on code written by: | ||||||||||
| 78 | |||||||||||
| 79 | =over | ||||||||||
| 80 | |||||||||||
| 81 | =item Matt S. Trout <mst@shadowcatsystems.co.uk> | ||||||||||
| 82 | |||||||||||
| 83 | =item Peter Rabbitson <rabbit+dbic@rabbit.us> | ||||||||||
| 84 | |||||||||||
| 85 | =item David Jack Olrik <djo@cpan.org> | ||||||||||
| 86 | |||||||||||
| 87 | =back | ||||||||||
| 88 | |||||||||||
| 89 | =head1 Copyright and License | ||||||||||
| 90 | |||||||||||
| 91 | Copyright (c) 2009-2013 David E. Wheeler. Some Rights Reserved. | ||||||||||
| 92 | |||||||||||
| 93 | This module is free software; you can redistribute it and/or modify it under | ||||||||||
| 94 | the same terms as Perl itself. | ||||||||||
| 95 | |||||||||||
| 96 | =cut | ||||||||||