line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#!/usr/bin/perl -w |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
package Local::Romani::Query::Function; |
4
|
1
|
|
|
1
|
|
926
|
use base qw(Test::Class); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
100
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
6
|
use DBIx::Romani::Query::Function::Count; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
21
|
|
7
|
1
|
|
|
1
|
|
615
|
use DBIx::Romani::Query::Function::Now; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
29
|
|
8
|
1
|
|
|
1
|
|
7
|
use DBIx::Romani::Query::SQL::Column; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
20
|
|
9
|
1
|
|
|
1
|
|
5
|
use DBIx::Romani::Query::SQL::Literal; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
19
|
|
10
|
1
|
|
|
1
|
|
6
|
use DBIx::Romani::Driver::sqlite; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
24
|
|
11
|
1
|
|
|
1
|
|
6
|
use Test::More; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
9
|
|
12
|
1
|
|
|
1
|
|
372
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
43
|
|
13
|
|
|
|
|
|
|
|
14
|
1
|
|
|
1
|
|
6
|
use Data::Dumper; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
209
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
# utility function makes SQL out of whatever |
17
|
0
|
|
|
0
|
|
|
sub generate_sql { return DBIx::Romani::Driver::sqlite->new()->generate_sql( @_ ) }; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub functionCount : Test(1) |
20
|
|
|
|
|
|
|
{ |
21
|
0
|
|
|
0
|
|
0
|
my $count = DBIx::Romani::Query::Function::Count->new(); |
22
|
0
|
|
|
|
|
0
|
$count->set_distinct( 1 ); |
23
|
0
|
|
|
|
|
0
|
$count->add( DBIx::Romani::Query::SQL::Column->new( undef, 'column_name' ) ); |
24
|
|
|
|
|
|
|
|
25
|
0
|
|
|
|
|
0
|
my $s = generate_sql( $count ); |
26
|
0
|
|
|
|
|
0
|
is( $s, "COUNT(DISTINCT column_name)" ); |
27
|
1
|
|
|
1
|
|
7
|
} |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
14
|
|
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub functionNow : Test(1) |
30
|
|
|
|
|
|
|
{ |
31
|
0
|
|
|
0
|
|
|
my $count = DBIx::Romani::Query::Function::Now->new(); |
32
|
|
|
|
|
|
|
|
33
|
0
|
|
|
|
|
|
my $s = generate_sql( $count ); |
34
|
0
|
|
|
|
|
|
is( $s, "NOW()" ); |
35
|
1
|
|
|
1
|
|
314
|
} |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
4
|
|
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
1; |
38
|
|
|
|
|
|
|
|