I have table SomeTable with 3 columns A, B, C and a unique on A and B
From client side I am passing some values to insert or update C if A,B already exist. I want to know if the server has done update or insert for each value and if it is an update I want the old value of C....
I am currently doing this with
While values to insert {
   Insert A,B,C
   if success memorizing the value continue the while
   else if the sql error is "duplicate key" {
       select old value of C for A,B
       update C for A,B...
   }    
}
Which means 3 calls to MySQL....
Is there a way to do this with a trigger, a procedure or a "magic" query ?
 
    