[interchange-cvs] interchange - heins modified lib/Vend/Table/DBI.pm

interchange-core@icdevgroup.org interchange-core@icdevgroup.org
Fri Feb 7 11:47:00 2003


User:      heins
Date:      2003-02-07 16:46:15 GMT
Modified:  lib/Vend/Table DBI.pm
Log:
* Add no_requery option to ensure no SQL::Statement will be called. Use
  when you are sure your table is in the database referenced....avoids
  errors on multiple key inserts that might return undef.

Revision  Changes    Path
2.42      +6 -2      interchange/lib/Vend/Table/DBI.pm


rev 2.42, prev_rev 2.41
Index: DBI.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Table/DBI.pm,v
retrieving revision 2.41
retrieving revision 2.42
diff -u -r2.41 -r2.42
--- DBI.pm	30 Jan 2003 22:21:04 -0000	2.41
+++ DBI.pm	7 Feb 2003 16:46:14 -0000	2.42
@@ -1,6 +1,6 @@
 # Vend::Table::DBI - Access a table stored in an DBI/DBD database
 #
-# $Id: DBI.pm,v 2.41 2003/01/30 22:21:04 kwalsh Exp $
+# $Id: DBI.pm,v 2.42 2003/02/07 16:46:14 mheins Exp $
 #
 # Copyright (C) 1996-2002 Red Hat, Inc. <interchange@redhat.com>
 #
@@ -20,7 +20,7 @@
 # MA  02111-1307  USA.
 
 package Vend::Table::DBI;
-$VERSION = substr(q$Revision: 2.41 $, 10);
+$VERSION = substr(q$Revision: 2.42 $, 10);
 
 use strict;
 
@@ -1879,6 +1879,10 @@
 	if($@) {
 		if(! $sth or ! defined $rc) {
 			# query failed, probably because no table
+
+			# Allow failed query by design, maybe to use multiple key inserts
+			return undef if $opt->{no_requery};
+
 			# Do nothing but log to debug and fall through to MVSEARCH
 			eval {
 				($spec, $stmt) = Vend::Scan::sql_statement($query, $ref);