|Don't ask to ask, just ask|
Of Mysql, DBI and PK best practicesby jimbus (Friar)
|on Apr 17, 2007 at 13:32 UTC||Need Help??|
jimbus has asked for the
wisdom of the Perl Monks concerning the following question:
I've been using a method suggested in the here early in my tenure at the forum, but recently I've been told it's bad, but I haven't been able to get a straight answer on what the "correct" way is...
Basically, I want to insert a record unless it violates the primary key. If it violates the PK, I want to update the row with the new information. To do this, I've been using something like:
I understand that the eval traps any error, PK or otherwise and tries the update... I've even struggled with debugging malformed mysql statements until I remembered this, but I don't have a better way to do it.
This is all about processing log files, and I doubt I'm the only person in the world that has data for a primary key's record potentially coming more than one "processing session". Can someone help me with a best practice for this?
--Jimbus aka Jim Babcock
Wireless Data Engineer and Geek Wannabe