The diagnostics area
The diagnostics area consists of two subareas: the statement information and the condition information.
The statement information contains two values:
NUMBER
: This is the number of conditions stored in the condition area.ROW_COUNT
: This is the number of rows modified by the statement it refers to. The same value is returned by theROW_COUNT()
SQL function and by themysql_affected_rows()
API function.
The diagnostics area is populated and emptied by following the exact rules. Knowing these rules is very important to debug single statements without falling for some common pitfalls, and it is more important to debug the stored programs.
Whenever a statement generates at least one condition (notes, warnings, or errors), the diagnostics area is populated with such conditions. Any condition present previously in the diagnostics area is deleted. However, there is an exception. If the new statement is RESIGNAL
or GET DIAGNOSTICS
, the old conditions are not deleted. This is to...