Skip to content

Commit

Permalink
* Fix problem found after testing -- in-place modification of $column
Browse files Browse the repository at this point in the history
  prevented accessing configuration. It might have been nice to use $qcolumn
  or something...
  • Loading branch information
perusionmike committed May 24, 2016
1 parent c897a8d commit ef7dc05
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions lib/Vend/Table/DBI.pm
Expand Up @@ -1892,7 +1892,16 @@ sub set_field {

my $rawkey = $key;
my $rawval = $value;
$column = $s->[$DBI]->quote_identifier($column) if $s->[$CONFIG]{QUOTE_IDENTIFIERS};

my $extra = '';
if( my $f = $s->[$CONFIG]{TIMESTAMP_FIELD} and exists $s->[$CONFIG]{NO_UPDATE}{$column} ) {
$f = $s->[$DBI]->quote_identifier($f) if $s->[$CONFIG]->{QUOTE_IDENTIFIERS};
$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)) {
Expand All @@ -1906,12 +1915,6 @@ sub set_field {
}
}

my $extra = '';
if( my $f = $s->[$CONFIG]{TIMESTAMP_FIELD} and exists $s->[$CONFIG]{NO_UPDATE}{$column} ) {
$f = $s->[$DBI]->quote_identifier($f) if $s->[$CONFIG]->{QUOTE_IDENTIFIERS};
$extra = "$f = $f, ";
}

my @args;
if(!$q) {
$q = qq{update $s->[$QTABLE] SET $extra$column = ? where $s->[$QKEY] = ?};
Expand Down

0 comments on commit ef7dc05

Please sign in to comment.