MySQL Shell 9.3
The SQL handler function can return a result object. To define a
custom result, use shell.create_result(data)
.
The data
can be either a dictionary, for a
single result, or a list of dictionaries, for multiple results.
The data dictionary for a single result must be a dictionary and include the following:
affectedItemsCount
: (integer) the number
of items affected by the processed SQL.
info
: (string) define additional
information about the result.
executionTime
: (double) time, in seconds,
taken to process the SQL.
autoIncrementValue
: (integer) the last
auto-generated insert ID.
warnings
: list of documents describing
warnings generated by the processed SQL.
columns
: optional list describing the
column metadata of the result.
data
: optional parameter defining the
data contained in the result. See
Section 11.4.3, “Result Data Specification”.
To support multiple results, define a list of dictionaries in
the data
parameter. See
Single Result
for information on permitted dictionary elements.
You can also add an error definition dictionary to this list, to indicate errors which occurred during SQL processing. The error dictionary must have the following attributes:
error
: (string) description of the error.
code
: (integer) code associated with the
error.