Skip to content

Commit

Permalink
docs(db): report details on error cases for executeAll/Async
Browse files Browse the repository at this point in the history
  • Loading branch information
sgtcoolguy committed Jul 11, 2019
1 parent 75d7de1 commit e86f4df
Showing 1 changed file with 37 additions and 4 deletions.
41 changes: 37 additions & 4 deletions apidoc/Titanium/Database/DB.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ methods:
- name: executeAsync
summary: |
Asynchronously executes an SQL statement against the database and fires a callback with a `ResultSet`.
Asynchronously executes an SQL statement against the database and fires a callback with a possible `Error` argument, and a second argument holding a possible `ResultSet`.
platforms: [android]
parameters:
- name: query
Expand All @@ -83,7 +83,8 @@ methods:

- name: executeAll
summary: |
Synchronously executes an array of SQL statements against the database and fires a callback with an array of `ResultSet`.
Synchronously executes an array of SQL statements against the database and returns an array of `ResultSet`.
On failure, this will throw an [Error](BatchQueryError) that reports the failed index and partial results
returns:
type: Array<Titanium.Database.ResultSet>
platforms: [android]
Expand All @@ -95,7 +96,8 @@ methods:

- name: executeAllAsync
summary: |
Asynchronously executes an array of SQL statements against the database and fires a callback with an array of `ResultSet`.
Asynchronously executes an array of SQL statements against the database and fires a callback with a possible Error, and an array of `ResultSet`.
On failure, this will call the callback with an [Error](PossibleBatchQueryError) that reports the failed index, and a second arguemnt with the partial results
platforms: [android]
parameters:
- name: queries
Expand All @@ -104,7 +106,7 @@ methods:

- name: callback
summary: Callback when query execution has completed.
type: Callback<Object, Array<Titanium.Database.ResultSet>>
type: Callback<PossibleBatchQueryError, Array<Titanium.Database.ResultSet>>
since: { android: "8.1.0", iphone: "8.1.0", ipad: "8.1.0" }

- name: remove
Expand Down Expand Up @@ -139,3 +141,34 @@ properties:
summary: The number of rows affected by the last query.
type: Number
permission: read-only

---
name: BatchQueryError
summary: |
Simple `Error` instance thrown from the
[executeAll](Titanium.Database.DB.executeAll) method in case of failure
since: { android: "8.1.0", iphone: "8.1.0", ipad: "8.1.0" }
properties:

- name: index
summary: Index of the failed query
type: Number
since: { android: "8.1.0", iphone: "8.1.0", ipad: "8.1.0" }

- name: results
summary: partial `ResultSet`s of any successful queries before the failure
type: Array<Titanium.Database.ResultSet>
since: { android: "8.1.0", iphone: "8.1.0", ipad: "8.1.0" }

---
name: PossibleBatchQueryError
summary: |
Simple `Error` argument provided to the callback from the
[executeAllAsync](Titanium.Database.DB.executeAllAsync) method in case of failure
since: { android: "8.1.0", iphone: "8.1.0", ipad: "8.1.0" }
properties:

- name: index
summary: Index of the failed query
type: Number
since: { android: "8.1.0", iphone: "8.1.0", ipad: "8.1.0" }

0 comments on commit e86f4df

Please sign in to comment.