[Bioperl-l] Re: [BioSQL-l] Bug in loading duplicate but non-identical swissprot references

Hilmar Lapp hlapp at gnf.org
Mon Apr 21 01:51:04 EDT 2003


On Monday, April 21, 2003, at 12:35  AM, Hilmar Lapp wrote:

> 	# store() is equivalent to an UPDATE. If called on an object with
> 	# undefined primary_key it is equivalent to calling create() - and
> 	# then does NOT update.
> 	$pobj->store();
>

Actually thinking about this, this could be changed such that calling 
store() on an object with undefined primary key is equivalent to an 
INSERT followed by an UPDATE. This would be an easy change. (Even 
though it would have knock-on effects all over the place, because I 
initially didn't bother calling create() and just called store(), 
knowing it would create() in the absence of a primary key. These 
instances could be weeded out though, and maybe should be weeded out at 
some point anyway to keep it clear what's happening.)

If people want to be strict, we could also throw an exception if 
store() is called without a primary key present.

(INSERT followed by UPDATE may sound inefficient, but in order to make 
it one db operation you'd need to introduce something like 
update_by_unique_key(). Doable, but needs to be written.)

	-hilmar
-- 
-------------------------------------------------------------
Hilmar Lapp                            email: lapp at gnf.org
GNF, San Diego, Ca. 92121              phone: +1-858-812-1757
-------------------------------------------------------------



More information about the Bioperl-l mailing list