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

Integer getAffectedItemCount ()
 The the number of affected items for the last operation. More...
 
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...
 
Integer getWarningCount ()
 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 affectedItemCount
 Same as getAffectedItemCount() More...
 
Integer autoIncrementValue
 Same as getAutoIncrementValue()
 
List generatedIds
 Same as getGeneratedIds()
 
- Properties inherited from BaseResult
Integer affectedItemsCount
 Same as getAffectedItemsCount()
 
Integer warningCount
 Same as getWarningCount() More...
 
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

◆ getAffectedItemCount()

Integer getAffectedItemCount ( )

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 getAffectedItemsCount 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

◆ 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/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.

◆ 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.

Member Data Documentation

◆ affectedItemCount

Integer affectedItemCount

Same as getAffectedItemCount()

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