File Coverage

blib/lib/DBIx/ParseException/SQLite.pm
Criterion Covered Total %
statement 7 21 33.3
branch 0 8 0.0
condition n/a
subroutine 3 5 60.0
pod 0 2 0.0
total 10 36 27.7


line stmt bran cond sub pod time code
1             package DBIx::ParseException::SQLite;
2             BEGIN {
3 1     1   10608 $DBIx::ParseException::SQLite::VERSION = '0.001000_03';
4             }
5              
6 1     1   596 use DBIx::Exceptions;
  1         5  
  1         323  
7              
8 0     0 0   sub capabilities { $_[0] }
9              
10             sub error_handler {
11 0     0 0   my $string = shift;
12 0           my @args = ( original => $string );
13 0           my $class = 'DBIx::Exception';
14              
15 0 0         if (my ($column) = $string =~ /^DBD::SQLite::st \s+ execute \s+ failed: \s+ (?:constraint \s+ failed \s+)?
    0          
    0          
    0          
16             column \s+ (.*) \s+ is \s+ not \s+ unique/ixm) {
17 0           $class .= '::NotUnique';
18 0           push @args, ( column => $column );
19             } elsif ($string =~ /^DBD::SQLite::db \s+ prepare \s+ failed: \s+ near \s+
20             "(.*)": \s+ syntax \s+ error/ixm) {
21 0           $class .= '::Syntax';
22 0           push @args, ( near => $1 );
23             } elsif ($string =~ /^DBD::SQLite::db \s+ prepare \s+ failed: \s+ no \s+
24             such \s+ table: \s+ (.*)/ixm) {
25 0           $class .= '::NoSuchTable';
26 0           push @args, ( table => $1 );
27             } elsif ($string =~ /^DBD::SQLite::db \s+ prepare \s+ failed: \s+ table \s+
28             (.*) \s+ has \s+ no \s+ column \s+ named \s+ (.*)/ixm) {
29 0           $class .= '::NoSuchColumn';
30 0           push @args, ( table => $1, column => $2 );
31             }
32              
33 0           $class->throw(@args);
34             }
35              
36             use constant {
37 1         124 can_unique_constraint => 1,
38             can_unique_constraint_column => 1,
39              
40             can_syntax => 1,
41             can_syntax_near => 1,
42              
43             can_no_such_table => 1,
44             can_no_such_table_table => 1,
45              
46             can_no_such_column => 1,
47             can_no_such_column_table => 1,
48             can_no_such_column_column => 1,
49 1     1   10 };
  1         2  
50              
51             1;
52             # vim: ts=2 tw=2 expandtab
53              
54             __END__