From: Kevin L. Kane Date: Tue, 18 Nov 2014 13:02:33 +0000 (-0500) Subject: Fix updating multiple CLOB/BLOB columns on Oracle X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=5713726d6eda6797caf886ba9c29ee0a423f75ac;p=dbsrgits%2FDBIx-Class-Historic.git Fix updating multiple CLOB/BLOB columns on Oracle The genric _dbi_attrs_for_bind caches the attribute hashrefs by data type, so we can't modify them directly with column-specific data. Instead, copy it and add the ora_field attribute to the copy. (cherry pick of 3d02b69a) --- diff --git a/AUTHORS b/AUTHORS index 180d485..6a9f6ef 100644 --- a/AUTHORS +++ b/AUTHORS @@ -104,6 +104,7 @@ Jordan Metzmeier jshirley: J. Shirley kaare: Kaare Rasmussen kd: Kieren Diment +kkane: Kevin L. Kane konobi: Scott McWhirter lejeunerenard: Sean Zellmer littlesavage: Alexey Illarionov diff --git a/Changes b/Changes index a241cbd..1821b49 100644 --- a/Changes +++ b/Changes @@ -4,6 +4,7 @@ Revision history for DBIx::Class - Relax the 'self_result_object' argument check in the relationship resolution codepath, restoring exotic uses of inflate_result http://lists.scsys.co.uk/pipermail/dbix-class/2015-January/011876.html + - Fix updating multiple CLOB/BLOB columns on Oracle * Misc - Remove warning about potential side effects of RT#79576 (scheduled) diff --git a/lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm b/lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm index 2b4ce75..636e40e 100644 --- a/lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm +++ b/lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm @@ -419,11 +419,17 @@ sub _dbi_attrs_for_bind { my $attrs = $self->next::method($ident, $bind); - for my $i (0 .. $#$attrs) { - if (keys %{$attrs->[$i]||{}} and my $col = $bind->[$i][0]{dbic_colname}) { - $attrs->[$i]{ora_field} = $col; - } - } + # Push the column name into all bind attrs, make sure to *NOT* write into + # the existing $attrs->[$idx]{..} hashref, as it is cached by the call to + # next::method above. + $attrs->[$_] + and + keys %{ $attrs->[$_] } + and + $bind->[$_][0]{dbic_colname} + and + $attrs->[$_] = { %{$attrs->[$_]}, ora_field => $bind->[$_][0]{dbic_colname} } + for 0 .. $#$attrs; $attrs; }