File Coverage

lib/DBIx/ActiveRecord/Arel/Query/Select.pm
Criterion Covered Total %
statement 19 19 100.0
branch 8 8 100.0
condition n/a
subroutine 4 4 100.0
pod n/a
total 31 31 100.0


line stmt bran cond sub pod time code
1             package DBIx::ActiveRecord::Arel::Query::Select;
2 2     2   10 use strict;
  2         4  
  2         83  
3 2     2   9 use warnings;
  2         4  
  2         49  
4 2     2   8 use base 'DBIx::ActiveRecord::Arel::Query';
  2         3  
  2         1316  
5              
6             sub _to_sql {
7 35     35   37 my ($self) = @_;
8              
9 35 100       72 my $table = $self->has_join ? $self->main_table_with_alias : $self->main->table;
10 35         103 my $sql = 'SELECT '.$self->build_select.' FROM ' . $table;
11 35         133 my $join = $self->build_join;
12 35 100       85 $sql .= ' '.$join if $join;
13 35         90 my $where = $self->build_where;
14 35 100       81 $sql .= " WHERE $where" if $where;
15 35         88 my $ops .= $self->build_options;
16 35 100       72 $sql .= " $ops" if $ops;
17 35         84 $sql;
18             }
19              
20             1;