| 1 | package DBIx::SQLEngine::Criteria::HashGroup; | ||||||||||
| 2 | 7 | ▶ | use DBIx::SQLEngine::Criteria; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | 7 | @ISA = 'DBIx::SQLEngine::Criteria'; | |||||||||
| 4 | 7 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | 7 | ▶ | use DBIx::SQLEngine::Criteria::And; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 7 | ▶ | use DBIx::SQLEngine::Criteria::Or; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | 7 | ▶ | use DBIx::SQLEngine::Criteria::StringComparison; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | # 2004-02-24 Switched to StringComparison based on suggestion from Michael Kroll | ||||||||||
| 10 | # use DBIx::SQLEngine::Criteria::StringEquality; | ||||||||||
| 11 | |||||||||||
| 12 | 7 | ▶ | use Class::MakeMethods ( | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 13 | 7 | 'Composite::Hash:new' => [ 'new', {modifier => 'with_values'} ], | |||||||||
| 14 | 7 | ); | |||||||||
| 15 | |||||||||||
| 16 | 45 | ▶ | sub normalized { | ||||||||
|
Subroutine
normalized: called CC=2 SCAR=7.4
Pod
documented
| |||||||||||
| 17 | 45 | my $hashref = shift; | |||||||||
| 18 | |||||||||||
| 19 | DBIx::SQLEngine::Criteria::And->new( | ||||||||||
| 20 | map { | ||||||||||
| 21 | 45 | my ($key, $value) = ($_, $hashref->{$_}); | |||||||||
| 22 | ( ref( $value ) eq 'ARRAY' ) | ||||||||||
| 23 | ? DBIx::SQLEngine::Criteria::Or->new( | ||||||||||
| 24 | map { | ||||||||||
| 25 | 0 | ▶ | DBIx::SQLEngine::Criteria::StringComparison->new( $key, $_ ) | ||||||||
|
Branch: 1 branch
| |||||||||||
| 26 | } @$value | ||||||||||
| 27 | ) | ||||||||||
| 28 | : DBIx::SQLEngine::Criteria::StringComparison->new($key, $value) | ||||||||||
| 29 | } sort keys %$hashref | ||||||||||
| 30 | ) | ||||||||||
| 31 | } | ||||||||||
| 32 | |||||||||||
| 33 | 45 | ▶ | sub sql_where { | ||||||||
|
Subroutine
sql_where: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 34 | 45 | (shift)->normalized->sql_where( @_ ) | |||||||||
| 35 | } | ||||||||||
| 36 | |||||||||||
| 37 | 7 | 1; | |||||||||
| 38 | |||||||||||
| 39 | __END__ | ||||||||||