MySQL Shell API 9.1.0
Unified development interface for MySQL Products
Methods | Properties | List of all members
Result Class Reference

Allows retrieving information about non query operations performed on the database. More...

Methods

Integer getAutoIncrementValue ()
 The last insert id auto generated (from an insert operation) More...
 
List getGeneratedIds ()
 Returns the list of document ids generated on the server. More...
 
- Methods inherited from BaseResult
Integer getAffectedItemsCount ()
 The the number of affected items for the last operation. More...
 
Integer getWarningsCount ()
 The number of warnings produced by the last statement execution. More...
 
List getWarnings ()
 Retrieves the warnings generated by the executed operation. More...
 
String getExecutionTime ()
 Retrieves a string value indicating the execution time of the executed operation.
 

Properties

Integer autoIncrementValue
 Same as getAutoIncrementValue()
 
List generatedIds
 Same as getGeneratedIds()
 
- Properties inherited from BaseResult
Integer affectedItemsCount
 Same as getAffectedItemsCount()
 
Integer warningsCount
 Same as getWarningsCount()
 
List warnings
 Same as getWarnings()
 
String executionTime
 Same as getExecutionTime()
 

Detailed Description

Allows retrieving information about non query operations performed on the database.

An instance of this class will be returned on the CRUD operations that change the content of the database:

Other functions on the Session class also return an instance of this class:

Member Function Documentation

◆ getAutoIncrementValue()

Integer getAutoIncrementValue ( )

The last insert id auto generated (from an insert operation)

Returns
the integer representing the last insert id

For more details, see https://dev.mysql.com/doc/c-api/en/mysql-insert-id.html

Note that this value will be available only when the result is for a Table.insert operation.

◆ getGeneratedIds()

List getGeneratedIds ( )

Returns the list of document ids generated on the server.

Returns
a list of strings containing the generated ids.

When adding documents into a collection, it is required that an ID is associated to the document, if a document is added without an '_id' field, an error will be generated.

At MySQL 8.0.11 if the documents being added do not have an '_id' field, the server will automatically generate an ID and assign it to the document.

This function returns a list of the IDs that were generated for the server to satisfy this requirement.