From: Dmitry Latin Date: Wed, 9 Apr 2014 17:32:46 +0000 (+0400) Subject: Fix bug for literal bind for ARRAY X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=0a242eea697bc23e5085448e00d31818f93fc102;p=dbsrgits%2FDBIx-Class-Historic.git Fix bug for literal bind for ARRAY --- diff --git a/lib/DBIx/Class/InflateColumn.pm b/lib/DBIx/Class/InflateColumn.pm index 9214582..ae98d75 100644 --- a/lib/DBIx/Class/InflateColumn.pm +++ b/lib/DBIx/Class/InflateColumn.pm @@ -116,7 +116,15 @@ sub _deflated_column { my ($self, $col, $value) = @_; # return $value unless ref $value && blessed($value); # If it's not an object, don't touch it ## Leave scalar refs (ala SQL::Abstract literal SQL), untouched, deflate all other refs - return $value unless (ref $value && ref($value) ne 'SCALAR'); + ## Also leave ref refs if it is ARRAY + return $value + unless ( + ref $value + && !( ref($value) eq 'SCALAR' + || ( ref($value) eq 'REF' && ref($$value) eq 'ARRAY' ) + ) + ); + my $info = $self->column_info($col) or $self->throw_exception("No column info for $col"); return $value unless exists $info->{_inflate_info}; diff --git a/t/update/inflate_literal_bind.t b/t/update/array_literal_bind.t similarity index 83% rename from t/update/inflate_literal_bind.t rename to t/update/array_literal_bind.t index 38527e3..19c7e97 100644 --- a/t/update/inflate_literal_bind.t +++ b/t/update/array_literal_bind.t @@ -15,7 +15,8 @@ ok( $event->update( { starts_at => \[ - 'MAX(datetime(?), datetime(?))', '2006-04-25T22:24:33', + 'MAX(starts_at, datetime(?), datetime(?))', + '2006-04-25T22:24:33', '2007-04-25T22:24:33', ] }