line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package DBIx::Class::QueryLog::Query; |
2
|
|
|
|
|
|
|
$DBIx::Class::QueryLog::Query::VERSION = '1.005001'; |
3
|
|
|
|
|
|
|
# ABSTRACT: A Query |
4
|
|
|
|
|
|
|
|
5
|
5
|
|
|
5
|
|
30
|
use Moo; |
|
5
|
|
|
|
|
7
|
|
|
5
|
|
|
|
|
27
|
|
6
|
5
|
|
|
5
|
|
1337
|
use Types::Standard qw( Str Num ArrayRef ); |
|
5
|
|
|
|
|
9
|
|
|
5
|
|
|
|
|
80
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
has bucket => ( |
9
|
|
|
|
|
|
|
is => 'rw', |
10
|
|
|
|
|
|
|
isa => Str |
11
|
|
|
|
|
|
|
); |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
has end_time => ( |
14
|
|
|
|
|
|
|
is => 'rw', |
15
|
|
|
|
|
|
|
isa => Num |
16
|
|
|
|
|
|
|
); |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
has params => ( |
19
|
|
|
|
|
|
|
is => 'rw', |
20
|
|
|
|
|
|
|
isa => ArrayRef |
21
|
|
|
|
|
|
|
); |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
has sql => ( |
24
|
|
|
|
|
|
|
is => 'rw', |
25
|
|
|
|
|
|
|
isa => Str |
26
|
|
|
|
|
|
|
); |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
has start_time => ( |
29
|
|
|
|
|
|
|
is => 'rw', |
30
|
|
|
|
|
|
|
isa => Num |
31
|
|
|
|
|
|
|
); |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub time_elapsed { |
35
|
28
|
|
|
28
|
1
|
271
|
my $self = shift; |
36
|
|
|
|
|
|
|
|
37
|
28
|
|
|
|
|
338
|
return $self->end_time - $self->start_time; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub count { |
41
|
|
|
|
|
|
|
|
42
|
1003002
|
|
|
1003002
|
1
|
1401826
|
return 1; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub queries { |
46
|
3
|
|
|
3
|
1
|
5
|
my $self = shift; |
47
|
|
|
|
|
|
|
|
48
|
3
|
|
|
|
|
8
|
return [ $self ]; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub get_sorted_queries { |
52
|
10
|
|
|
10
|
1
|
14
|
my ($self, $sql) = @_; |
53
|
|
|
|
|
|
|
|
54
|
10
|
100
|
|
|
|
21
|
if(defined($sql)) { |
55
|
9
|
100
|
|
|
|
121
|
if($self->sql eq $sql) { |
56
|
5
|
|
|
|
|
34
|
return [ $self ]; |
57
|
|
|
|
|
|
|
} else { |
58
|
4
|
|
|
|
|
26
|
return [ ]; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
1
|
|
|
|
|
4
|
return [ $self ]; |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
1; |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
__END__ |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=pod |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=encoding UTF-8 |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head1 NAME |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
DBIx::Class::QueryLog::Query - A Query |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=head1 VERSION |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
version 1.005001 |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=head1 SYNOPSIS |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
Represents a query. The sql, parameters, start time and end time are stored. |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head1 METHODS |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=head2 bucket |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
The bucket this query is in. |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=head2 start_time |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
Time this query started. |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=head2 end_time |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
Time this query ended. |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head2 sql |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
SQL for this query. |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=head2 params |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
Parameters used with this query. |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=head2 time_elapsed |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
Time this query took to execute. start - end. |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=head2 count |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
Returns 1. Exists to make it easier for QueryLog to get a count of |
114
|
|
|
|
|
|
|
queries executed. |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=head2 queries |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
Returns this query, here to make QueryLog's job easier. |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=head2 get_sorted_queries |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
Returns this query. Here to make QueryLog's job easier. |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=head1 AUTHORS |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=over 4 |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=item * |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
Arthur Axel "fREW" Schmidt <frioux+cpan@gmail.com> |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=item * |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
Cory G Watson <gphat at cpan.org> |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
=back |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
This software is copyright (c) 2015 by Cory G Watson <gphat at cpan.org>. |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
143
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
=cut |