1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
|
From 5713726d6eda6797caf886ba9c29ee0a423f75ac Mon Sep 17 00:00:00 2001
From: "Kevin L. Kane" <kevin.kane@gmail.com>
Date: Tue, 18 Nov 2014 08:02:33 -0500
Subject: [PATCH 3/5] 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)
---
AUTHORS | 1 +
Changes | 1 +
lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm | 16 +++++++++++-----
3 files changed, 13 insertions(+), 5 deletions(-)
--- a/Changes
+++ b/Changes
@@ -4,6 +4,7 @@
- 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)
--- a/lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm
+++ b/lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm
@@ -419,11 +419,17 @@
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;
}
|