| 1 | package SPOPS::Exception::DBI; | ||||||||||
| 2 | |||||||||||
| 3 | # $Id: DBI.pm,v 3.3 2004/06/02 00:48:22 lachoy Exp $ | ||||||||||
| 4 | |||||||||||
| 5 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 1 | ▶ | use base qw( SPOPS::Exception ); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | 1 | $SPOPS::Exception::DBI::VERSION = sprintf("%d.%02d", q$Revision: 3.3 $ =~ /(\d+)\.(\d+)/); | |||||||||
| 9 | 1 | @SPOPS::Exception::DBI::EXPORT_OK = qw( spops_dbi_error ); | |||||||||
| 10 | |||||||||||
| 11 | 1 | my @FIELDS = qw( sql bound_value action ); | |||||||||
| 12 | 1 | SPOPS::Exception::DBI->mk_accessors( @FIELDS ); | |||||||||
| 13 | |||||||||||
| 14 | 1 | ▶ | sub get_fields { | ||||||||
|
Subroutine
get_fields: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 15 | 1 | return ( $_[0]->SUPER::get_fields, @FIELDS ); | |||||||||
| 16 | } | ||||||||||
| 17 | |||||||||||
| 18 | 0 | ▶ | sub spops_dbi_error { | ||||||||
|
Subroutine
spops_dbi_error: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 19 | 0 | goto &SPOPS::Exception::throw( 'SPOPS::Exception::DBI', @_ ); | |||||||||
| 20 | } | ||||||||||
| 21 | |||||||||||
| 22 | 1 | ▶ | sub to_string { | ||||||||
|
Subroutine
to_string: called CC=5 SCAR=18.3
Pod
undocumented
| |||||||||||
| 23 | 1 | my ( $self ) = @_; | |||||||||
| 24 | 1 | my $class = ref $self; | |||||||||
| 25 | 1 | ▶ | return "Invalid -- not called from object." unless ( $class ); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 26 | |||||||||||
| 27 | 1 | ▶ | no strict 'refs'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 28 | 1 | ▶ | if ( $self->sql ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 29 | 1 | ▶ | return ( ${ $class . '::ShowTrace' } ) | ||||||||
|
Branch: 1 branch
| |||||||||||
| 30 | ? join( "\n", $self->message, $self->sql, $self->trace->as_string ) | ||||||||||
| 31 | : join( "\n", $self->message(), $self->sql ); | ||||||||||
| 32 | } | ||||||||||
| 33 | else { | ||||||||||
| 34 | 0 | ▶ | return ( ${ $class . '::ShowTrace' } ) | ||||||||
|
Branch: 1 branch
| |||||||||||
| 35 | ? join( "\n", $self->message, $self->trace->as_string ) | ||||||||||
| 36 | : $self->message(); | ||||||||||
| 37 | } | ||||||||||
| 38 | } | ||||||||||
| 39 | |||||||||||
| 40 | 1 | 1; | |||||||||
| 41 | |||||||||||
| 42 | __END__ | ||||||||||