Is there a way to tell MySQL to temporarily supress/ignore reporting specific error conditions?
---------------------------------------------
I am connecting to a MySQL 5.0 database via C#. Due to the nature of the program, the C# code will end up sending requests to insert duplicate data in the database, which raises MySQL error #1062, which in turn causes an OdbcException in C#.
To combat this, I use stored procedures that trap the error via a custom handler:
Code:
DECLARE EXIT HANDLER FOR 1062
BEGIN
SELECT 'Attempted to insert duplicate data information';
END;
This tells C# that "-1 rows were affected" instead of causing an error. However, doing things in this way will only allow me to do one INSERT reliably per procedure (if the first INSERT fails, the procedure jumps to the handler, avoids the second INSERT, etc). So any solutions?