lib/DBIx/ActiveRecord/Arel/Query/Insert.pm

filter: Statementstmt 92.5% 25 / 27 Branchbran 50.0% 1 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 7 / 7 Podpod 0.0% 0 / 3 totaltotal 84.6% 33 / 39 CC 2 SCAR 2.4
CC
2
Cov
90%
_to_sql
2.1
BEGIN
1.0
BEGIN
1.0
CRAP 1.3
« lib/DBIx/ActiveRecord/Arel/Query/Delete.pm ↑ Summary lib/DBIx/ActiveRecord/Arel.pm »
1 package DBIx::ActiveRecord::Arel::Query::Insert;
2 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use base 'DBIx::ActiveRecord::Arel::Query';
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
Pod undocumented
7 1 my ($self, $main, $hash, $columns) = @_;
8 1 my $o = $self->SUPER::new($main);
9 1 $o->{hash} = $hash;
10 1 $o->{columns} = $columns;
11 1 $o;
12 }
13  
14 1 ▶sub columns {shift->{columns}}
Subroutine columns: called CC=1 SCAR=0.0
Pod undocumented
15 3 ▶sub hash {shift->{hash}}
Subroutine hash: called CC=1 SCAR=0.0
Pod undocumented
16  
17 1 ▶sub _to_sql {
Subroutine _to_sql: called CC=2 SCAR=7.2
18 1 my ($self) = @_;
19  
20 0 ▶ my @keys = $self->columns ? grep {exists $self->hash->{$_}} @{$self->columns} : keys %{$self->hash};
Branch: 1 branch
BranchTrueFalseTotal
$self->columns ? : 0 1 1
21 1 my $sql = 'INSERT INTO '.$self->main->table.' ('.join(', ', @keys).') VALUES ('.join(', ', map {'?'} @keys).')';
22 1 $self->{binds} = [map {$self->hash->{$_}} @keys];
23 1 $sql;
24 }
25  
26 2 1;
« lib/DBIx/ActiveRecord/Arel/Query/Delete.pm ↑ Summary lib/DBIx/ActiveRecord/Arel.pm »