blib/lib/Jifty/DBI/Handle/ODBC.pm untested

filter: Statementstmt 0.0% 0 / 33 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 5 MC/DCmcdc n/a Subroutinesub 0.0% 0 / 8 Podpod 0.0% 0 / 5 totaltotal 0.0% 0 / 57 CC 4 SCAR 17.0
CC
4
Cov
0%
build_dsn
12.0
apply_limits
6.0
case_sensitive
2.0
CRAP 5.5
1 package Jifty::DBI::Handle::ODBC;
2 use Jifty::DBI::Handle;
3 @ISA = qw(Jifty::DBI::Handle);
4  
5 use vars qw($VERSION @ISA $DBIHandle $DEBUG);
6 use strict;
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 my $self = shift;
32 return (undef);
33 }
34  
35 =head2 build_dsn
36  
37 =cut
38  
39 sub build_dsn {
40 my $self = shift;
41 my %args = (
42 driver => undef,
43 database => undef,
44 host => undef,
45 port => undef,
46 @_
47 );
48  
49 $args{dbname} ||= delete $args{database};
50  
51 my $dsn = "dbi:$args{driver}:$args{dbname}";
52 $dsn .= ";host=$args{'host'}" if $args{'host'};
53 $dsn .= ";port=$args{'port'}" if $args{'port'};
54  
55 $self->{'dsn'} = $dsn;
56 }
57  
58 =head2 apply_limits
59  
60 =cut
61  
62 sub apply_limits {
63 my $self = shift;
64 my $statementref = shift;
65 my $per_page = shift or return;
66 my $first = shift;
67  
68 my $limit_clause = " TOP $per_page";
69 $limit_clause .= " OFFSET $first" if $first;
70 $$statementref =~ s/SELECT\b/SELECT $limit_clause/;
71 }
72  
73 =head2 distinct_query
74  
75 =cut
76  
77 sub distinct_query {
78 my $self = shift;
79 my $statementref = shift;
80  
81 my $sb = shift;
82  
83 $$statementref = "SELECT main.* FROM $$statementref";
84 $$statementref .= $sb->_group_clause;
85 $$statementref .= $sb->_order_clause;
86 }
87  
88 =head2 encoding
89  
90 =cut
91  
92 sub encoding {
93 }
94  
95 1;
96  
97 __END__
98  
99 =head1 AUTHOR
100  
101 Audrey Tang C<cpan@audreyt.org>
102  
103 =head1 SEE ALSO
104  
105 L<Jifty::DBI>, L<Jifty::DBI::Handle>, L<DBD::ODBC>
106  
107 =cut