logo       
Google Custom Search
    AddThis Social Bookmark Button
-->

Re: [BioSQL-l] Bug in loading duplicate but non-identical swissprot refere: msg#00179

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

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
-------------------------------------------------------------


<Prev in Thread] Current Thread [Next in Thread>