| 1 | 2 | ▶ | use 5.20.0; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 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 | |||||||||||||||||||||||||||||
| 5 | package DBIx::Class::Smooth::Lookup::ident; | ||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | # ABSTRACT: Short intro | ||||||||||||||||||||||||||||
| 8 | 2 | our $AUTHORITY = 'cpan:CSSON'; # AUTHORITY | |||||||||||||||||||||||||||
| 9 | 2 | our $VERSION = '0.0105'; | |||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | 2 | ▶ | use parent 'DBIx::Class::Smooth::Lookup::Util'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 12 | 2 | ▶ | use Carp qw/confess/; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 13 | 2 | ▶ | use experimental qw/signatures postderef/; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | ▶ | sub smooth__lookup__ident($self, $column, $value, @rest) { | |||||||||||||||||||||||||||
|
Subroutine
smooth__lookup__ident: not called CC=8 SCAR=42.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 16 | 0 | $self->smooth__lookup_util__ensure_value_is_scalar('ident', $value); | |||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | 0 | return { operator => '-ident', value => $self->result_source->storage->sql_maker->_quote($value) }; | |||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | 0 | my($possible_relation, $possible_column) = split /\./, $value; | |||||||||||||||||||||||||||
| 21 | 0 | ▶ | $possible_relation = undef if $possible_relation eq 'me'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | 0 | ▶ | if($possible_relation && $possible_column) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$possible_relation and $possible_column
MC/DC0%0/2
$possible_relation and $possible_column
$possible_relation
$possible_column
Truth table0%0/3
A and B
A= $possible_relationB= $possible_column
| |||||||||||||||||||||||||||||
| 24 | 0 | ▶ | if($self->result_source->has_relationship($possible_relation)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 25 | 0 | ▶ | if($self->result_source->relationship_info($possible_relation)->{'class'}->has_column($possible_column)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 26 | 0 | $value = "$possible_relation.$possible_column"; | |||||||||||||||||||||||||||
| 27 | } | ||||||||||||||||||||||||||||
| 28 | else { | ||||||||||||||||||||||||||||
| 29 | 0 | confess "<ident> got '$value'; column '$possible_column' does not exist in '$possible_relation"; | |||||||||||||||||||||||||||
| 30 | } | ||||||||||||||||||||||||||||
| 31 | } | ||||||||||||||||||||||||||||
| 32 | else { | ||||||||||||||||||||||||||||
| 33 | 0 | confess "<ident> got '$value', relation '$possible_relation' does not exist in the current result source (@{[ $self->result_class ]})"; | |||||||||||||||||||||||||||
| 34 | } | ||||||||||||||||||||||||||||
| 35 | } | ||||||||||||||||||||||||||||
| 36 | else { | ||||||||||||||||||||||||||||
| 37 | 0 | ▶ | $possible_column = $possible_relation if !$possible_column; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 38 | 0 | ▶ | if($self->result_source->has_column($possible_column)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 39 | 0 | $value = $self->current_source_alias . ".$possible_column"; | |||||||||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||||||||
| 41 | else { | ||||||||||||||||||||||||||||
| 42 | 0 | confess "<ident> got '$value', column '$possible_column' does not exist in the current result source (@{[ $self->result_class ]})"; | |||||||||||||||||||||||||||
| 43 | } | ||||||||||||||||||||||||||||
| 44 | } | ||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | 0 | return { sql_operator => '=', value => $self->result_source->storage->sql_maker->_quote($value), quote_value => 0 }; | |||||||||||||||||||||||||||
| 47 | } | ||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | 2 | 1; | |||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||
| 51 | __END__ | ||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||
| 53 | =pod | ||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||
| 55 | =encoding UTF-8 | ||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||
| 57 | =head1 NAME | ||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||
| 59 | DBIx::Class::Smooth::Lookup::ident - Short intro | ||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||
| 61 | =head1 VERSION | ||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||
| 63 | Version 0.0105, released 2020-09-20. | ||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||
| 65 | =head1 SOURCE | ||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||
| 67 | L<https://github.com/Csson/p5-DBIx-Class-Smooth> | ||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||
| 69 | =head1 HOMEPAGE | ||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||
| 71 | L<https://metacpan.org/release/DBIx-Class-Smooth> | ||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||
| 73 | =head1 AUTHOR | ||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||
| 75 | Erik Carlsson <info@code301.com> | ||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||
| 77 | =head1 COPYRIGHT AND LICENSE | ||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||
| 79 | This software is copyright (c) 2018 by Erik Carlsson. | ||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||
| 81 | This is free software; you can redistribute it and/or modify it under | ||||||||||||||||||||||||||||
| 82 | the same terms as the Perl 5 programming language system itself. | ||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||
| 84 | =cut | ||||||||||||||||||||||||||||