文件首頁
X DevAPI 使用者指南
下載本手冊
PDF (美式信紙) - 1.4Mb
PDF (A4) - 1.4Mb


X DevAPI 使用者指南  /  使用結果集  /  結果集類別

9.1 結果集類別

所有資料庫操作都會傳回結果。傳回的結果類型取決於執行的操作。下表概述了不同的結果類型。

表 9.1 結果類別及其提供的資訊

結果類別

傳回自

提供

Result

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

受操作影響的資料列數、自動產生的文件 ID、最後自動產生的 AUTO INCREMENT 資料行值,或警告,具體取決於傳回 Result 的操作。

SqlResult

session.sql().execute()

受操作影響的資料列數、自動產生的文件 ID、最後自動產生的 AUTO INCREMENT 資料行值、警告或擷取的資料集,具體取決於傳回 SqlResult 的操作。

DocResult

find().execute()

擷取的資料集

RowResult

select.execute()

擷取的資料集


以下類別圖提供結果類別及其函式的基本概觀。

圖 9.1 結果類別

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.