@@ -1245,7 +1245,7 @@ export class Snapshot extends EventEmitter {
12451245 *
12461246 * @param {spannerClient.spanner.v1.ITransaction } resp Response object.
12471247 */
1248- private _update ( resp : spannerClient . spanner . v1 . ITransaction ) : void {
1248+ protected _update ( resp : spannerClient . spanner . v1 . ITransaction ) : void {
12491249 const { id, readTimestamp} = resp ;
12501250
12511251 this . id = id ! ;
@@ -1584,14 +1584,20 @@ export class Transaction extends Dml {
15841584 return { sql, params, paramTypes} ;
15851585 } ) ;
15861586
1587+ const transaction : spannerClient . spanner . v1 . ITransactionSelector = { } ;
1588+ if ( this . id ) {
1589+ transaction . id = this . id as Uint8Array ;
1590+ } else {
1591+ transaction . begin = this . _options ;
1592+ }
15871593 const reqOpts : spannerClient . spanner . v1 . ExecuteBatchDmlRequest = {
15881594 session : this . session . formattedName_ ! ,
15891595 requestOptions : this . configureTagOptions (
15901596 false ,
15911597 this . requestOptions ?. transactionTag ?? undefined ,
15921598 ( options as BatchUpdateOptions ) . requestOptions
15931599 ) ,
1594- transaction : { id : this . id ! } ,
1600+ transaction,
15951601 seqno : this . _seqno ++ ,
15961602 statements,
15971603 } as spannerClient . spanner . v1 . ExecuteBatchDmlRequest ;
@@ -1618,6 +1624,11 @@ export class Transaction extends Dml {
16181624 }
16191625
16201626 const { resultSets, status} = resp ;
1627+ for ( const resultSet of resultSets ) {
1628+ if ( ! this . id && resultSet . metadata && resultSet . metadata . transaction ) {
1629+ this . _update ( resultSet . metadata . transaction ) ;
1630+ }
1631+ }
16211632 const rowCounts : number [ ] = resultSets . map ( ( { stats} ) => {
16221633 return (
16231634 ( stats &&
0 commit comments