Query.pm untested

filter: Statementstmt 0.0% 0 / 30 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 7 Podpod 0.0% 0 / 5 totaltotal 0.0% 0 / 42 CC 1 SCAR 6.9
CC
1
Cov
0%
shift_row
2.0
unshift_row
2.0
pop_row
2.0
CRAP 2.0
1 package PSQL::Query;
2 use Moose;
3  
4 use PSQL::Query::Token::Row::Operation;
5  
6 has 'rows_by_dom_depth' => (
7 isa => 'HashRef'
8 , is => 'ro'
9 , lazy => 1
10 , default => \&get_rows_by_dom_depth
11 );
12  
13 has 'rows_by_query_order' => (
14 isa => 'ArrayRef'
15 , is => 'ro'
16 , 'default' => sub { [] }
17 );
18  
19 sub shift_row {
20 my $self = shift;
21 shift @{$self->rows_by_query_order};
22 }
23  
24 sub unshift_row {
25 my ( $self, $row ) = @_;
26 unshift @{$self->rows_by_query_order}, $row;
27 }
28  
29 sub pop_row {
30 my $self = shift;
31 pop @{$self->rows_by_query_order};
32 }
33  
34 sub push_row {
35 my ( $self, $row ) = @_;
36 push @{$self->rows_by_query_order}, $row;
37 }
38  
39 sub get_rows_by_dom_depth {
40 my $self = shift;
41  
42 my $rows = {};
43  
44 foreach my $row (@{ $self->rows_by_query_order }) {
45  
46 my $dom_level = $row->dom_level;
47 my $name = $row->name;
48  
49 push @{ $rows->{ $dom_level }->{ $name } }, $row;
50  
51 }
52  
53 $rows;
54  
55 }
56  
57 =head1 NAME
58  
59 PSQL::Query - A framework to parse pg-query plans via the output of Explain / Explain Analyze
60  
61 =head1 DESCRIPTION
62  
63 This module is currently a backend for L<psql-plus>, the release of .01 is largely dependant on it. The internals of this module are subject to change. Check the README for more information.
64  
65 =head1 AUTHOR
66  
67 Evan Carroll, C<< <me at evancarroll.com> >>
68  
69 =head1 COPYRIGHT & LICENSE
70  
71 Copyright 2007 Evan Carroll, all rights reserved.
72  
73 This program is free software; you can redistribute it and/or modify it
74 under the same terms as Perl itself.
75  
76 =cut
77  
78 1;