[Dbix-class] [PATCH] allow non-columns to be passed in joins using the from attribute

mike pulsation at gmail.com
Thu Sep 21 01:00:53 CEST 2006


i have no idea how backwards this is.  it took me over an hour just to
track down where this was being generated.

it allows you to pass a scalar ref as a condition to any custom JOINs
using the from attribute.  i don't know if it affects anything else,
but it makes my query (http://scsys.co.uk:8001/4102) work.

ymmv.  if there's nothing wrong with it, please include this in the
next release, as it drastically reduces the number of queries i would
have had to execute just to get a small piece of
information.

-mike

--- snip -- snip --- snip ---
Index: lib/DBIx/Class/Storage/DBI.pm
===================================================================
--- lib/DBIx/Class/Storage/DBI.pm       (revision 2797)
+++ lib/DBIx/Class/Storage/DBI.pm       (working copy)
@@ -232,7 +232,7 @@
   if (ref $cond eq 'HASH') {
     my %j;
     for (keys %$cond) {
-      my $x = '= '.$self->_quote($cond->{$_}); $j{$_} = \$x;
+      my $x = '= '.(ref($cond->{$_}) ? ${ $cond->{$_} } :
$self->_quote($cond->{$_})); $j{$_} = \$x;
     };
     return $self->_recurse_where(\%j);
   } elsif (ref $cond eq 'ARRAY') {
--- snip -- snip --- snip ---



More information about the Dbix-class mailing list