MySQL Shell API 8.4.3
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

int get_auto_increment_value ()
 The last insert id auto generated (from an insert operation) More...
 
list get_generated_ids ()
 Returns the list of document ids generated on the server. More...
 
- Methods inherited from BaseResult
int get_affected_items_count ()
 The the number of affected items for the last operation. More...
 
int get_warnings_count ()
 The number of warnings produced by the last statement execution. More...
 
list get_warnings ()
 Retrieves the warnings generated by the executed operation. More...
 
str get_execution_time ()
 Retrieves a string value indicating the execution time of the executed operation.
 

Properties

int auto_increment_value
 Same as get_auto_increment_value()
 
list generated_ids
 Same as get_generated_ids()
 
- Properties inherited from BaseResult
int affected_items_count
 Same as get_affected_items_count()
 
int warnings_count
 Same as get_warnings_count()
 
list warnings
 Same as get_warnings()
 
str execution_time
 Same as get_execution_time()
 

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

◆ get_auto_increment_value()

int get_auto_increment_value ( )

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.

◆ get_generated_ids()

list get_generated_ids ( )

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.