DBI/Handle/ODBC.pm

filter: Statementstmt 33.3% 11 / 33 Branchbran 0.0% 0 / 8 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 37.5% 3 / 8 Podpod 100% 5 / 5 totaltotal 32.2% 19 / 59 CC 6 SCAR 22.6
CC
6
Cov
25%
build_dsn
20.0
apply_limits
12.0
case_sensitive
2.0
CRAP 9.5
« DBI/Record.pm ↑ Summary DBI/Handle/Sybase.pm »
1 package Jifty::DBI::Handle::ODBC;
2 1 ▶use Jifty::DBI::Handle;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 @ISA = qw(Jifty::DBI::Handle);
4  
5 1 ▶use vars qw($VERSION @ISA $DBIHandle $DEBUG);
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 =head1 NAME
9  
10 Jifty::DBI::Handle::ODBC - An ODBC specific Handle object
11  
12 =head1 SYNOPSIS
13  
14  
15 =head1 DESCRIPTION
16  
17 This module provides a subclass of L<Jifty::DBI::Handle> that
18 compensates for some of the idiosyncrasies of ODBC.
19  
20 =head1 METHODS
21  
22 =cut
23  
24 =head2 case_sensitive
25  
26 Returns a false value.
27  
28 =cut
29  
30 sub case_sensitive {
31 0 ▶ my $self = shift;
Subroutine case_sensitive: not called CC=1 SCAR=6.9
Pod documented
32 0 return (undef);
33 }
34  
35 =head2 build_dsn
36  
37 =cut
38  
39 sub build_dsn {
40 0 ▶ my $self = shift;
Subroutine build_dsn: not called CC=4 SCAR=30.0
Pod documented
41 0 my %args = (
42 driver => undef,
43 database => undef,
44 host => undef,
45 port => undef,
46 @_
47 );
48  
49 0 ▶ $args{dbname} ||= delete $args{database};
Condition0%0/3
$args{"dbname"} ||= delete $args{"database"}
l!l&&r!l&&!r
000
MC/DC0%0/2
$args{"dbname"} ||= delete $args{"database"}
$args{"dbname"} delete $args{"database"}
Truth table0%0/3
A ||= B
A= $args{"dbname"}B= delete $args{"database"}
ABresult
1X1
011
000
50  
51 0 my $dsn = "dbi:$args{driver}:$args{dbname}";
52 0 ▶ $dsn .= ";host=$args{'host'}" if $args{'host'};
Branch: 1 branch
BranchTrueFalseTotal
if $args{"host"} 0 0 0
53 0 ▶ $dsn .= ";port=$args{'port'}" if $args{'port'};
Branch: 1 branch
BranchTrueFalseTotal
if $args{"port"} 0 0 0
54  
55 0 $self->{'dsn'} = $dsn;
56 }
57  
58 =head2 apply_limits
59  
60 =cut
61  
62 sub apply_limits {
63 0 ▶ my $self = shift;
Subroutine apply_limits: not called CC=3 SCAR=24.8
Pod documented
64 0 my $statementref = shift;
65 0 ▶ my $per_page = shift or return;
Branch: 1 branch
BranchTrueFalseTotal
my $per_page = shift() or return 0 0 0
66 0 my $first = shift;
67  
68 0 my $limit_clause = " TOP $per_page";
69 0 ▶ $limit_clause .= " OFFSET $first" if $first;
Branch: 1 branch
BranchTrueFalseTotal
if $first 0 0 0
70 0 $$statementref =~ s/SELECT\b/SELECT $limit_clause/;
71 }
72  
73 =head2 distinct_query
74  
75 =cut
76  
77 sub distinct_query {
78 0 ▶ my $self = shift;
Subroutine distinct_query: not called CC=1 SCAR=6.9
Pod documented
79 0 my $statementref = shift;
80 0 my $collection = shift;
81  
82 0 $$statementref = "SELECT main.* FROM $$statementref";
83 0 $$statementref .= $collection->_group_clause;
84 0 $$statementref .= $collection->_order_clause;
85 }
86  
87 =head2 encoding
88  
89 =cut
90  
91 ▶sub encoding {
Subroutine encoding: not called CC=1 SCAR=0.0
Pod documented
92 }
93  
94 1 1;
95  
96 __END__
97  
98 =head1 AUTHOR
99  
100 Audrey Tang C<cpan@audreyt.org>
101  
102 =head1 SEE ALSO
103  
104 L<Jifty::DBI>, L<Jifty::DBI::Handle>, L<DBD::ODBC>
105  
106 =cut
« DBI/Record.pm ↑ Summary DBI/Handle/Sybase.pm »