File Coverage

blib/lib/DBIx/DBO/DBD/SQLite.pm
Criterion Covered Total %
statement 23 23 100.0
branch 3 6 50.0
condition 2 6 33.3
subroutine 7 7 100.0
pod n/a
total 35 42 83.3


line stmt bran cond sub pod time code
1 1     1   5 use strict;
  1         2  
  1         34  
2 1     1   5 use warnings;
  1         3  
  1         34  
3 1     1   5 use DBD::SQLite 1.31;
  1         76  
  1         39  
4              
5 1 50   1   29 BEGIN { die 'DBD::SQLite version 1.31 required (but not version 1.38_01)' if $DBD::SQLite::VERSION eq '1.38_01' }
6              
7             package # hide from PAUSE
8             DBIx::DBO::DBD::SQLite;
9 1     1   5 use Carp 'croak';
  1         1  
  1         325  
10              
11             sub _get_table_schema {
12 9     9   18 my($class, $me, $schema, $table) = @_;
13              
14 9         15 my $q_schema = $schema;
15 9         16 my $q_table = $table;
16 9 50       27 $q_schema =~ s/([\\_%])/\\$1/g if defined $q_schema;
17 9         109 $q_table =~ s/([\\_%])/\\$1/g;
18              
19             # Try just these types
20 9         32 my $info = $me->rdbh->table_info(undef, $q_schema, $q_table,
21             'TABLE,VIEW,GLOBAL TEMPORARY,LOCAL TEMPORARY,SYSTEM TABLE', {Escape => '\\'})->fetchall_arrayref;
22 9 50 33     3906 croak 'Invalid table: '.$class->_qi($me, $schema, $table) unless $info and @$info == 1 and $info->[0][2] eq $table;
      33        
23 9         59 return $info->[0][1];
24             }
25              
26             sub _save_last_insert_id {
27 7     7   19 my($class, $me, $sth) = @_;
28 7         135 $sth->{Database}->last_insert_id(undef, @$me{qw(Schema Name)}, undef);
29             }
30              
31             1;