line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Otogiri::Plugin::Count; |
2
|
2
|
|
|
2
|
|
10162
|
use 5.008001; |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
79
|
|
3
|
2
|
|
|
2
|
|
12
|
use strict; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
106
|
|
4
|
2
|
|
|
2
|
|
11
|
use warnings; |
|
2
|
|
|
|
|
17
|
|
|
2
|
|
|
|
|
126
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = "0.01"; |
7
|
|
|
|
|
|
|
|
8
|
2
|
|
|
2
|
|
508
|
use Otogiri; |
|
2
|
|
|
|
|
93892
|
|
|
2
|
|
|
|
|
250
|
|
9
|
2
|
|
|
2
|
|
629
|
use Otogiri::Plugin; |
|
2
|
|
|
|
|
575
|
|
|
2
|
|
|
|
|
340
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our @EXPORT = qw(count); |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub count { |
14
|
3
|
|
|
3
|
0
|
5378
|
my ($self, $table, $column, $where, $opt) = @_; |
15
|
|
|
|
|
|
|
|
16
|
3
|
100
|
|
|
|
10
|
if ( ref $column eq 'HASH' ) { |
17
|
1
|
|
|
|
|
2
|
$opt = $where; |
18
|
1
|
|
|
|
|
1
|
$where = $column; |
19
|
1
|
|
|
|
|
1
|
$column = '*'; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
3
|
|
100
|
|
|
8
|
$column ||= '*'; |
23
|
|
|
|
|
|
|
|
24
|
3
|
|
|
|
|
8
|
my ($sql, @binds) = $self->maker->select($table, [\"COUNT($column)"], $where, $opt); |
25
|
|
|
|
|
|
|
|
26
|
3
|
|
|
|
|
778
|
my ($cnt) = $self->dbh->selectrow_array($sql, {}, @binds); |
27
|
3
|
|
|
|
|
444
|
return $cnt; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
1; |
31
|
|
|
|
|
|
|
__END__ |