[interchange] Avoid quoting $column in set_field().
Peter Ajamian
interchange-cvs at icdevgroup.org
Thu May 26 00:21:51 UTC 2016
commit 974896cfac750c3d9c7bdd03f600a816ef8deb1c
Author: Peter Ajamian <peter at pajamian.dhs.org>
Date: Thu May 26 12:15:55 2016 +1200
Avoid quoting $column in set_field().
Avoid modifying $column by quoting it in the middle of set_field(). This had
the unintended consequence that later changes to the code which tried to access
column settings were broken due to the need to use $column as a key. We now
create $qcolumn which holds the quoted value instead.
lib/Vend/Table/DBI.pm | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
---
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 {
More information about the interchange-cvs
mailing list