[interchange] Simplify some code (no functional change)

Jon Jensen interchange-cvs at icdevgroup.org
Fri Mar 2 18:14:31 UTC 2018


commit fa63936889ba6877869ce9f19c8ac313a8ca375c
Author: Jon Jensen <jon at endpoint.com>
Date:   Wed Feb 28 20:10:20 2018 -0700

    Simplify some code (no functional change)

 lib/Vend/Data.pm         |   12 ++++++------
 lib/Vend/Table/Editor.pm |   12 ++++--------
 2 files changed, 10 insertions(+), 14 deletions(-)
---
diff --git a/lib/Vend/Data.pm b/lib/Vend/Data.pm
index 7ababc9..96e9db9 100644
--- a/lib/Vend/Data.pm
+++ b/lib/Vend/Data.pm
@@ -1,6 +1,6 @@
 # Vend::Data - Interchange databases
 #
-# Copyright (C) 2002-2017 Interchange Development Group
+# Copyright (C) 2002-2018 Interchange Development Group
 # Copyright (C) 1996-2002 Red Hat, Inc.
 #
 # This program was originally based on Vend 0.2 and 0.3
@@ -2282,11 +2282,11 @@ sub update_data {
 				if $::Pragma->{dml} eq 'strict'
 					|| $function eq 'insert' && $::Pragma->{dml} eq 'preserve';
 
-			for(keys %$qd) {
-#::logDebug("update_data: Getting ready to set_slice");
-				my $k = $multikey ? undef : $key;
-				$qret = $qd->{$_}->set_slice([$dml, $k], $qf->{$_}, $qv->{$_});
-				$rows_set[$i] = $qret unless $rows_set[$i];
+			my $k = $multikey ? undef : $key;
+			my $args = [$dml, $k];
+			for (keys %$qd) {
+				$qret = $qd->{$_}->set_slice($args, $qf->{$_}, $qv->{$_});
+				$rows_set[$i] ||= $qret;
 			}
 			if($blob && $rows_set[$i]) {
 				$brec->{mv_data_fields} = join " ", @fields;
diff --git a/lib/Vend/Table/Editor.pm b/lib/Vend/Table/Editor.pm
index d9c61b0..fa19300 100644
--- a/lib/Vend/Table/Editor.pm
+++ b/lib/Vend/Table/Editor.pm
@@ -1,6 +1,6 @@
 # Vend::Table::Editor - Swiss-army-knife table editor for Interchange
 #
-# Copyright (C) 2002-2016 Interchange Development Group
+# Copyright (C) 2002-2018 Interchange Development Group
 # Copyright (C) 2002 Mike Heins <mike at perusion.net>
 #
 # This program was originally based on Vend 0.2 and 0.3
@@ -2334,6 +2334,7 @@ show_times("begin table editor call item_id=$key") if $Global::ShowTimes;
 			}
 		}
 	}
+#::logDebug("table editor multikey/key/data=\n" . ::uneval($multikey, $key, $data));
 
 	my $regin = $opt->{all_opts} ? 1 : 0;
 
@@ -2622,13 +2623,8 @@ EOF
 		}
 	}
 
-	my $keycol;
-	if($opt->{notable}) {
-		$keycol = $opt->{ui_data_key_name};
-	}
-	else {
-		$keycol = $opt->{ui_data_key_name} || $db->config('KEY');
-	}
+	my $keycol = $opt->{ui_data_key_name};
+	$keycol ||= $db->config('KEY') if !$opt->{notable};
 
 	###############################################################
 



More information about the interchange-cvs mailing list