[interchange-cvs] interchange - heins modified 8 files

interchange-core@interchange.redhat.com interchange-core@interchange.redhat.com
Mon Nov 26 13:35:00 2001


User:      heins
Date:      2001-11-26 18:34:02 GMT
Modified:  lib/Vend DbSearch.pm Glimpse.pm Search.pm TextSearch.pm
Modified:  lib/Vend/Table Common.pm DBI.pm InMemory.pm LDAP.pm
Log:
	* Make the DbSearch module search references and not tab-joined lines.

	* Search.pm now modifies its behavior for $limit_sub->() and $return_sub->()
	  to create a reference if needed.

	* This solves the tab-delimited wrong-search-result problem while
	  increasing performance up to 20% on large database records.

	* Slight change to each_nokey() routine -- it returns a
	  reference instead of a list. This should have no side-effect
	  unless someone happened to use the
	  Vend::Table::*::each_nokey() routine somewhere in custom code.
	  Certainly this is not documented as part of the API, and we
	  never use it in any of our stuff.

	* Change passes regression tests 100%. Glimpse is not really
	  tested though I anticipate no problems.

Revision  Changes    Path
2.5       +19 -19    interchange/lib/Vend/DbSearch.pm


rev 2.5, prev_rev 2.4
Index: DbSearch.pm
===================================================================
RCS file: /anon_cvs/repository/interchange/lib/Vend/DbSearch.pm,v
retrieving revision 2.4
retrieving revision 2.5
diff -u -r2.4 -r2.5
--- DbSearch.pm	2001/11/22 03:53:15	2.4
+++ DbSearch.pm	2001/11/26 18:34:02	2.5
@@ -1,6 +1,6 @@
 # Vend::DbSearch - Search indexes with Interchange
 #
-# $Id: DbSearch.pm,v 2.4 2001/11/22 03:53:15 jon Exp $
+# $Id: DbSearch.pm,v 2.5 2001/11/26 18:34:02 mheins Exp $
 #
 # Adapted for use with Interchange from Search::TextSearch
 #
@@ -26,7 +26,7 @@
 
 @ISA = qw(Vend::Search);
 
-$VERSION = substr(q$Revision: 2.4 $, 10);
+$VERSION = substr(q$Revision: 2.5 $, 10);
 
 use Search::Dict;
 use strict;
@@ -135,9 +135,11 @@
 	my $dbref = $s->{table} || undef;
 #::logDebug("before db mapping: self=" . ::Vend::Util::uneval_it({%$s}));
 
+#::logDebug("searching $searchfiles[0], keys Database before=" . join ",", grep /backup/, keys %{$Vend::Cfg->{Database}});
 	if( ! $dbref ) {
 		$s->{dbref} = $dbref = Vend::Data::database_exists_ref($searchfiles[0]);
 	}
+#::logDebug("searching $searchfiles[0], keys  after=" . join ",", grep /backup/, keys %{$Vend::Cfg->{Database}});
 	if(! $dbref) {
 		return $s->search_error(
 			"your search file a valid database reference, was '$searchfiles[0]'."
@@ -251,27 +253,25 @@
 
 		$@  and  return $s->search_error("Return subroutine creation: $@");
 
+#::logDebug("qual=$qual");
 		if(! defined $f and defined $limit_sub) {
 #::logDebug("no f, limit, dbref=$dbref");
 			local($_);
-			while ($_ = join "\t",
-						map { s/\t/ /g; $_ }
-						$dbref->each_nokey($qual || undef)
-					) {
-				next unless &$limit_sub($_);
-				push @out, &$return_sub($_);
+			my $ref;
+			while($ref = $dbref->each_nokey($qual) ) {
+				next unless $limit_sub->($ref);
+				push @out, $return_sub->($ref);
 			}
 		}
 		elsif(defined $limit_sub) {
 #::logDebug("f and limit, dbref=$dbref");
 			local($_);
-			while ($_ = join "\t",
-						map { s/\t/ /g; $_ }
-						$dbref->each_nokey($qual || undef)
-					) {
+			my $ref;
+			while($ref = $dbref->each_nokey($qual) ) {
+				$_ = join "\t", @$ref;
 				next unless &$f();
-				next unless &$limit_sub($_);
-				push @out, &$return_sub($_);
+				next unless $limit_sub->($ref);
+				push @out, $return_sub->($ref);
 			}
 		}
 		elsif (!defined $f) {
@@ -280,12 +280,12 @@
 		else {
 #::logDebug("f and no limit, dbref=$dbref");
 			local($_);
-			while ($_ = join "\t",
-						map { s/\t/ /g; $_ }
-						$dbref->each_nokey($qual || undef)
-					) {
+			my $ref;
+			while($ref = $dbref->each_nokey($qual) ) {
+#::logDebug("f and no limit, ref=$ref");
+				$_ = join "\t", @$ref;
 				next unless &$f();
-				push @out, &$return_sub($_);
+				push @out, $return_sub->($ref);
 			}
 		}
 		$s->restore_specs();



2.2       +5 -5      interchange/lib/Vend/Glimpse.pm


rev 2.2, prev_rev 2.1
Index: Glimpse.pm
===================================================================
RCS file: /anon_cvs/repository/interchange/lib/Vend/Glimpse.pm,v
retrieving revision 2.1
retrieving revision 2.2
diff -u -r2.1 -r2.2
--- Glimpse.pm	2001/11/09 22:03:28	2.1
+++ Glimpse.pm	2001/11/26 18:34:02	2.2
@@ -1,6 +1,6 @@
 # Vend::Glimpse - Search indexes with Glimpse
 #
-# $Id: Glimpse.pm,v 2.1 2001/11/09 22:03:28 mheins Exp $
+# $Id: Glimpse.pm,v 2.2 2001/11/26 18:34:02 mheins Exp $
 #
 # Adapted for use with Interchange from Search::Glimpse
 #
@@ -25,7 +25,7 @@
 require Vend::Search;
 @ISA = qw(Vend::Search);
 
-$VERSION = substr(q$Revision: 2.1 $, 10);
+$VERSION = substr(q$Revision: 2.2 $, 10);
 use strict;
 
 sub array {
@@ -260,14 +260,14 @@
 		my $prospect;
 
 		eval {
-			($limit_sub, $prospect) = $s->get_limit($f);
+			($limit_sub, $prospect) = $s->get_limit($f, 1);
 		};
 
 		$@  and  return $s->search_error("Limit subroutine creation: $@");
 
 		$f = $prospect if $prospect;
 
-		eval {($return_sub, $delayed_return) = $s->get_return()};
+		eval {($return_sub, $delayed_return) = $s->get_return(undef, 1)};
 
 		$@  and  return $s->search_error("Return subroutine creation: $@");
 
@@ -319,7 +319,7 @@
 		$s->hash_fields($s->{mv_field_names}, qw/mv_sort_field/);
 #::logDebug("gsearch after hash fields: self=" . ::Vend::Util::uneval_it({%$s}));
 		$s->sort_search_return(\@out);
-		$delayed_return = $s->get_return(1);
+		$delayed_return = $s->get_return(1,1);
 		@out = map { $delayed_return->($_) } @out;
 	}
 #::logDebug("after delayed return: self=" . ::Vend::Util::uneval_it({%$s}));



2.1       +72 -48    interchange/lib/Vend/Search.pm


rev 2.1, prev_rev 2.0
Index: Search.pm
===================================================================
RCS file: /anon_cvs/repository/interchange/lib/Vend/Search.pm,v
retrieving revision 2.0
retrieving revision 2.1
diff -u -r2.0 -r2.1
--- Search.pm	2001/07/18 02:23:14	2.0
+++ Search.pm	2001/11/26 18:34:02	2.1
@@ -1,6 +1,6 @@
 # Vend::Search - Base class for search engines
 #
-# $Id: Search.pm,v 2.0 2001/07/18 02:23:14 jon Exp $
+# $Id: Search.pm,v 2.1 2001/11/26 18:34:02 mheins Exp $
 #
 # Copyright (C) 1996-2001 Red Hat, Inc. <interchange@redhat.com>
 #
@@ -21,7 +21,7 @@
 
 package Vend::Search;
 
-$VERSION = substr(q$Revision: 2.0 $, 10);
+$VERSION = substr(q$Revision: 2.1 $, 10);
 
 use strict;
 use vars qw($VERSION);
@@ -410,38 +410,59 @@
 # Returns a field weeding function based on the search specification.
 # Input is the raw line and the delimiter, output is the fields
 # specified in the return_field specification
+# If we get a third parameter, $makeref, we need to build a reference
 sub get_return {
-	my($s, $final) = @_;
+	my($s, $final, $makeref) = @_;
 	my ($return_sub);
 
-	# We will pick out the return fields later if sorting
-	if(! $final and $s->{mv_sort_field}) {
-		return ( sub {@_}, 1);
-	}
+	if($makeref) {
+
+		# Avoid the hash key lookup, it is a closure
+		my $delim = $s->{mv_index_delim};
 
-	if(! $s->{mv_return_fields}) {
-		my $delim = $s->{mv_index_delim} || "\t";
-#::logDebug("code return. delim='$delim'");
-		$return_sub = sub {
-				$_[0] =~ s/$delim.*//s;
-				my $ary = [ $_[0] ];
-#::logDebug("ary is:" . ::uneval($ary));
-				return $ary;
-				};
+		# We will pick out the return fields later if sorting
+		# This returns
+		if(! $final and $s->{mv_sort_field}) {
+			return ( 
+				sub {
+					[ split /$delim/o, shift(@_) ]
+				},
+				1,
+			);
+		}
+
+		if(! $s->{mv_return_fields}) {
+			$return_sub = sub {
+								$_[0] =~ s/$delim.*//s;
+								return $_[0];
+						};
+		}
+		else {
+			my @fields = @{$s->{mv_return_fields}};
+			$return_sub = sub {
+							return [ (split /$delim/o, shift(@_))[@fields] ]
+						};
+		}
 	}
 	else {
-		my $delim = $s->{mv_index_delim};
-#::logDebug("rf[0]='$s->{mv_return_fields}[0]'");
-		my @fields = @{$s->{mv_return_fields}};
-#::logDebug("delim='$delim' fields='@fields'");
-		$return_sub = sub {
-			chomp($_[0]);
-			my $ary = [
-				(split /\Q$delim/o, $_[0])[@fields]
-				];
-#::logDebug("line is:$_[0]\nary is:" . ::uneval($ary));
-				return $ary;
-		};
+		# We will pick out the return fields later if sorting
+		# This returns
+		if(! $final and $s->{mv_sort_field}) {
+			return ( sub { [ @{ shift(@_) } ] }, 1);
+		}
+
+		if(! $s->{mv_return_fields}) {
+			$return_sub = sub {
+								return [ $_[0]->[0] ];
+						};
+		}
+		else {
+			my @fields = @{$s->{mv_return_fields}};
+			$return_sub = sub {
+				my $ref = [ @{$_[0]}[@fields] ];
+				return $ref;
+			};
+		}
 	}
 	return $return_sub;
 }
@@ -535,12 +556,19 @@
 # Returns a screening function based on the search specification.
 # The $f is a reference to previously created search function which does
 # a pattern match on the line.
+# Makeref says we have to build a reference from the supplied text line
 sub get_limit {
-	my($s, $f) = @_;
+	my($s, $f, $makeref) = @_;
 	my $limit_sub;
 	my $range_code = '';
 	my $rd = $s->{mv_record_delim} || '\n';
-	my $code       = "sub {\nmy \$line = shift; chomp \$line; \$line =~ tr/$rd//d;\n";
+	my $code;
+	if($makeref) {
+		$code       = "sub {\nmy \$line = [split /$s->{mv_index_delim}/, shift(\@_)];\n";
+	}
+	else {
+		$code       = "sub {\nmy \$line = shift;\n";
+	}
 	my $join_key;
 	$join_key = defined $s->{mv_return_fields} ? $s->{mv_return_fields}[0] : 0;
 	$join_key = 0 if $join_key eq '*';
@@ -574,15 +602,14 @@
 		$s->{mv_field_hash} = create_field_hash($s) 
 			unless $s->{mv_field_hash};
 		$code .= <<EOF;
-my \$key = (split m{$s->{mv_index_delim}}, \$line)[$join_key];
+my \$key = \$line->[$join_key];
 EOF
 		for(@join_fields) {
 			my ($table, $col) = split /:+/, $_, 2;
 			if($table) {
 				$wild_card = 0;
 				$code .= <<EOF;
-\$line .= qq{$s->{mv_index_delim}} .
-		  Vend::Data::database_field('$table', \$key, '$col');
+push \@\$line, Vend::Data::database_field('$table', \$key, '$col');
 EOF
 			}
 			elsif ($col =~ tr/:/,/) {
@@ -594,16 +621,15 @@
 				$wild_card = 1;
 				$col =~ s/[^\d,.]//g;
 			$code .= <<EOF;
-my \$addl = join " ", (split m{\Q$s->{mv_index_delim}\E}, \$line)[$col];
-\$line .= qq{$s->{mv_index_delim}} . \$addl;
+my \$addl = join " ", \@\$line[$col];
+push \@\$line .= \$addl;
 EOF
 			}
 			else {
 				$wild_card = 1;
 				$code .= <<EOF;
-my \$addl = \$line;
-\$addl =~ tr/$s->{mv_index_delim}/ /;
-\$line .= qq{$s->{mv_index_delim}} . \$addl;
+my \$addl = join " ", \@\$line;
+push \@\$line .= \$addl;
 EOF
 			}
 		}
@@ -613,7 +639,7 @@
 
 	if ( ref $s->{mv_range_look} )  {
 		$range_code = <<EOF;
-return $joiner \$s->range_check(qq{$s->{mv_index_delim}},\$line);
+return $joiner \$s->range_check(\$line);
 EOF
 	}
 	if ( $s->{mv_coordinate} ) {
@@ -624,7 +650,7 @@
 		 }
 		 my $callchar = $fields =~ /,/ ? '@' : '$';
 		 $code .= <<EOF;
-	my \@fields = split /\\Q$s->{mv_index_delim}/, \$line;
+	my \@fields = \@\$line;
 	\@fields = ${callchar}fields[$fields];
 EOF
 		$code .= <<EOF if $Global::DebugFile and $CGI::values{debug};
@@ -777,7 +803,7 @@
 	}
 	elsif ( @{$s->{mv_search_field}} )  {
 		if(! $s->{mv_begin_string}[0]) {
-#::logDebug("Not begin, sub=f");
+#::logDebug("Not begin, sub=$f");
 			$sub = $f;
 		}
 		elsif (! $s->{mv_orsearch}[0] ) {
@@ -800,9 +826,7 @@
 		}
 		 $code .= $range_code;
 		 $code .= <<EOF;
-	my \@fields = (split /\\Q$s->{mv_index_delim}/, \$line)[$fields];
-	my \$field = join q{$s->{mv_index_delim}}, \@fields;
-	\$_ = \$field;
+	\$_ = join q{$s->{mv_index_delim}}, \@\$line[$fields];
 	return(\$_ = \$line) if &\$sub();
 	return undef;
 }
@@ -831,8 +855,8 @@
 # Check to see if the fields specified in the range_look array
 # meet the criteria
 sub range_check {
-	my($s,$index_delim,$line) = @_;
-	my @fields = (split /\Q$index_delim/, $line)[@{$s->{mv_range_look}}];
+	my($s,$line) = @_;
+	my @fields = @$line[@{$s->{mv_range_look}}];
 	my $i = 0;
 	for(@fields) {
 		no strict 'refs';
@@ -1074,8 +1098,8 @@
 	my $delim = quotemeta $s->{mv_index_delim};
 	my $code = <<EOF;
 sub {
-	my \@a = (split /$delim/, \$a, $max)[$f_string];
-	my \@b = (split /$delim/, \$b, $max)[$f_string];
+	my \@a = \@{\$a}[$f_string];
+	my \@b = \@{\$b}[$f_string];
 	my \$r;
 EOF
 #::logDebug("No define of Sort_field") if ! defined $Sort_field{'none'};



2.1       +16 -15    interchange/lib/Vend/TextSearch.pm


rev 2.1, prev_rev 2.0
Index: TextSearch.pm
===================================================================
RCS file: /anon_cvs/repository/interchange/lib/Vend/TextSearch.pm,v
retrieving revision 2.0
retrieving revision 2.1
diff -u -r2.0 -r2.1
--- TextSearch.pm	2001/07/18 02:23:14	2.0
+++ TextSearch.pm	2001/11/26 18:34:02	2.1
@@ -1,6 +1,6 @@
 # Vend::TextSearch - Search indexes with Perl
 #
-# $Id: TextSearch.pm,v 2.0 2001/07/18 02:23:14 jon Exp $
+# $Id: TextSearch.pm,v 2.1 2001/11/26 18:34:02 mheins Exp $
 #
 # Adapted for use with Interchange from Search::TextSearch
 #
@@ -28,7 +28,7 @@
 use vars qw(@ISA);
 @ISA = qw(Vend::Search);
 
-$VERSION = substr(q$Revision: 2.0 $, 10);
+$VERSION = substr(q$Revision: 2.1 $, 10);
 
 use Search::Dict;
 use strict;
@@ -216,14 +216,15 @@
 		my $prospect;
 
 		eval {
-			($limit_sub, $prospect) = $s->get_limit($f);
+			# 1 refers to fact you have to make ref from line
+			($limit_sub, $prospect) = $s->get_limit($f, 1);
 		};
 
 		$@  and  return $s->search_error("Limit subroutine creation: $@");
 
 		$f = $prospect if $prospect;
 
-		eval {($return_sub, $delayed_return) = $s->get_return()};
+		eval {($return_sub, $delayed_return) = $s->get_return( undef, 1 )};
 
 		$@  and  return $s->search_error("Return subroutine creation: $@");
 
@@ -269,37 +270,37 @@
 			while(<SEARCH>) {
 #::logDebug("$_");
 				last if &$dict_limit($_);
-				next unless ! defined $f or &$f();
-				next unless &$limit_sub($_);
+				next unless &$f();
+				next unless $limit_sub->($_);
 				(push @out, $searchfile and last)
 					if $s->{mv_return_file_name};
-				push @out, &$return_sub($_);
+				push @out, $return_sub->($_);
 			}
 		}
 		elsif($s->{mv_dict_end}) {
 			while(<SEARCH>) {
-				last if &$dict_limit($_);
+				last if $dict_limit->($_);
 				next unless &$f();
 				(push @out, $searchfile and last)
 					if $s->{mv_return_file_name};
-				push @out, &$return_sub($_);
+				push @out, $return_sub->($_);
 			}
 		}
 		elsif(! defined $f and defined $limit_sub) {
 			while(<SEARCH>) {
-				next unless &$limit_sub($_);
+				next unless $limit_sub->($_);
 				(push @out, $searchfile and last)
 					if $s->{mv_return_file_name};
-				push @out, &$return_sub($_);
+				push @out, $return_sub->($_);
 			}
 		}
 		elsif(defined $limit_sub) {
 			while(<SEARCH>) {
 				next unless &$f();
-				next unless &$limit_sub($_);
+				next unless $limit_sub->($_);
 				(push @out, $searchfile and last)
 					if $s->{mv_return_file_name};
-				push @out, &$return_sub($_);
+				push @out, $return_sub->($_);
 			}
 		}
 		elsif (!defined $f) {
@@ -310,7 +311,7 @@
 				next unless &$f();
 				(push @out, $searchfile and last)
 					if $s->{mv_return_file_name};
-				push @out, &$return_sub($_);
+				push @out, $return_sub->($_);
 			}
 		}
 		close SEARCH;
@@ -324,7 +325,7 @@
 		$s->hash_fields($s->{mv_field_names}, qw/mv_sort_field/);
 #::logDebug("after hash fields: self=" . ::Vend::Util::uneval_it({%$s}));
 		$s->sort_search_return(\@out);
-		$delayed_return = $s->get_return(1);
+		$delayed_return = $s->get_return(1,1);
 		@out = map { $delayed_return->($_) } @out;
 	}
 #::logDebug("after delayed return: self=" . ::Vend::Util::uneval_it({%$s}));



2.5       +4 -4      interchange/lib/Vend/Table/Common.pm


rev 2.5, prev_rev 2.4
Index: Common.pm
===================================================================
RCS file: /anon_cvs/repository/interchange/lib/Vend/Table/Common.pm,v
retrieving revision 2.4
retrieving revision 2.5
diff -u -r2.4 -r2.5
--- Common.pm	2001/11/02 13:23:14	2.4
+++ Common.pm	2001/11/26 18:34:02	2.5
@@ -1,6 +1,6 @@
 # Vend::Table::Common - Common access methods for Interchange databases
 #
-# $Id: Common.pm,v 2.4 2001/11/02 13:23:14 mheins Exp $
+# $Id: Common.pm,v 2.5 2001/11/26 18:34:02 mheins Exp $
 #
 # Copyright (C) 1996-2001 Red Hat, Inc. <interchange@redhat.com>
 #
@@ -22,7 +22,7 @@
 # Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 # MA  02111-1307  USA.
 
-$VERSION = substr(q$Revision: 2.4 $, 10);
+$VERSION = substr(q$Revision: 2.5 $, 10);
 use strict;
 
 package Vend::Table::Common;
@@ -585,9 +585,9 @@
 			my (@row) = $s->row($key);
 ##::logDebug("each_nokey: '$row[$rfield]' eq '$rsession' ??");
 			next if $row[$rfield] ne $rsession;
-			return @row;
+			return \@row;
 		}
-		return $s->row($key);
+		return [ $s->row($key) ];
     }
 }
 



2.5       +37 -24    interchange/lib/Vend/Table/DBI.pm


rev 2.5, prev_rev 2.4
Index: DBI.pm
===================================================================
RCS file: /anon_cvs/repository/interchange/lib/Vend/Table/DBI.pm,v
retrieving revision 2.4
retrieving revision 2.5
diff -u -r2.4 -r2.5
--- DBI.pm	2001/11/02 13:21:01	2.4
+++ DBI.pm	2001/11/26 18:34:02	2.5
@@ -1,6 +1,6 @@
 # Vend::Table::DBI - Access a table stored in an DBI/DBD database
 #
-# $Id: DBI.pm,v 2.4 2001/11/02 13:21:01 mheins Exp $
+# $Id: DBI.pm,v 2.5 2001/11/26 18:34:02 mheins Exp $
 #
 # Copyright (C) 1996-2001 Red Hat, Inc. <interchange@redhat.com>
 #
@@ -20,7 +20,7 @@
 # MA  02111-1307  USA.
 
 package Vend::Table::DBI;
-$VERSION = substr(q$Revision: 2.4 $, 10);
+$VERSION = substr(q$Revision: 2.5 $, 10);
 
 use strict;
 
@@ -980,14 +980,31 @@
 
 #::logDebug("set_slice query: $sql");
 #::logDebug("set_slice key/fields/values:\nkey=$key\n" . ::uneval($fary, $vary));
-	my $sth = $s->[$DBI]->prepare($sql)
-		or die ::errmsg("prepare %s: %s", $sql, $DBI::errstr);
-	my $rc = $sth->execute(@$vary)
-		or die ::errmsg("execute %s: %s", $sql, $DBI::errstr);
 
-	my $val	= $s->[$CONFIG]->{AUTO_SEQUENCE}
-			?  $s->last_sequence_value()
-			: $tkey;
+	my $val;
+	eval {
+		my $sth = $s->[$DBI]->prepare($sql)
+			or die ::errmsg("prepare %s: %s", $sql, $DBI::errstr);
+		my $rc = $sth->execute(@$vary)
+			or die ::errmsg("execute %s: %s", $sql, $DBI::errstr);
+
+		my $val	= $s->[$CONFIG]->{AUTO_SEQUENCE}
+				?  $s->last_sequence_value()
+				: $tkey;
+	};
+
+	if($@) {
+		my $caller = caller();
+		::logGlobal(
+			"%s error as called by %s: %s\nquery was:%s\nvalues were:'%s'",
+			'select_slice',
+			$caller,
+			$@,
+			$sql,
+			join("','", @$vary),
+			);
+		return undef;
+	}
 
 	return $val;
 }
@@ -1414,14 +1431,13 @@
 
 # Now supported, including qualification
 sub each_record {
-    my ($s, $qual) = @_;
-#::logDebug("each_record qual=$qual");
-	$qual = '' if ! $qual;
-	$qual .= $s->[$CONFIG]{Export_order} 
-		if $s->[$CONFIG]{Export_order};
+    my $s = shift;
 	$s = $s->import_db() if ! defined $s->[$DBI];
     my ($table, $db, $each);
     unless(defined $s->[$EACH]) {
+		my $qual = shift || '';
+		$qual .= $s->[$CONFIG]{Export_order} 
+			if $s->[$CONFIG]{Export_order};
 		($table, $db, $each) = @{$s}[$TABLE,$DBI,$EACH];
 		my $query = $db->prepare("select * from $table $qual")
             or die $DBI::errstr;
@@ -1445,14 +1461,13 @@
 
 # Now supported, including qualification
 sub each_nokey {
-    my ($s, $qual) = @_;
-#::logDebug("each_nokey qual=$qual");
-	$qual = '' if ! $qual;
-	$qual .= $s->[$CONFIG]{Export_order} 
-		if $s->[$CONFIG]{Export_order};
+    my $s = shift;
 	$s = $s->import_db() if ! defined $s->[$DBI];
     my ($table, $db, $each);
     unless(defined $s->[$EACH]) {
+		my $qual = shift || '';
+		$qual .= $s->[$CONFIG]{Export_order} 
+			if $s->[$CONFIG]{Export_order};
 		($table, $db, $each) = @{$s}[$TABLE,$DBI,$EACH];
 		my $restrict;
 		if($restrict = $Vend::Cfg->{TableRestrict}{$table}
@@ -1465,7 +1480,6 @@
 			$qual = $qual ? "$qual AND " : 'WHERE ';
 			my ($rfield, $rsession) = split /\s*=\s*/, $restrict;
 			$qual .= "$rfield = '$Vend::Session->{$rsession}'";
-#::logDebug("restricted qual=$qual");
 		}
 		my $query = $db->prepare("select * from $table " . ($qual || '') )
             or die $DBI::errstr;
@@ -1474,18 +1488,17 @@
 		$each = sub {
 			my $ref = $query->fetchrow_arrayref()
 				or return undef;
-#::logDebug("query returned: " . ::uneval($ref));
-			return ($ref);
+			return $ref;
 		};
         push @$s, $each;
     }
-	my ($return) = $s->[$EACH]->();
+	my $return = $s->[$EACH]->();
 	if(! defined $return->[0]) {
 		pop @$s;
 		delete $s->[$CONFIG]{Export_order};
 		return ();
 	}
-    return (@$return);
+    return $return;
 }
 
 sub sprintf_substitute {



2.1       +3 -3      interchange/lib/Vend/Table/InMemory.pm


rev 2.1, prev_rev 2.0
Index: InMemory.pm
===================================================================
RCS file: /anon_cvs/repository/interchange/lib/Vend/Table/InMemory.pm,v
retrieving revision 2.0
retrieving revision 2.1
diff -u -r2.0 -r2.1
--- InMemory.pm	2001/07/18 02:23:20	2.0
+++ InMemory.pm	2001/11/26 18:34:02	2.1
@@ -1,6 +1,6 @@
 # Vend::Table::InMemory - Store an Interchange table in memory
 #
-# $Id: InMemory.pm,v 2.0 2001/07/18 02:23:20 jon Exp $
+# $Id: InMemory.pm,v 2.1 2001/11/26 18:34:02 mheins Exp $
 #
 # Copyright (C) 1996-2001 Red Hat, Inc. <interchange@redhat.com>
 #
@@ -25,7 +25,7 @@
 package Vend::Table::InMemory;
 use Vend::Table::Common;
 @ISA = qw/Vend::Table::Common/;
-$VERSION = substr(q$Revision: 2.0 $, 10);
+$VERSION = substr(q$Revision: 2.1 $, 10);
 use strict;
 
 # 0: column names
@@ -171,7 +171,7 @@
 	for (;;) {
 		$key = each %{$s->[$TIE_HASH]};
 		return () unless defined $key;
-		return ($s->row($key));
+		return [ $s->row($key) ];
 	}
 }
 



2.1       +3 -3      interchange/lib/Vend/Table/LDAP.pm


rev 2.1, prev_rev 2.0
Index: LDAP.pm
===================================================================
RCS file: /anon_cvs/repository/interchange/lib/Vend/Table/LDAP.pm,v
retrieving revision 2.0
retrieving revision 2.1
diff -u -r2.0 -r2.1
--- LDAP.pm	2001/07/18 02:23:20	2.0
+++ LDAP.pm	2001/11/26 18:34:02	2.1
@@ -1,6 +1,6 @@
 # Vend::Table::LDAP - Interchange LDAP pseudo-table access
 #
-# $Id: LDAP.pm,v 2.0 2001/07/18 02:23:20 jon Exp $
+# $Id: LDAP.pm,v 2.1 2001/11/26 18:34:02 mheins Exp $
 #
 # Copyright (C) 1996-2001 Red Hat, Inc. <interchange@redhat.com>
 #
@@ -24,7 +24,7 @@
 
 package Vend::Table::LDAP;
 @ISA = qw/Vend::Table::Common/;
-$VERSION = substr(q$Revision: 2.0 $, 10);
+$VERSION = substr(q$Revision: 2.1 $, 10);
 use strict;
 
 use vars qw(
@@ -422,7 +422,7 @@
 sub each_nokey {
 	my (@ary) = each_record(@_);
 	shift @ary;
-	return @ary;
+	return \@ary;
 }
 
 sub record_exists {