| 1 | package DBIx::Skinny::Schema::Loader::DBI; | ||||||||||
| 2 | 15 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | 15 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | |||||||||||
| 5 | |||||||||||
| 6 | 15 | ▶ | use Carp; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | 16 | ▶ | sub new { | ||||||||
|
Subroutine
new: called CC=4 SCAR=14.1
Pod
undocumented
| |||||||||||
| 9 | 16 | my ($class, $fields) = @_; | |||||||||
| 10 | 16 | ▶ | $fields = {} unless defined $fields; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 11 | 16 | for ( qw/dsn user pass/ ) { | |||||||||
| 12 | 48 | ▶ | croak "$_ is required" unless defined $fields->{ $_ } | ||||||||
|
Branch: 1 branch
| |||||||||||
| 13 | } | ||||||||||
| 14 | |||||||||||
| 15 | 16 | my $self = bless {connect_options => {}, %$fields}, $class; | |||||||||
| 16 | 16 | $self->{ dbh } = DBI->connect($self->{ dsn }, $self->{ user }, $self->{ pass }, $self->{connect_options}); | |||||||||
| 17 | 15 | return $self; | |||||||||
| 18 | } | ||||||||||
| 19 | |||||||||||
| 20 | 0 | ▶ | sub quoter { | ||||||||
|
Subroutine
quoter: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 21 | 0 | my $self = shift; | |||||||||
| 22 | 0 | $self->{ dbh }->get_info(29); | |||||||||
| 23 | } | ||||||||||
| 24 | |||||||||||
| 25 | 0 | ▶ | sub namesep { | ||||||||
|
Subroutine
namesep: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 26 | 0 | my $self = shift; | |||||||||
| 27 | 0 | $self->{ dbh }->get_info(41); | |||||||||
| 28 | } | ||||||||||
| 29 | |||||||||||
| 30 | 64 | ▶ | sub table_columns { | ||||||||
|
Subroutine
table_columns: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 31 | 64 | my ($self, $table) = @_; | |||||||||
| 32 | 64 | my $sth = $self->{ dbh }->prepare("select * from $table where 1 = 0"); | |||||||||
| 33 | 64 | $sth->execute; | |||||||||
| 34 | 64 | my $retval = \@{$sth->{NAME_lc}}; | |||||||||
| 35 | 64 | $sth->finish; | |||||||||
| 36 | 64 | return $retval; | |||||||||
| 37 | } | ||||||||||
| 38 | |||||||||||
| 39 | 69 | ▶ | sub table_pk { | ||||||||
|
Subroutine
table_pk: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||
| 40 | 69 | my ($self, $table) = @_; | |||||||||
| 41 | 69 | my @keys = $self->{ dbh }->primary_key(undef, undef, $table); | |||||||||
| 42 | 69 | ▶ | if ( @keys ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 43 | 36 | @keys = map { lc($_) } @keys; | |||||||||
| 44 | 36 | ▶ | return $#keys ? \@keys : $keys[0]; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 45 | } | ||||||||||
| 46 | 33 | return []; | |||||||||
| 47 | } | ||||||||||
| 48 | |||||||||||
| 49 | 15 | 1; | |||||||||