| 1 | package EntityModel::Query::Join; | ||||||||||
| 2 | { | ||||||||||
| 3 | 34 | $EntityModel::Query::Join::VERSION = '0.102'; | |||||||||
| 4 | } | ||||||||||
| 5 | 34 | ▶ | use EntityModel::Class { | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 34 | 'table' => { type => 'EntityModel::Query::JoinTable' }, | |||||||||
| 7 | 'alias' => { type => 'string' }, | ||||||||||
| 8 | 'type' => { type => 'string' }, | ||||||||||
| 9 | 'on' => { type => 'array', subclass => 'EntityModel::Query::Condition' }, | ||||||||||
| 10 | 34 | }; | |||||||||
| 11 | |||||||||||
| 12 | =head1 NAME | ||||||||||
| 13 | |||||||||||
| 14 | EntityModel::Query::Join - base class for JOIN tables | ||||||||||
| 15 | |||||||||||
| 16 | =head1 VERSION | ||||||||||
| 17 | |||||||||||
| 18 | version 0.102 | ||||||||||
| 19 | |||||||||||
| 20 | =head1 SYNOPSIS | ||||||||||
| 21 | |||||||||||
| 22 | See L<Entitymodel::Query>. | ||||||||||
| 23 | |||||||||||
| 24 | =head1 DESCRIPTION | ||||||||||
| 25 | |||||||||||
| 26 | See L<Entitymodel::Query>. | ||||||||||
| 27 | |||||||||||
| 28 | =cut | ||||||||||
| 29 | |||||||||||
| 30 | =head1 METHODS | ||||||||||
| 31 | |||||||||||
| 32 | =cut | ||||||||||
| 33 | |||||||||||
| 34 | =head2 asString | ||||||||||
| 35 | |||||||||||
| 36 | =cut | ||||||||||
| 37 | |||||||||||
| 38 | 0 | ▶ | sub asString { | ||||||||
|
Subroutine
asString: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||
| 39 | 0 | my $self = shift; | |||||||||
| 40 | 0 | my @cond = $self->on->list; | |||||||||
| 41 | 0 | my $sql = $_->type . ' join ' . $self->table->asString . ' as ' . $_->alias; | |||||||||
| 42 | 0 | ▶ | $sql .= ' on ' . join(' and ', map { $_->asString } @cond) if @cond; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 43 | 0 | return $sql; | |||||||||
| 44 | } | ||||||||||
| 45 | |||||||||||
| 46 | 34 | 1; | |||||||||
| 47 | |||||||||||
| 48 | __END__ | ||||||||||