| 1 | # | ||||||||||
| 2 | # DESCRIPTION | ||||||||||
| 3 | # PerlORM - Object relational mapper (ORM) for Perl. PerlORM is Perl | ||||||||||
| 4 | # library that implements object-relational mapping. Its features are | ||||||||||
| 5 | # much similar to those of Java's Hibernate library, but interface is | ||||||||||
| 6 | # much different and easier to use. | ||||||||||
| 7 | # | ||||||||||
| 8 | # AUTHOR | ||||||||||
| 9 | # Alexey V. Akimov <akimov_alexey@sourceforge.net> | ||||||||||
| 10 | # | ||||||||||
| 11 | # COPYRIGHT | ||||||||||
| 12 | # Copyright (C) 2005-2006 Alexey V. Akimov | ||||||||||
| 13 | # | ||||||||||
| 14 | # This library is free software; you can redistribute it and/or | ||||||||||
| 15 | # modify it under the terms of the GNU Lesser General Public | ||||||||||
| 16 | # License as published by the Free Software Foundation; either | ||||||||||
| 17 | # version 2.1 of the License, or (at your option) any later version. | ||||||||||
| 18 | # | ||||||||||
| 19 | # This library is distributed in the hope that it will be useful, | ||||||||||
| 20 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||||||||
| 21 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||||||||||
| 22 | # Lesser General Public License for more details. | ||||||||||
| 23 | # | ||||||||||
| 24 | # You should have received a copy of the GNU Lesser General Public | ||||||||||
| 25 | # License along with this library; if not, write to the Free Software | ||||||||||
| 26 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||||||||||
| 27 | # | ||||||||||
| 28 | |||||||||||
| 29 | package ORM::Filter::Func; | ||||||||||
| 30 | |||||||||||
| 31 | 5 | $VERSION=0.8; | |||||||||
| 32 | |||||||||||
| 33 | 5 | ▶ | use overload 'fallback' => 1; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 34 | 5 | ▶ | use base 'ORM::Filter'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 35 | |||||||||||
| 36 | ## | ||||||||||
| 37 | ## CONSTRUCTORS | ||||||||||
| 38 | ## | ||||||||||
| 39 | |||||||||||
| 40 | 0 | ▶ | sub concat { (shift @_)->new( 'CONCAT', @_ ); } | ||||||||
|
Subroutine
concat: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 41 | |||||||||||
| 42 | sub new | ||||||||||
| 43 | 0 | ▶ | { | ||||||||
|
Subroutine
new: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||
| 44 | 0 | my $class = shift; | |||||||||
| 45 | 0 | my $self = { func => shift }; | |||||||||
| 46 | |||||||||||
| 47 | 0 | for my $arg ( @_ ) | |||||||||
| 48 | { | ||||||||||
| 49 | 0 | ▶ | if( ref $arg ) | ||||||||
|
Branch: 1 branch
| |||||||||||
| 50 | { | ||||||||||
| 51 | 0 | ▶ | if( UNIVERSAL::isa( $arg, 'ORM::Expr' ) ) | ||||||||
|
Branch: 1 branch
| |||||||||||
| 52 | { | ||||||||||
| 53 | 0 | push @{$self->{arg}}, $arg; | |||||||||
| 54 | } | ||||||||||
| 55 | else | ||||||||||
| 56 | { | ||||||||||
| 57 | 0 | push @{$self->{arg}}, $arg->__ORM_db_value; | |||||||||
| 58 | } | ||||||||||
| 59 | } | ||||||||||
| 60 | else | ||||||||||
| 61 | { | ||||||||||
| 62 | 0 | push @{$self->{arg}}, $arg; | |||||||||
| 63 | } | ||||||||||
| 64 | } | ||||||||||
| 65 | |||||||||||
| 66 | 0 | return bless $self, $class; | |||||||||
| 67 | } | ||||||||||
| 68 | |||||||||||
| 69 | ## | ||||||||||
| 70 | ## PROPERTIES | ||||||||||
| 71 | ## | ||||||||||
| 72 | |||||||||||
| 73 | sub _sql_str | ||||||||||
| 74 | 0 | ▶ | { | ||||||||
|
Subroutine
_sql_str: not called CC=2 SCAR=17.9
| |||||||||||
| 75 | 0 | my $self = shift; | |||||||||
| 76 | 0 | my %arg = @_; | |||||||||
| 77 | 0 | my $sql; | |||||||||
| 78 | |||||||||||
| 79 | 0 | for my $arg ( @{$self->{arg}} ) | |||||||||
| 80 | { | ||||||||||
| 81 | 0 | $sql .= $self->scalar2sql( $arg, $arg{tjoin} ).','; | |||||||||
| 82 | }; | ||||||||||
| 83 | 0 | chop $sql; | |||||||||
| 84 | |||||||||||
| 85 | 0 | return "$self->{func}( $sql )"; | |||||||||
| 86 | } | ||||||||||
| 87 | |||||||||||
| 88 | sub _tjoin | ||||||||||
| 89 | 0 | ▶ | { | ||||||||
|
Subroutine
_tjoin: not called CC=3 SCAR=24.8
| |||||||||||
| 90 | 0 | my $self = shift; | |||||||||
| 91 | 0 | my $tjoin = ORM::Tjoin->new; | |||||||||
| 92 | |||||||||||
| 93 | 0 | for my $arg ( @{$self->{arg}} ) | |||||||||
| 94 | { | ||||||||||
| 95 | 0 | ▶ | $tjoin->merge( $arg->_tjoin ) if( ref $arg ); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 96 | } | ||||||||||
| 97 | |||||||||||
| 98 | 0 | return $tjoin; | |||||||||
| 99 | } | ||||||||||
| 100 | |||||||||||