Cloud Spanner V1 Client - Class ExecuteBatchDmlResponse (1.88.0)

Reference documentation and code samples for the Cloud Spanner V1 Client class ExecuteBatchDmlResponse.

The response for ExecuteBatchDml. Contains a list of 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 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 messages, then statement N+1 in the request failed. Example 1:
  3. Request: 5 DML statements, all executed successfully.
  4. Response: 5 ResultSet messages, with the status OK. Example 2:
  5. Request: 5 DML statements. The third statement has a syntax error.
  6. Response: 2 ResultSet messages, and a syntax error (INVALID_ARGUMENT) status. The number of 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<Google\Cloud\Spanner\V1\ResultSet>

One ResultSet for each statement in the request that ran successfully, in the same order as the statements in the request. Each ResultSet does not contain any rows. The ResultSetStats in each ResultSet contain the number of rows modified by the statement. Only the first ResultSet in the response contains valid ResultSetMetadata.

↳ status Google\Rpc\Status

If all DML statements are executed successfully, the status is OK. Otherwise, the error status of the first failed statement.

↳ precommit_token Google\Cloud\Spanner\V1\MultiplexedSessionPrecommitToken

Optional. A precommit token will be included if the read-write transaction is on a multiplexed session. The precommit token with the highest sequence number from this transaction attempt should be passed to the Commit request for this transaction. This feature is not yet supported and will result in an UNIMPLEMENTED error.

getResultSets

One ResultSet for each statement in the request that ran successfully, in the same order as the statements in the request. Each ResultSet does not contain any rows. The ResultSetStats in each ResultSet contain the number of rows modified by the statement.

Only the first ResultSet in the response contains valid ResultSetMetadata.

Returns
Type Description
Google\Protobuf\Internal\RepeatedField

setResultSets

One ResultSet for each statement in the request that ran successfully, in the same order as the statements in the request. Each ResultSet does not contain any rows. The ResultSetStats in each ResultSet contain the number of rows modified by the statement.

Only the first ResultSet in the response contains valid ResultSetMetadata.

Parameter
Name Description
var array<Google\Cloud\Spanner\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
Google\Rpc\Status|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 Google\Rpc\Status
Returns
Type Description
$this

getPrecommitToken

Optional. A precommit token will be included if the read-write transaction is on a multiplexed session.

The precommit token with the highest sequence number from this transaction attempt should be passed to the Commit request for this transaction. This feature is not yet supported and will result in an UNIMPLEMENTED error.

Returns
Type Description
Google\Cloud\Spanner\V1\MultiplexedSessionPrecommitToken|null

hasPrecommitToken

clearPrecommitToken

setPrecommitToken

Optional. A precommit token will be included if the read-write transaction is on a multiplexed session.

The precommit token with the highest sequence number from this transaction attempt should be passed to the Commit request for this transaction. This feature is not yet supported and will result in an UNIMPLEMENTED error.

Parameter
Name Description
var Google\Cloud\Spanner\V1\MultiplexedSessionPrecommitToken
Returns
Type Description
$this