Diagnostics Area Information Items
The diagnostics area contains statement and condition information items. Numeric items are integers. The character set for character items is UTF-8. No item can be NULL
. If a statement or condition item is not set by a statement that populates the diagnostics area, its value will be 0 or the empty string, depending on the item data type.
The statement information part of the diagnostics area contains these items:
NUMBER
: An integer indicating the number of condition areas that have information.ROW_COUNT
: An integer indicating the number of rows affected by the statement.ROW_COUNT
has the same value as theROW_COUNT()
function (see , "Information Functions").
The condition information part of the diagnostics area contains a condition area for each condition. Condition areas are numbered from 1 to the value of the NUMBER
statement condition item. If NUMBER
is 0, there are no condition areas.
Each condition area contains the items in the following list. All items are standard SQL except MYSQL_ERRNO
, which is a MariaDB extension. The definitions apply for conditions generated other than by a signal (that is, by a SIGNAL
or RESIGNAL
statement). For nonsignal conditions, MariaDB populates only those condition items not described as always empty. The effects of signals on the condition area are described later.
CLASS_ORIGIN
: A string containing the class of theRETURNED_SQLSTATE
value. If theRETURNED_SQLSTATE
value begins with a class value defined in SQL standards document ISO 9075-2 (section 24.1, SQLSTATE),CLASS_ORIGIN
is'ISO 9075'
. Otherwise,CLASS_ORIGIN
is'MySQL'
.SUBCLASS_ORIGIN
: A string containing the subclass of theRETURNED_SQLSTATE
value. IfCLASS_ORIGIN
is'ISO 9075'
orRETURNED_SQLSTATE
ends with'000'
,SUBCLASS_ORIGIN
is'ISO 9075'
. Otherwise,SUBCLASS_ORIGIN
is'MySQL'
.RETURNED_SQLSTATE
: A string that indicates theSQLSTATE
value for the condition.MESSAGE_TEXT
: A string that indicates the error message for the condition.MYSQL_ERRNO
: An integer that indicates the MariaDB error code for the condition.CONSTRAINT_CATALOG
,CONSTRAINT_SCHEMA
,CONSTRAINT_NAME
: Strings that indicate the catalog, schema, and name for a violated constraint. They are always empty.CATALOG_NAME
,SCHEMA_NAME
,TABLE_NAME
,COLUMN_NAME
: Strings that indicate the catalog, schema, table, and column related to the condition. They are always empty.CURSOR_NAME
: A string that indicates the cursor name. This is always empty.
For the RETURNED_SQLSTATE
, MESSAGE_TEXT
, and MYSQL_ERRNO
values for particular errors, see "Server Error Codes and Messages".
If a SIGNAL
(or RESIGNAL
) statement populates the diagnostics area, its SET
clause can assign to any condition information item except RETURNED_SQLSTATE
any value that is legal for the item data type. SIGNAL
also sets the RETURNED_SQLSTATE
value, but not directly in its SET
clause. That value comes from the SIGNAL
statement SQLSTATE
argument.
SIGNAL
also sets statement information items. It sets NUMBER
to 1, and ROW_COUNT
to -1 for errors and 0 otherwise.