beginTransaction method

Future<BeginTransactionResponse> beginTransaction({
  1. required String resourceArn,
  2. required String secretArn,
  3. String? database,
  4. String? schema,
})

Starts a SQL transaction.

 <important> <p>A transaction can run for a maximum
of 24 hours. A transaction is terminated and rolled back automatically
after 24 hours.</p> <p>A transaction times out if no calls use
its transaction ID in three minutes. If a transaction times out before
it's committed, it's rolled back automatically.</p> <p>DDL
statements inside a transaction cause an implicit commit. We recommend
that you run each DDL statement in a separate
<code>ExecuteStatement</code> call with
<code>continueAfterTimeout</code> enabled.</p>
</important> 

May throw BadRequestException. May throw StatementTimeoutException. May throw InternalServerErrorException. May throw ForbiddenException. May throw ServiceUnavailableError.

Parameter resourceArn : The Amazon Resource Name (ARN) of the Aurora Serverless DB cluster.

Parameter secretArn : The name or ARN of the secret that enables access to the DB cluster.

Parameter database : The name of the database.

Parameter schema : The name of the database schema.

Implementation

Future<BeginTransactionResponse> beginTransaction({
  required String resourceArn,
  required String secretArn,
  String? database,
  String? schema,
}) async {
  ArgumentError.checkNotNull(resourceArn, 'resourceArn');
  _s.validateStringLength(
    'resourceArn',
    resourceArn,
    11,
    100,
    isRequired: true,
  );
  ArgumentError.checkNotNull(secretArn, 'secretArn');
  _s.validateStringLength(
    'secretArn',
    secretArn,
    11,
    100,
    isRequired: true,
  );
  _s.validateStringLength(
    'database',
    database,
    0,
    64,
  );
  _s.validateStringLength(
    'schema',
    schema,
    0,
    64,
  );
  final $payload = <String, dynamic>{
    'resourceArn': resourceArn,
    'secretArn': secretArn,
    if (database != null) 'database': database,
    if (schema != null) 'schema': schema,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/BeginTransaction',
    exceptionFnMap: _exceptionFns,
  );
  return BeginTransactionResponse.fromJson(response);
}