File: ODBC.pm

package info (click to toggle)
libdbix-searchbuilder-perl 1.82-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 776 kB
  • sloc: perl: 10,608; makefile: 2
file content (88 lines) | stat: -rw-r--r-- 1,533 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
package DBIx::SearchBuilder::Handle::ODBC;

use strict;
use warnings;

use base qw(DBIx::SearchBuilder::Handle);

=head1 NAME

  DBIx::SearchBuilder::Handle::ODBC - An ODBC specific Handle object

=head1 SYNOPSIS


=head1 DESCRIPTION

This module provides a subclass of DBIx::SearchBuilder::Handle that
compensates for some of the idiosyncrasies of ODBC.

=head1 METHODS

=cut

=head2 CaseSensitive

Returns a false value.

=cut

sub CaseSensitive {
    my $self = shift;
    return (undef);
}

=head2 BuildDSN

=cut

sub BuildDSN {
    my $self = shift;
    my %args = (
	Driver     => undef,
	Database   => undef,
	Host       => undef,
	Port       => undef,
	@_
    );

    my $dsn = "dbi:$args{'Driver'}:$args{'Database'}";
    $dsn .= ";host=$args{'Host'}" if (defined $args{'Host'} && $args{'Host'});
    $dsn .= ";port=$args{'Port'}" if (defined $args{'Port'} && $args{'Port'});

    $self->{'dsn'} = $dsn;
}

=head2 ApplyLimits

=cut

sub ApplyLimits {
    my $self         = shift;
    my $statementref = shift;
    my $per_page     = shift or return;
    my $first        = shift;

    my $limit_clause = " TOP $per_page";
    $limit_clause .= " OFFSET $first" if $first;
    $$statementref =~ s/SELECT\b/SELECT $limit_clause/;
}

=head2 DistinctQuery

=cut

sub DistinctQuery {
    my $self         = shift;
    my $statementref = shift;
    my $sb = shift;

    $$statementref = "SELECT main.* FROM $$statementref";
    $$statementref .= $sb->_GroupClause;
    $$statementref .= $sb->_OrderClause;
}

sub Encoding {
}

1;