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 |
|---|---|---|
|
|
Number of rows affected by the operation, auto generated
document IDs, last auto- generated |
|
|
Number of rows affected by the operation, auto generated
document IDs, last auto- generated |
|
|
The fetched data set |
|
|
The fetched data set |
The following class diagram gives a basic overview of the result classes and their functions.
![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.](images/resultset-class-dig.png)