| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
# ABSTRACT: JsonSQL::Param::Joins object. Stores an array of JsonSQL::Param::Join objects to use for constructing JsonSQL::Query objects. |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
5
|
use strict; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
23
|
|
|
6
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
20
|
|
|
7
|
1
|
|
|
1
|
|
15
|
use 5.014; |
|
|
1
|
|
|
|
|
5
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
package JsonSQL::Param::Joins; |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $VERSION = '0.41'; # VERSION |
|
12
|
|
|
|
|
|
|
|
|
13
|
1
|
|
|
1
|
|
258
|
use JsonSQL::Param::Join; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
24
|
|
|
14
|
1
|
|
|
1
|
|
6
|
use JsonSQL::Error; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
167
|
|
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub new { |
|
19
|
1
|
|
|
1
|
1
|
3
|
my ($class, $joinsarrayref, $queryObj) = @_; |
|
20
|
|
|
|
|
|
|
|
|
21
|
1
|
|
|
|
|
2
|
my $self = []; |
|
22
|
|
|
|
|
|
|
|
|
23
|
1
|
|
|
|
|
2
|
my @join_errors; |
|
24
|
1
|
|
|
|
|
2
|
for my $joinhashref ( @{ $joinsarrayref } ) { |
|
|
1
|
|
|
|
|
3
|
|
|
25
|
1
|
|
|
|
|
30
|
my $joinObj = JsonSQL::Param::Join->new($joinhashref, $queryObj); |
|
26
|
1
|
50
|
|
|
|
2
|
if ( eval { $joinObj->is_error } ) { |
|
|
1
|
|
|
|
|
11
|
|
|
27
|
0
|
|
|
|
|
0
|
push(@join_errors, $joinObj->{message}); |
|
28
|
|
|
|
|
|
|
} else { |
|
29
|
1
|
|
|
|
|
19
|
push (@{ $self }, $joinObj); |
|
|
1
|
|
|
|
|
6
|
|
|
30
|
|
|
|
|
|
|
} |
|
31
|
|
|
|
|
|
|
} |
|
32
|
|
|
|
|
|
|
|
|
33
|
1
|
50
|
|
|
|
4
|
if ( @join_errors ) { |
|
34
|
0
|
|
|
|
|
0
|
my $err = "Could not parse all join objects: \n\t"; |
|
35
|
0
|
|
|
|
|
0
|
$err .= join("\n\t", @join_errors); |
|
36
|
0
|
|
|
|
|
0
|
return JsonSQL::Error->new("invalid_joins", $err); |
|
37
|
|
|
|
|
|
|
} else { |
|
38
|
1
|
|
|
|
|
2
|
bless $self, $class; |
|
39
|
1
|
|
|
|
|
3
|
return $self; |
|
40
|
|
|
|
|
|
|
} |
|
41
|
|
|
|
|
|
|
} |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub get_joins { |
|
45
|
1
|
|
|
1
|
1
|
3
|
my ( $self, $queryObj ) = @_; |
|
46
|
|
|
|
|
|
|
|
|
47
|
1
|
|
|
|
|
3
|
my @joinsArray = map { $_->get_join($queryObj) } @{ $self }; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
2
|
|
|
48
|
|
|
|
|
|
|
|
|
49
|
1
|
|
|
|
|
4
|
return \@joinsArray; |
|
50
|
|
|
|
|
|
|
} |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
1; |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
__END__ |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=pod |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=encoding UTF-8 |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head1 NAME |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
JsonSQL::Param::Joins - JsonSQL::Param::Joins object. Stores an array of JsonSQL::Param::Join objects to use for constructing JsonSQL::Query objects. |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head1 VERSION |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
version 0.41 |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
This module constructs a Perl object container of L<JsonSQL::Param::Join> objects. |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=head3 Object properties: |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=over |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=item Array of L<JsonSQL::Param::Join> objects. |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=back |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=head3 Generated parameters: |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=over |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=item $joinsArray => \@arrayref |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=back |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=head1 METHODS |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=head2 Constructor new($joinsarrayref, $queryObj) |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
Instantiates and returns a new JsonSQL::Param::Joins object, which is an array of L<JsonSQL::Param::Join> objects. |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
$joinsarrayref => An arrayref of join hashes used to construct the object. |
|
98
|
|
|
|
|
|
|
$queryObj => A reference to the JsonSQL::Query object that will own this object. |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
Returns a JsonSQL::Error object on failure. |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=head2 ObjectMethod get_joins -> \@joinsArray |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
Generates parameters represented by the object for the SQL statement. Returns: |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
$joinsArray => Arrayref of joins to use for the query. Constructed from child L<JsonSQL::Param::Join> objects. |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=head1 AUTHOR |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
Chris Hoefler <bhoefler@draper.com> |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
This software is copyright (c) 2017 by Chris Hoefler. |
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
|
117
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=cut |