| 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"}
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"}
| |||||||||||||||||||||
| 50 | |||||||||||||||||||||
| 51 | 0 | my $dsn = "dbi:$args{driver}:$args{dbname}"; | |||||||||||||||||||
| 52 | 0 | ▶ | $dsn .= ";host=$args{'host'}" if $args{'host'}; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 53 | 0 | ▶ | $dsn .= ";port=$args{'port'}" if $args{'port'}; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 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
| |||||||||||||||||||||
| 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
| |||||||||||||||||||||
| 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 | ||||||||||||||||||||