From: David A. <david@st...> - 2004-04-13 14:46:24
I'm trying to avoid try and catch blocks I usually use when inserting a
row with existing pk and running an update instead. Unfortunatelly I'm
forced to substitute the primary key with md5_hex of other fields, when it
is not available. Does anyone knwo how could I use a pre_insert hook to
break an insert and do an update on an existing record?
The way it is now is I create a potential row with known values and make
it live. In pre_insert hook, I figure out what my primary key is, then i
want to do a row_by_pk to see if there is a row already in the database,
and if there is one already, I want to do an update on that row and return
a ref to it instead of a potential row.