[interchange-cvs] interchange - jon modified lib/Vend/Data.pm
interchange-core@icdevgroup.org
interchange-core@icdevgroup.org
Sat Jul 13 23:22:00 2002
User: jon
Date: 2002-07-14 03:21:06 GMT
Modified: lib/Vend Data.pm
Log:
Add two new utility functions useful with multiple ProductFiles:
product_row and product_row_hash do the same thing as product_field
except they return the entire row found.
(If I missed some other function that does the same thing, let me know.)
Revision Changes Path
2.12 +15 -1 interchange/lib/Vend/Data.pm
rev 2.12, prev_rev 2.11
Index: Data.pm
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /var/cvs/interchange/lib/Vend/Data.pm,v
retrieving revision 2.11
retrieving revision 2.12
diff -u -u -r2.11 -r2.12
--- Data.pm 8 Jul 2002 15:32:06 -0000 2.11
+++ Data.pm 14 Jul 2002 03:21:05 -0000 2.12
@@ -1,6 +1,6 @@
# Vend::Data - Interchange databases
#
-# $Id: Data.pm,v 2.11 2002/07/08 15:32:06 mheins Exp $
+# $Id: Data.pm,v 2.12 2002/07/14 03:21:05 jon Exp $
#=20
# Copyright (C) 1996-2002 Red Hat, Inc. <interchange@redhat.com>
#
@@ -52,6 +52,8 @@
product_common
product_field
product_price
+product_row
+product_row_hash
set_field
=20
);
@@ -300,6 +302,18 @@
$value =3D $db->field($key, $field_name) . $value;
}
return $db->set_field($key, $field_name, $value);
+}
+
+sub product_row {
+ my ($code) =3D @_;
+ my $db =3D product_code_exists_ref($code) or return;
+ return $db->row($code);
+}
+
+sub product_row_hash {
+ my ($code) =3D @_;
+ my $db =3D product_code_exists_ref($code) or return;
+ return $db->row_hash($code);
}
=20
sub product_field {