| DBIx-SearchBuilder documentation | Contained in the DBIx-SearchBuilder distribution. |
DBIx::SearchBuilder::Handle::Sybase -- a Sybase specific Handle object
This module provides a subclass of DBIx::SearchBuilder::Handle that compensates for some of the idiosyncrasies of Sybase.
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.
return the database version, trimming off any -foo identifier
Returns undef, since Sybase's searches are not case sensitive by default
Return undef, as Oracle doesn't support binary-safe CLOBS
Jesse Vincent, jesse@fsck.com
DBIx::SearchBuilder, DBIx::SearchBuilder::Handle
| DBIx-SearchBuilder documentation | Contained in the DBIx-SearchBuilder distribution. |
# $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);
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'} ); }
sub DatabaseVersion { my $self = shift; my $v = $self->SUPER::DatabaseVersion(); $v =~ s/\-(.*)$//; return ($v); }
sub CaseSensitive { my $self = shift; return(1); } sub ApplyLimits { my $self = shift; my $statementref = shift; my $per_page = shift; my $first = shift; }
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; }
sub BinarySafeBLOBs { my $self = shift; return(undef); } 1; __END__