executeStatement method
Runs a SQL statement against a database. The response size limit is 1 MB. If the call returns more than 1 MB of response data, the call is terminated.
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 sql
:
The SQL statement to run.
Parameter continueAfterTimeout
:
A value that indicates whether to continue running the statement after the
call times out. By default, the statement stops running when the call
times out.
Parameter database
:
The name of the database.
Parameter includeResultMetadata
:
A value that indicates whether to include metadata in the results.
Parameter parameters
:
The parameters for the SQL statement.
Parameter resultSetOptions
:
Options that control how the result set is returned.
Parameter schema
:
The name of the database schema.
Parameter transactionId
:
The identifier of a transaction that was started by using the
BeginTransaction
operation. Specify the transaction ID of the
transaction that you want to include the SQL statement in.
If the SQL statement is not part of a transaction, don't set this parameter.
Implementation
Future<ExecuteStatementResponse> executeStatement({
required String resourceArn,
required String secretArn,
required String sql,
bool? continueAfterTimeout,
String? database,
bool? includeResultMetadata,
List<SqlParameter>? parameters,
ResultSetOptions? resultSetOptions,
String? schema,
String? transactionId,
}) 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,
);
ArgumentError.checkNotNull(sql, 'sql');
_s.validateStringLength(
'sql',
sql,
0,
65536,
isRequired: true,
);
_s.validateStringLength(
'database',
database,
0,
64,
);
_s.validateStringLength(
'schema',
schema,
0,
64,
);
_s.validateStringLength(
'transactionId',
transactionId,
0,
192,
);
final $payload = <String, dynamic>{
'resourceArn': resourceArn,
'secretArn': secretArn,
'sql': sql,
if (continueAfterTimeout != null)
'continueAfterTimeout': continueAfterTimeout,
if (database != null) 'database': database,
if (includeResultMetadata != null)
'includeResultMetadata': includeResultMetadata,
if (parameters != null) 'parameters': parameters,
if (resultSetOptions != null) 'resultSetOptions': resultSetOptions,
if (schema != null) 'schema': schema,
if (transactionId != null) 'transactionId': transactionId,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri: '/Execute',
exceptionFnMap: _exceptionFns,
);
return ExecuteStatementResponse.fromJson(response);
}