Documentation Home
X DevAPI User Guide for MySQL Shell in Python Mode
Download this Manual
PDF (US Ltr) - 1.2Mb
PDF (A4) - 1.2Mb


9.1 Result Set Classes

All database operations return a result. The type of result returned depends on the operation that was executed. The different types of results are outlined in the following table.

Table 9.1 The Result Classes and the Information They Provide

Result Class

Returned By

Provides

Result

add().execute(), insert().execute(), modify().execute(), update().execute() , remove().execute(), delete().execute()

Number of rows affected by the operation, auto generated document IDs, last auto- generated AUTO INCREMENT column values, or warnings, depending on the operation for which Result is returned.

SqlResult

session.sql().execute()

Number of rows affected by the operation, auto generated document IDs, last auto- generated AUTO INCREMENT column values, warnings, or fetched data set, depending on the operation for which SqlResult is returned.

DocResult

find().execute()

The fetched data set

RowResult

select.execute()

The fetched data set


The following class diagram gives a basic overview of the result classes and their functions.

Figure 9.1 Result Classes

In the following functions, square brackets indicate a list of items. This can be any appropriate list type in the target language (an array, a collection, and so on). The BaseResults class contains the following functions: getWarnings(): Warning[] and getWarningsCount(): int, which are diagnostics functions. The Result class contains the following functions: getAffectedItemsCount(): int, getAutoIncrementValue(): int, getGeneratedIds(): String[], which are data change information functions. The DocResult class contains the following functions: fetchAll(): Document[] and fetchOne(): Document, which are document access functions. The RowResult class contains the following functions: fetchAll(): Row[], fetchOne(): Row, getColumns(): Column[], and nextResult(): boolean. The SqlResult class contains the following functions: hasData(): boolean, getAffectedItemsCount(): int, and getAutoIncrementValue(): int.