# Cloud Spanner V1 Client - Class ExecuteBatchDmlResponse (2.9.0)

2.9.0 (latest) 2.8.1 2.7.0 2.6.1 2.5.1 2.4.1 2.3.0 2.2.0 2.1.0 2.0.1-RC1 1.106.0 1.105.1 1.104.1 1.103.0 1.102.0 1.101.0 1.100.0 1.98.0 1.97.0 1.96.0 1.95.0 1.94.0 1.93.1 1.92.1 1.91.0 1.90.0 1.89.0 1.88.0 1.87.0 1.86.0 1.85.0 1.84.0 1.83.0 1.82.0 1.81.0 1.80.0 1.79.0 1.78.0 1.77.0 1.76.1 1.68.0 1.67.0 1.66.0 1.65.0 1.64.0 1.63.2 1.62.1 1.61.0 1.60.0 1.59.0 1.58.4 1.57.0 1.56.0 1.55.0 1.54.2 Reference documentation and code samples for the Cloud Spanner V1 Client class ExecuteBatchDmlResponse.

The response for
[ExecuteBatchDml](https://docs.cloud.google.com/php/docs/reference/cloud-spanner/latest/V1.Client.SpannerClient#_Google_Cloud_Spanner_V1_Client_SpannerClient__executeBatchDml__). Contains a list
of [ResultSet](https://docs.cloud.google.com/php/docs/reference/cloud-spanner/latest/V1.ResultSet) messages, one for each DML
statement that has successfully executed, in the same order as the statements
in the request. If a statement fails, the status in the response body
identifies the cause of the failure.

To check for DML statements that failed, use the following approach:

1. Check the status in the response message. The [google.rpc.Code](https://docs.cloud.google.com/php/docs/reference/common-protos/latest/Rpc.Code.html) enum value `OK` indicates that all statements were executed successfully.
2. If the status was not `OK`, check the number of result sets in the response. If the response contains `N` [ResultSet](https://docs.cloud.google.com/php/docs/reference/cloud-spanner/latest/V1.ResultSet) messages, then statement `N+1` in the request failed. Example 1:
3. Request: 5 DML statements, all executed successfully.
4. Response: 5 [ResultSet](https://docs.cloud.google.com/php/docs/reference/cloud-spanner/latest/V1.ResultSet) messages, with the status `OK`. Example 2:
5. Request: 5 DML statements. The third statement has a syntax error.
6. Response: 2 [ResultSet](https://docs.cloud.google.com/php/docs/reference/cloud-spanner/latest/V1.ResultSet) messages, and a syntax error (`INVALID_ARGUMENT`) status. The number of [ResultSet](https://docs.cloud.google.com/php/docs/reference/cloud-spanner/latest/V1.ResultSet) messages indicates that the third statement failed, and the fourth and fifth statements were not executed.

Generated from protobuf message `google.spanner.v1.ExecuteBatchDmlResponse`

## Namespace

Google \\ Cloud \\ Spanner \\ V1

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ result_sets` | `array<https://docs.cloud.google.com/php/docs/reference/cloud-spanner/latest/V1.ResultSet>` One [ResultSet](https://docs.cloud.google.com/php/docs/reference/cloud-spanner/latest/V1.ResultSet) for each statement in the request that ran successfully, in the same order as the statements in the request. Each [ResultSet](https://docs.cloud.google.com/php/docs/reference/cloud-spanner/latest/V1.ResultSet) does not contain any rows. The [ResultSetStats](https://docs.cloud.google.com/php/docs/reference/cloud-spanner/latest/V1.ResultSetStats) in each [ResultSet](https://docs.cloud.google.com/php/docs/reference/cloud-spanner/latest/V1.ResultSet) contain the number of rows modified by the statement. Only the first [ResultSet](https://docs.cloud.google.com/php/docs/reference/cloud-spanner/latest/V1.ResultSet) in the response contains valid [ResultSetMetadata](https://docs.cloud.google.com/php/docs/reference/cloud-spanner/latest/V1.ResultSetMetadata). |
| `↳ status` | `https://docs.cloud.google.com/php/docs/reference/common-protos/latest/Rpc.Status.html` If all DML statements are executed successfully, the status is `OK`. Otherwise, the error status of the first failed statement. |
| `↳ precommit_token` | `https://docs.cloud.google.com/php/docs/reference/cloud-spanner/latest/V1.MultiplexedSessionPrecommitToken` Optional. A precommit token is included if the read-write transaction is on a multiplexed session. Pass the precommit token with the highest sequence number from this transaction attempt should be passed to the [Commit](https://docs.cloud.google.com/php/docs/reference/cloud-spanner/latest/V1.Client.SpannerClient#_Google_Cloud_Spanner_V1_Client_SpannerClient__commit__) request for this transaction. |

### getResultSets

One [ResultSet](https://docs.cloud.google.com/php/docs/reference/cloud-spanner/latest/V1.ResultSet) for each statement in the
request that ran successfully, in the same order as the statements in the
request. Each [ResultSet](https://docs.cloud.google.com/php/docs/reference/cloud-spanner/latest/V1.ResultSet) does not contain any
rows. The [ResultSetStats](https://docs.cloud.google.com/php/docs/reference/cloud-spanner/latest/V1.ResultSetStats) in each
[ResultSet](https://docs.cloud.google.com/php/docs/reference/cloud-spanner/latest/V1.ResultSet) contain the number of rows
modified by the statement.

Only the first [ResultSet](https://docs.cloud.google.com/php/docs/reference/cloud-spanner/latest/V1.ResultSet) in the response
contains valid [ResultSetMetadata](https://docs.cloud.google.com/php/docs/reference/cloud-spanner/latest/V1.ResultSetMetadata).

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/RepeatedField<https://docs.cloud.google.com/php/docs/reference/cloud-spanner/latest/V1.ResultSet>` |   |

### setResultSets

One [ResultSet](https://docs.cloud.google.com/php/docs/reference/cloud-spanner/latest/V1.ResultSet) for each statement in the
request that ran successfully, in the same order as the statements in the
request. Each [ResultSet](https://docs.cloud.google.com/php/docs/reference/cloud-spanner/latest/V1.ResultSet) does not contain any
rows. The [ResultSetStats](https://docs.cloud.google.com/php/docs/reference/cloud-spanner/latest/V1.ResultSetStats) in each
[ResultSet](https://docs.cloud.google.com/php/docs/reference/cloud-spanner/latest/V1.ResultSet) contain the number of rows
modified by the statement.

Only the first [ResultSet](https://docs.cloud.google.com/php/docs/reference/cloud-spanner/latest/V1.ResultSet) in the response
contains valid [ResultSetMetadata](https://docs.cloud.google.com/php/docs/reference/cloud-spanner/latest/V1.ResultSetMetadata).

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `array<https://docs.cloud.google.com/php/docs/reference/cloud-spanner/latest/V1.ResultSet>` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getStatus

If all DML statements are executed successfully, the status is `OK`.

Otherwise, the error status of the first failed statement.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/common-protos/latest/Rpc.Status.html|null` |   |

### hasStatus

### clearStatus

### setStatus

If all DML statements are executed successfully, the status is `OK`.

Otherwise, the error status of the first failed statement.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/common-protos/latest/Rpc.Status.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getPrecommitToken

Optional. A precommit token is included if the read-write transaction
is on a multiplexed session. Pass the precommit token with the highest
sequence number from this transaction attempt should be passed to the
[Commit](https://docs.cloud.google.com/php/docs/reference/cloud-spanner/latest/V1.Client.SpannerClient#_Google_Cloud_Spanner_V1_Client_SpannerClient__commit__) request for this transaction.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-spanner/latest/V1.MultiplexedSessionPrecommitToken|null` |   |

### hasPrecommitToken

### clearPrecommitToken

### setPrecommitToken

Optional. A precommit token is included if the read-write transaction
is on a multiplexed session. Pass the precommit token with the highest
sequence number from this transaction attempt should be passed to the
[Commit](https://docs.cloud.google.com/php/docs/reference/cloud-spanner/latest/V1.Client.SpannerClient#_Google_Cloud_Spanner_V1_Client_SpannerClient__commit__) request for this transaction.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-spanner/latest/V1.MultiplexedSessionPrecommitToken` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |