use Carp;
use strict;
use warnings;
-use List::Util qw/first/;
+use List::Util qw/first/;
+use Scalar::Util qw/blessed/;
#======================================================================
# GLOBALS
#======================================================================
our $VERSION = '1.49_01';
+$VERSION = eval $VERSION; # numify for warning-free dev releases
+
our $AUTOLOAD;
# dispatch on appropriate method according to refkind of $where
my $method = $self->_METHOD_FOR_refkind("_where", $where);
- $self->$method($where, $logic);
+
+
+ my ($sql, @bind) = $self->$method($where, $logic);
+
+ # DBIx::Class directly calls _recurse_where in scalar context, so
+ # we must implement it, even if not in the official API
+ return wantarray ? ($sql, @bind) : $sql;
}
ARRAYREF => sub {
map {$self->_SWITCH_refkind($_, {
SCALAR => sub {$self->_quote($_)},
+ UNDEF => sub {},
SCALARREF => sub {$$_}, # literal SQL, no quoting
HASHREF => sub {$self->_order_by_hash($_)}
}) } @$arg;
# $suffix = 'REF' x (length of ref chain, i. e. \\[] is REFREFREF)
while (1) {
+ # blessed references are considered like scalars
+ last if blessed $data;
$suffix .= 'REF';
$ref = ref $data;
+
last if $ref ne 'REF';
$data = $$data;
}