In an application I’m building I use a lot of insert on duplicate key updates. My issue is that in my application I kind of need to know whether or not it was an insert or an update so my code can make the appropriate decisions. Does anyone know how I can test for this?
I’m using perl’s DBI module if anyone knows a way specific to that. Thanks!
Per the documentation:
So, you should be able to check the return-value of the
INSERT .. ON DUPLICATE KEYqueries; if it’s 1, the row was inserted, if it is 2, it was updated.