Handling unsuccessful statements
The mi_get_result() function returns a status of MI_ERROR to indicate that the current statement did not execute successfully. When mi_get_result() returns this status, you can use the mi_db_error_raise() function to raise a database server exception. If you have registered a callback on the MI_Exception event type, you can obtain an SQL status variable (SQLCODE or SQLSTATE) from the error descriptor that the database server passes to the callback. This SQL status variable can help determine the cause of the failure.