From: Peter Rabbitson Date: Tue, 22 Sep 2009 11:07:31 +0000 (+0000) Subject: The hack is no longer necessary with a recent sqla X-Git-Tag: v0.08113~50 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=517f91301e206be0246389f608ece68f3906f6de;p=dbsrgits%2FDBIx-Class.git The hack is no longer necessary with a recent sqla --- diff --git a/Makefile.PL b/Makefile.PL index 1bd8125..e3885d2 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -42,7 +42,7 @@ requires 'MRO::Compat' => '0.09'; requires 'Module::Find' => '0.06'; requires 'Path::Class' => '0.16'; requires 'Scope::Guard' => '0.03'; -requires 'SQL::Abstract' => '1.58'; +requires 'SQL::Abstract' => '1.60'; requires 'SQL::Abstract::Limit' => '0.13'; requires 'Sub::Name' => '0.04'; diff --git a/lib/DBIx/Class/SQLAHacks.pm b/lib/DBIx/Class/SQLAHacks.pm index 93c1009..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 {