| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package AnyEvent::Groonga::Result::Select; | 
| 2 | 6 |  |  | 6 |  | 35 | use strict; | 
|  | 6 |  |  |  |  | 12 |  | 
|  | 6 |  |  |  |  | 243 |  | 
| 3 | 6 |  |  | 6 |  | 34 | use warnings; | 
|  | 6 |  |  |  |  | 13 |  | 
|  | 6 |  |  |  |  | 184 |  | 
| 4 | 6 |  |  | 6 |  | 29808 | use Encode; | 
|  | 6 |  |  |  |  | 102504 |  | 
|  | 6 |  |  |  |  | 772 |  | 
| 5 | 6 |  |  | 6 |  | 55 | use base qw(AnyEvent::Groonga::Result); | 
|  | 6 |  |  |  |  | 12 |  | 
|  | 6 |  |  |  |  | 2360 |  | 
| 6 |  |  |  |  |  |  |  | 
| 7 |  |  |  |  |  |  | sub hit_num { | 
| 8 | 0 |  |  | 0 | 1 |  | my $self = shift; | 
| 9 | 0 |  |  |  |  |  | return $self->body->[0]->[0]->[0]; | 
| 10 |  |  |  |  |  |  | } | 
| 11 |  |  |  |  |  |  |  | 
| 12 |  |  |  |  |  |  | sub columns { | 
| 13 | 0 |  |  | 0 | 1 |  | my $self = shift; | 
| 14 | 0 |  |  |  |  |  | my @cols = (); | 
| 15 | 0 | 0 |  |  |  |  | if ( ref $self->body eq 'ARRAY' ) { | 
| 16 | 0 |  |  |  |  |  | for ( @{ $self->body->[0]->[1] } ) { | 
|  | 0 |  |  |  |  |  |  | 
| 17 | 0 |  |  |  |  |  | push @cols, $_->[0]; | 
| 18 |  |  |  |  |  |  | } | 
| 19 |  |  |  |  |  |  | } | 
| 20 | 0 |  |  |  |  |  | return \@cols; | 
| 21 |  |  |  |  |  |  | } | 
| 22 |  |  |  |  |  |  |  | 
| 23 |  |  |  |  |  |  | sub items { | 
| 24 | 0 |  |  | 0 | 1 |  | my $self       = shift; | 
| 25 | 0 |  |  |  |  |  | my $cols       = $self->columns; | 
| 26 | 0 |  |  |  |  |  | my @item_array = (); | 
| 27 | 0 | 0 |  |  |  |  | if ( ref $self->body eq 'ARRAY' ) { | 
| 28 | 0 |  |  |  |  |  | for my $i ( 2 .. int @{ $self->body->[0] } - 1 ) { | 
|  | 0 |  |  |  |  |  |  | 
| 29 | 0 |  |  |  |  |  | my $row = $self->body->[0]->[$i]; | 
| 30 | 0 |  |  |  |  |  | my $item; | 
| 31 | 0 |  |  |  |  |  | for my $j ( 0 .. int @$cols - 1 ) { | 
| 32 | 0 |  |  |  |  |  | my $key   = $cols->[$j]; | 
| 33 | 0 |  |  |  |  |  | my $value = $row->[$j]; | 
| 34 | 0 |  |  |  |  |  | $item->{$key} = $value; | 
| 35 |  |  |  |  |  |  | } | 
| 36 | 0 |  |  |  |  |  | push @item_array, $item; | 
| 37 |  |  |  |  |  |  | } | 
| 38 |  |  |  |  |  |  | } | 
| 39 | 0 |  |  |  |  |  | return \@item_array; | 
| 40 |  |  |  |  |  |  | } | 
| 41 |  |  |  |  |  |  |  | 
| 42 |  |  |  |  |  |  | 1; | 
| 43 |  |  |  |  |  |  | __END__ |