line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package OPTiMaDe::Filter::Property; |
2
|
|
|
|
|
|
|
|
3
|
5
|
|
|
5
|
|
30
|
use strict; |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
128
|
|
4
|
5
|
|
|
5
|
|
20
|
use warnings; |
|
5
|
|
|
|
|
9
|
|
|
5
|
|
|
|
|
357
|
|
5
|
|
|
|
|
|
|
|
6
|
1620
|
|
|
1620
|
|
4124
|
use overload '@{}' => sub { return $_[0]->{name} }, |
7
|
5
|
|
|
5
|
|
5579
|
'""' => sub { return $_[0]->to_filter }; |
|
5
|
|
|
473
|
|
4652
|
|
|
5
|
|
|
|
|
49
|
|
|
473
|
|
|
|
|
48926
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub new { |
10
|
221
|
|
|
221
|
0
|
336
|
my $class = shift; |
11
|
221
|
|
|
|
|
830
|
return bless { name => \@_ }, $class; |
12
|
|
|
|
|
|
|
} |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub to_filter |
15
|
|
|
|
|
|
|
{ |
16
|
685
|
|
|
685
|
0
|
1217
|
my( $self ) = @_; |
17
|
685
|
|
|
|
|
1317
|
$self->validate; |
18
|
685
|
|
|
|
|
1045
|
return join '.', @$self; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub to_SQL |
22
|
|
|
|
|
|
|
{ |
23
|
82
|
|
|
82
|
0
|
135
|
my( $self, $options ) = @_; |
24
|
82
|
|
|
|
|
153
|
$self->validate; |
25
|
|
|
|
|
|
|
|
26
|
82
|
50
|
|
|
|
162
|
$options = {} unless $options; |
27
|
|
|
|
|
|
|
my( $delim, $placeholder ) = ( |
28
|
|
|
|
|
|
|
$options->{delim}, |
29
|
|
|
|
|
|
|
$options->{placeholder}, |
30
|
82
|
|
|
|
|
144
|
); |
31
|
82
|
50
|
|
|
|
145
|
$delim = "'" unless $delim; |
32
|
|
|
|
|
|
|
|
33
|
82
|
50
|
|
|
|
110
|
if( @$self > 2 ) { |
34
|
0
|
|
|
|
|
0
|
die 'no SQL representation for properties of more than two ' . |
35
|
|
|
|
|
|
|
"identifiers\n"; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
82
|
|
|
|
|
129
|
my $sql = join '.', map { "${delim}$_${delim}" } @$self; |
|
83
|
|
|
|
|
240
|
|
39
|
|
|
|
|
|
|
|
40
|
82
|
50
|
|
|
|
228
|
if( wantarray ) { |
41
|
82
|
|
|
|
|
228
|
return ( $sql, [] ); |
42
|
|
|
|
|
|
|
} else { |
43
|
0
|
|
|
|
|
0
|
return $sql; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub modify |
48
|
|
|
|
|
|
|
{ |
49
|
3
|
|
|
3
|
0
|
6
|
my $self = shift; |
50
|
3
|
|
|
|
|
4
|
my $code = shift; |
51
|
|
|
|
|
|
|
|
52
|
3
|
|
|
|
|
6
|
return $code->( $self, @_ ); |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub validate |
56
|
|
|
|
|
|
|
{ |
57
|
767
|
|
|
767
|
0
|
1011
|
my $self = shift; |
58
|
767
|
50
|
|
|
|
1172
|
die 'name undefined for OPTiMaDe::Filter::Property' if !@$self; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
1; |