[interchange] * Fix problem found after testing -- in-place modification of $column

Mike Heins interchange-cvs at icdevgroup.org
Tue May 24 15:24:42 UTC 2016


commit ef7dc05b4491349860e6b5e8f255264d9c87f087
Author: Mike Heins <mike at perusion.com>
Date:   Tue May 24 11:13:25 2016 -0400

    * Fix problem found after testing -- in-place modification of $column
      prevented accessing configuration. It might have been nice to use $qcolumn
      or something...

 lib/Vend/Table/DBI.pm |   17 ++++++++++-------
 1 files changed, 10 insertions(+), 7 deletions(-)
---
diff --git a/lib/Vend/Table/DBI.pm b/lib/Vend/Table/DBI.pm
index 3504c13..deb2c6d 100644
--- a/lib/Vend/Table/DBI.pm
+++ b/lib/Vend/Table/DBI.pm
@@ -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)) {
@@ -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] = ?};



More information about the interchange-cvs mailing list