X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FSQLAHacks.pm;h=429be4feee8c93a2e0e233f85e75dcaa54186ad0;hb=e63ff8ebef77ca59561ff543d1f448dbf9417bfb;hp=f44ed4f462572398842fca02bfd8e8db08968ecc;hpb=aa82ce29dcf525f22133a0c6bc9cd9c611767792;p=dbsrgits%2FDBIx-Class.git diff --git a/lib/DBIx/Class/SQLAHacks.pm b/lib/DBIx/Class/SQLAHacks.pm index f44ed4f..429be4f 100644 --- a/lib/DBIx/Class/SQLAHacks.pm +++ b/lib/DBIx/Class/SQLAHacks.pm @@ -47,52 +47,6 @@ sub new { $self; } -# Some databases (sqlite) do not handle multiple parenthesis -# around in/between arguments. A tentative x IN ( (1, 2 ,3) ) -# is interpreted as x IN 1 or something similar. -# -# Since we currently do not have access to the SQLA AST, resort -# to barbaric mutilation of any SQL supplied in literal form -sub _strip_outer_paren { - my ($self, $arg) = @_; - - return $self->_SWITCH_refkind ($arg, { - ARRAYREFREF => sub { - $$arg->[0] = __strip_outer_paren ($$arg->[0]); - return $arg; - }, - SCALARREF => sub { - return \__strip_outer_paren( $$arg ); - }, - FALLBACK => sub { - return $arg - }, - }); -} - -sub __strip_outer_paren { - my $sql = shift; - - if ($sql and not ref $sql) { - while ($sql =~ /^ \s* \( (.*) \) \s* $/x ) { - $sql = $1; - } - } - - return $sql; -} - -sub _where_field_IN { - my ($self, $lhs, $op, $rhs) = @_; - $rhs = $self->_strip_outer_paren ($rhs); - return $self->SUPER::_where_field_IN ($lhs, $op, $rhs); -} - -sub _where_field_BETWEEN { - my ($self, $lhs, $op, $rhs) = @_; - $rhs = $self->_strip_outer_paren ($rhs); - return $self->SUPER::_where_field_BETWEEN ($lhs, $op, $rhs); -} # Slow but ANSI standard Limit/Offset support. DB2 uses this sub _RowNumberOver { @@ -517,7 +471,7 @@ sub _recurse_from { $join_type =~ s/^\s+ | \s+$//xg; } - $join_type ||= $self->_default_jointype; + $join_type = $self->{_default_jointype} if not defined $join_type; my $join_clause = sprintf ('%s JOIN ', $join_type ? ' ' . uc($join_type) : '' @@ -534,8 +488,6 @@ sub _recurse_from { return join('', @sqlf); } -sub _default_jointype {}; - sub _fold_sqlbind { my ($self, $sqlbind) = @_;