[ic] [interchange] * Fix problem found after testing -- in-place modification of $column
Peter
peter at pajamian.dhs.org
Tue May 24 20:45:50 UTC 2016
On 25/05/16 08:36, Peter wrote:
> On 25/05/16 03:24, Mike Heins wrote:
>> * Fix problem found after testing -- in-place modification of $column
>> prevented accessing configuration. It might have been nice to use $qcolumn
>> or something...
>
> Being able to access column config in the future was not something I
> took into consideration at the time. It should be easy enough to change
> it to $qcolumn, though.
Feel free to test this, if it doesn't break anything for you I can push
it out:
diff --git a/lib/Vend/Table/DBI.pm b/lib/Vend/Table/DBI.pm
index deb2c6d..25d5360 100644
--- a/lib/Vend/Table/DBI.pm
+++ b/lib/Vend/Table/DBI.pm
@@ -1873,6 +1873,10 @@ sub set_field {
return undef;
}
+ my $qcolumn = $column;
+ $qcolumn = $s->[$DBI]->quote_identifier($column)
+ if $s->[$CONFIG]{QUOTE_IDENTIFIERS};
+
my $lcfg;
if(
$s->[$CONFIG]->{LENGTH_EXCEPTION_DEFAULT}
@@ -1899,15 +1903,11 @@ sub set_field {
$extra = "$f = $f, ";
}
- # Would have preferred that this was not invasive, eliminates
possibility
- # of accessing column configuration below this
- $column = $s->[$DBI]->quote_identifier($column) if
$s->[$CONFIG]{QUOTE_IDENTIFIERS};
-
my $q;
if(! $s->record_exists($rawkey)) {
if( $s->[$CONFIG]{AUTO_SEQUENCE} ) {
$key = 0 if ! $key;
- $q = qq{INSERT INTO $s->[$QTABLE] ($s->[$QKEY],
$column) VALUES (?,?)};
+ $q = qq{INSERT INTO $s->[$QTABLE] ($s->[$QKEY],
$qcolumn) VALUES (?,?)};
}
else {
#::logDebug("creating key '$rawkey' in table $s->[$TABLE]");
@@ -1917,7 +1917,7 @@ sub set_field {
my @args;
if(!$q) {
- $q = qq{update $s->[$QTABLE] SET $extra$column = ? where
$s->[$QKEY] = ?};
+ $q = qq{update $s->[$QTABLE] SET $extra$qcolumn = ?
where $s->[$QKEY] = ?};
@args = ($value, $key);
}
else {
Peter
More information about the interchange-users
mailing list