/usr/share/perl5/DBIx/SearchBuilder/Handle/Sybase.pm is in libdbix-searchbuilder-perl 1.66-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 | # $Header: /home/jesse/DBIx-SearchBuilder/history/SearchBuilder/Handle/Sybase.pm,v 1.8 2001/10/12 05:27:05 jesse Exp $
package DBIx::SearchBuilder::Handle::Sybase;
use strict;
use warnings;
use base qw(DBIx::SearchBuilder::Handle);
=head1 NAME
DBIx::SearchBuilder::Handle::Sybase -- a Sybase specific Handle object
=head1 SYNOPSIS
=head1 DESCRIPTION
This module provides a subclass of DBIx::SearchBuilder::Handle that
compensates for some of the idiosyncrasies of Sybase.
=head1 METHODS
=cut
=head2 Insert
Takes a table name as the first argument and assumes that the rest of the arguments
are an array of key-value pairs to be inserted.
If the insert succeeds, returns the id of the insert, otherwise, returns
a Class::ReturnValue object with the error reported.
=cut
sub Insert {
my $self = shift;
my $table = shift;
my %pairs = @_;
my $sth = $self->SUPER::Insert( $table, %pairs );
if ( !$sth ) {
return ($sth);
}
# Can't select identity column if we're inserting the id by hand.
unless ($pairs{'id'}) {
my @row = $self->FetchResult('SELECT @@identity');
# TODO: Propagate Class::ReturnValue up here.
unless ( $row[0] ) {
return (undef);
}
$self->{'id'} = $row[0];
}
return ( $self->{'id'} );
}
=head2 DatabaseVersion
return the database version, trimming off any -foo identifier
=cut
sub DatabaseVersion {
my $self = shift;
my $v = $self->SUPER::DatabaseVersion();
$v =~ s/\-(.*)$//;
return ($v);
}
=head2 CaseSensitive
Returns undef, since Sybase's searches are not case sensitive by default
=cut
sub CaseSensitive {
my $self = shift;
return(1);
}
sub ApplyLimits {
my $self = shift;
my $statementref = shift;
my $per_page = shift;
my $first = shift;
}
=head2 DistinctQuery STATEMENTREFtakes an incomplete SQL SELECT statement and massages it to return a DISTINCT result set.
=cut
sub DistinctQuery {
my $self = shift;
my $statementref = shift;
my $sb = shift;
my $table = $sb->Table;
if ($sb->_OrderClause =~ /(?<!main)\./) {
# Don't know how to do ORDER BY when the DISTINCT is in a subquery
warn "Query will contain duplicate rows; don't how how to ORDER BY across DISTINCT";
$$statementref = "SELECT main.* FROM $$statementref";
} else {
# Wrapper select query in a subselect as Sybase doesn't allow
# DISTINCT against CLOB/BLOB column types.
$$statementref = "SELECT main.* FROM ( SELECT DISTINCT main.id FROM $$statementref ) distinctquery, $table main WHERE (main.id = distinctquery.id) ";
}
$$statementref .= $sb->_GroupClause;
$$statementref .= $sb->_OrderClause;
}
=head2 BinarySafeBLOBs
Return undef, as Oracle doesn't support binary-safe CLOBS
=cut
sub BinarySafeBLOBs {
my $self = shift;
return(undef);
}
1;
__END__
=head1 AUTHOR
Jesse Vincent, jesse@fsck.com
=head1 SEE ALSO
DBIx::SearchBuilder, DBIx::SearchBuilder::Handle
=cut
|