samedi 30 janvier 2016

how to set SQLSTATE in mysql to remove a previously set error?

I have a procedure that may encounter some undesiable condition and then do:

    SIGNAL SQLSTATE 
        'ERROR'
    SET
        MESSAGE_TEXT = "Unauthorized action: set permissions",
        MYSQL_ERRNO = 2;

I'm testing this procedure with another sql script, as long as Im calling it in acceptable conditions it works and the tests run to the end, but if I want to test it under conditions where it should set the error state, the test script stops running. So How can I:

A) check that the current sql state is 'ERROR'?

and:

B) can I the reset it back to ok or success so that my test script doesn't stop at the first error and will continue testing other conditions?

Aucun commentaire:

Enregistrer un commentaire