line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package DBIx::SearchBuilder::Handle::ODBC; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
963
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
28
|
|
4
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
11
|
|
|
1
|
|
|
|
|
26
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
5
|
use base qw(DBIx::SearchBuilder::Handle); |
|
1
|
|
|
|
|
11
|
|
|
1
|
|
|
|
|
486
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 NAME |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
DBIx::SearchBuilder::Handle::ODBC - An ODBC specific Handle object |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 SYNOPSIS |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head1 DESCRIPTION |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
This module provides a subclass of DBIx::SearchBuilder::Handle that |
18
|
|
|
|
|
|
|
compensates for some of the idiosyncrasies of ODBC. |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=head1 METHODS |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=cut |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=head2 CaseSensitive |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
Returns a false value. |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=cut |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub CaseSensitive { |
31
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
32
|
0
|
|
|
|
|
|
return (undef); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head2 BuildDSN |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=cut |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub BuildDSN { |
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
|
|
|
|
|
|
my $dsn = "dbi:$args{'Driver'}:$args{'Database'}"; |
50
|
0
|
0
|
0
|
|
|
|
$dsn .= ";host=$args{'Host'}" if (defined $args{'Host'} && $args{'Host'}); |
51
|
0
|
0
|
0
|
|
|
|
$dsn .= ";port=$args{'Port'}" if (defined $args{'Port'} && $args{'Port'}); |
52
|
|
|
|
|
|
|
|
53
|
0
|
|
|
|
|
|
$self->{'dsn'} = $dsn; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head2 ApplyLimits |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=cut |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub ApplyLimits { |
61
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
62
|
0
|
|
|
|
|
|
my $statementref = shift; |
63
|
0
|
0
|
|
|
|
|
my $per_page = shift or return; |
64
|
0
|
|
|
|
|
|
my $first = shift; |
65
|
|
|
|
|
|
|
|
66
|
0
|
|
|
|
|
|
my $limit_clause = " TOP $per_page"; |
67
|
0
|
0
|
|
|
|
|
$limit_clause .= " OFFSET $first" if $first; |
68
|
0
|
|
|
|
|
|
$$statementref =~ s/SELECT\b/SELECT $limit_clause/; |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head2 DistinctQuery |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=cut |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
sub DistinctQuery { |
76
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
77
|
0
|
|
|
|
|
|
my $statementref = shift; |
78
|
0
|
|
|
|
|
|
my $sb = shift; |
79
|
|
|
|
|
|
|
|
80
|
0
|
|
|
|
|
|
$$statementref = "SELECT main.* FROM $$statementref"; |
81
|
0
|
|
|
|
|
|
$$statementref .= $sb->_GroupClause; |
82
|
0
|
|
|
|
|
|
$$statementref .= $sb->_OrderClause; |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
0
|
0
|
|
sub Encoding { |
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
1; |