line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Jifty::DBI::Handle::ODBC; |
2
|
1
|
|
|
1
|
|
798
|
use Jifty::DBI::Handle; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
6
|
|
3
|
|
|
|
|
|
|
@ISA = qw(Jifty::DBI::Handle); |
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
44
|
use vars qw($VERSION @ISA $DBIHandle $DEBUG); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
57
|
|
6
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
312
|
|
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 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
|
|
|
0
|
1
|
|
my $self = shift; |
32
|
0
|
|
|
|
|
|
return (undef); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head2 build_dsn |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=cut |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub build_dsn { |
40
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
41
|
0
|
|
|
|
|
|
my %args = ( |
42
|
|
|
|
|
|
|
driver => undef, |
43
|
|
|
|
|
|
|
database => undef, |
44
|
|
|
|
|
|
|
host => undef, |
45
|
|
|
|
|
|
|
port => undef, |
46
|
|
|
|
|
|
|
@_ |
47
|
|
|
|
|
|
|
); |
48
|
|
|
|
|
|
|
|
49
|
0
|
|
0
|
|
|
|
$args{dbname} ||= delete $args{database}; |
50
|
|
|
|
|
|
|
|
51
|
0
|
|
|
|
|
|
my $dsn = "dbi:$args{driver}:$args{dbname}"; |
52
|
0
|
0
|
|
|
|
|
$dsn .= ";host=$args{'host'}" if $args{'host'}; |
53
|
0
|
0
|
|
|
|
|
$dsn .= ";port=$args{'port'}" if $args{'port'}; |
54
|
|
|
|
|
|
|
|
55
|
0
|
|
|
|
|
|
$self->{'dsn'} = $dsn; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head2 apply_limits |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=cut |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub apply_limits { |
63
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
64
|
0
|
|
|
|
|
|
my $statementref = shift; |
65
|
0
|
0
|
|
|
|
|
my $per_page = shift or return; |
66
|
0
|
|
|
|
|
|
my $first = shift; |
67
|
|
|
|
|
|
|
|
68
|
0
|
|
|
|
|
|
my $limit_clause = " TOP $per_page"; |
69
|
0
|
0
|
|
|
|
|
$limit_clause .= " OFFSET $first" if $first; |
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
|
|
|
0
|
1
|
|
my $self = shift; |
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
|
0
|
|
|
0
|
1
|
|
sub encoding { |
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
1; |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
__END__ |