MySQL Shell API 8.0.40
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_affected_item_count ()
 The the number of affected items for the last operation. More...
 
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...
 
int get_warning_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 affected_item_count
 Same as get_affected_itemCount() More...
 
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 warning_count
 Same as get_warning_count() More...
 
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_affected_item_count()

int get_affected_item_count ( )

The the number of affected items for the last operation.

Returns
the number of affected items.
Attention
This function will be removed in a future release, use the get_affected_items_count function instead.

This is the value of the C API mysql_affected_rows(), see https://dev.mysql.com/doc/refman/en/mysql-affected-rows.html

◆ 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/refman/en/information-functions.html#function_last-insert-id

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.

Member Data Documentation

◆ affected_item_count

int affected_item_count

Same as get_affected_itemCount()

Attention
This property will be removed in a future release, use the affected_items_count property instead.