WL#2111: Stored Procedures: Implement GET DIAGNOSTICS

Affects: Server-5.6   —   Status: Complete

MySQL will implement the standard SQL:2008 GET DIAGNOSTICS 
statement, which is used to get error information from a 
diagnostics area after the execution of an SQL statement

GET DIAGNOSTICS provides a mechanism for 
(a) an application to ask questions such as "Did anything 
go wrong when the last SQL statement was executed and, if 
so, what went wrong?" and 
(b) to get a reply from the server in a standardized way. 
That is, GET DIAGNOSTICS is used to obtain information about 
the previously executed SQL statement.

This is a subtask needed for stored procedures, although
GET DIAGNOSTICS is not used solely with stored procedures;
the statement can be used to check the result after
execution of any SQL statement. It was decided at the Malta 
conference that this feature does not need to be implemented 
for the MySQL 5.0 release. It was off the roadmap for several
years but it is now back on.

-- Needed functionality:
Standard SQL (SQL:2008 Core) requires that a GET DIAGNOSTICS 
statement be supported, to provide an application a method of 
getting specific diagnostics information (i.e. information on 
error and completion conditions) about the execution 
of an SQL statement. MySQL 5.1 currently does not support this 
functionality, although SHOW ERRORS and SHOW WARNINGS give
some very basic diagnostics information.

-- Compatibility:
IBM DB2 supports GET DIAGNOSTICS in a mostly standard SQL-compliant
manner, with some extensions and exceptions.
Oracle does not support GET DIAGNOSTICS.
SQL Server does not support GET DIAGNOSTICS, but includes both 
keywords in a list of future keywords, with the explanation that 
the words may be reserved in a future release. The implication
is that Microsoft is planning to add support for GET DIAGNOSTICS
someday.