Copyright | (c) 2013-2023 Brendan Hay |
---|---|
License | Mozilla Public License, v. 2.0. |
Maintainer | Brendan Hay |
Stability | auto-generated |
Portability | non-portable (GHC extensions) |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Runs a SQL statement against a database.
If a call isn't part of a transaction because it doesn't include the
transactionID
parameter, changes that result from the call are
committed automatically.
If the binary response data from the database is more than 1 MB, the call is terminated.
Synopsis
- data ExecuteStatement = ExecuteStatement' {
- continueAfterTimeout :: Maybe Bool
- database :: Maybe Text
- formatRecordsAs :: Maybe RecordsFormatType
- includeResultMetadata :: Maybe Bool
- parameters :: Maybe [SqlParameter]
- resultSetOptions :: Maybe ResultSetOptions
- schema :: Maybe Text
- transactionId :: Maybe Text
- resourceArn :: Text
- secretArn :: Text
- sql :: Text
- newExecuteStatement :: Text -> Text -> Text -> ExecuteStatement
- executeStatement_continueAfterTimeout :: Lens' ExecuteStatement (Maybe Bool)
- executeStatement_database :: Lens' ExecuteStatement (Maybe Text)
- executeStatement_formatRecordsAs :: Lens' ExecuteStatement (Maybe RecordsFormatType)
- executeStatement_includeResultMetadata :: Lens' ExecuteStatement (Maybe Bool)
- executeStatement_parameters :: Lens' ExecuteStatement (Maybe [SqlParameter])
- executeStatement_resultSetOptions :: Lens' ExecuteStatement (Maybe ResultSetOptions)
- executeStatement_schema :: Lens' ExecuteStatement (Maybe Text)
- executeStatement_transactionId :: Lens' ExecuteStatement (Maybe Text)
- executeStatement_resourceArn :: Lens' ExecuteStatement Text
- executeStatement_secretArn :: Lens' ExecuteStatement Text
- executeStatement_sql :: Lens' ExecuteStatement Text
- data ExecuteStatementResponse = ExecuteStatementResponse' {
- columnMetadata :: Maybe [ColumnMetadata]
- formattedRecords :: Maybe Text
- generatedFields :: Maybe [Field]
- numberOfRecordsUpdated :: Maybe Integer
- records :: Maybe [[Field]]
- httpStatus :: Int
- newExecuteStatementResponse :: Int -> ExecuteStatementResponse
- executeStatementResponse_columnMetadata :: Lens' ExecuteStatementResponse (Maybe [ColumnMetadata])
- executeStatementResponse_formattedRecords :: Lens' ExecuteStatementResponse (Maybe Text)
- executeStatementResponse_generatedFields :: Lens' ExecuteStatementResponse (Maybe [Field])
- executeStatementResponse_numberOfRecordsUpdated :: Lens' ExecuteStatementResponse (Maybe Integer)
- executeStatementResponse_records :: Lens' ExecuteStatementResponse (Maybe [[Field]])
- executeStatementResponse_httpStatus :: Lens' ExecuteStatementResponse Int
Creating a Request
data ExecuteStatement Source #
The request parameters represent the input of a request to run a SQL statement against a database.
See: newExecuteStatement
smart constructor.
ExecuteStatement' | |
|
Instances
:: Text | |
-> Text | |
-> Text | |
-> ExecuteStatement |
Create a value of ExecuteStatement
with all optional fields omitted.
Use generic-lens or optics to modify other optional fields.
The following record fields are available, with the corresponding lenses provided for backwards compatibility:
$sel:continueAfterTimeout:ExecuteStatement'
, executeStatement_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.
For DDL statements, we recommend continuing to run the statement after the call times out. When a DDL statement terminates before it is finished running, it can result in errors and possibly corrupted data structures.
$sel:database:ExecuteStatement'
, executeStatement_database
- The name of the database.
$sel:formatRecordsAs:ExecuteStatement'
, executeStatement_formatRecordsAs
- A value that indicates whether to format the result set as a single JSON
string. This parameter only applies to SELECT
statements and is
ignored for other types of statements. Allowed values are NONE
and
JSON
. The default value is NONE
. The result is returned in the
formattedRecords
field.
For usage information about the JSON format for result sets, see Using the Data API in the Amazon Aurora User Guide.
$sel:includeResultMetadata:ExecuteStatement'
, executeStatement_includeResultMetadata
- A value that indicates whether to include metadata in the results.
$sel:parameters:ExecuteStatement'
, executeStatement_parameters
- The parameters for the SQL statement.
Array parameters are not supported.
$sel:resultSetOptions:ExecuteStatement'
, executeStatement_resultSetOptions
- Options that control how the result set is returned.
$sel:schema:ExecuteStatement'
, executeStatement_schema
- The name of the database schema.
Currently, the schema
parameter isn't supported.
$sel:transactionId:ExecuteStatement'
, executeStatement_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.
$sel:resourceArn:ExecuteStatement'
, executeStatement_resourceArn
- The Amazon Resource Name (ARN) of the Aurora Serverless DB cluster.
$sel:secretArn:ExecuteStatement'
, executeStatement_secretArn
- The ARN of the secret that enables access to the DB cluster. Enter the
database user name and password for the credentials in the secret.
For information about creating the secret, see Create a database secret.
$sel:sql:ExecuteStatement'
, executeStatement_sql
- The SQL statement to run.
Request Lenses
executeStatement_continueAfterTimeout :: Lens' ExecuteStatement (Maybe Bool) Source #
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.
For DDL statements, we recommend continuing to run the statement after the call times out. When a DDL statement terminates before it is finished running, it can result in errors and possibly corrupted data structures.
executeStatement_database :: Lens' ExecuteStatement (Maybe Text) Source #
The name of the database.
executeStatement_formatRecordsAs :: Lens' ExecuteStatement (Maybe RecordsFormatType) Source #
A value that indicates whether to format the result set as a single JSON
string. This parameter only applies to SELECT
statements and is
ignored for other types of statements. Allowed values are NONE
and
JSON
. The default value is NONE
. The result is returned in the
formattedRecords
field.
For usage information about the JSON format for result sets, see Using the Data API in the Amazon Aurora User Guide.
executeStatement_includeResultMetadata :: Lens' ExecuteStatement (Maybe Bool) Source #
A value that indicates whether to include metadata in the results.
executeStatement_parameters :: Lens' ExecuteStatement (Maybe [SqlParameter]) Source #
The parameters for the SQL statement.
Array parameters are not supported.
executeStatement_resultSetOptions :: Lens' ExecuteStatement (Maybe ResultSetOptions) Source #
Options that control how the result set is returned.
executeStatement_schema :: Lens' ExecuteStatement (Maybe Text) Source #
The name of the database schema.
Currently, the schema
parameter isn't supported.
executeStatement_transactionId :: Lens' ExecuteStatement (Maybe Text) Source #
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.
executeStatement_resourceArn :: Lens' ExecuteStatement Text Source #
The Amazon Resource Name (ARN) of the Aurora Serverless DB cluster.
executeStatement_secretArn :: Lens' ExecuteStatement Text Source #
The ARN of the secret that enables access to the DB cluster. Enter the database user name and password for the credentials in the secret.
For information about creating the secret, see Create a database secret.
executeStatement_sql :: Lens' ExecuteStatement Text Source #
The SQL statement to run.
Destructuring the Response
data ExecuteStatementResponse Source #
The response elements represent the output of a request to run a SQL statement against a database.
See: newExecuteStatementResponse
smart constructor.
ExecuteStatementResponse' | |
|
Instances
newExecuteStatementResponse Source #
Create a value of ExecuteStatementResponse
with all optional fields omitted.
Use generic-lens or optics to modify other optional fields.
The following record fields are available, with the corresponding lenses provided for backwards compatibility:
$sel:columnMetadata:ExecuteStatementResponse'
, executeStatementResponse_columnMetadata
- Metadata for the columns included in the results. This field is blank if
the formatRecordsAs
parameter is set to JSON
.
$sel:formattedRecords:ExecuteStatementResponse'
, executeStatementResponse_formattedRecords
- A string value that represents the result set of a SELECT
statement in
JSON format. This value is only present when the formatRecordsAs
parameter is set to JSON
.
The size limit for this field is currently 10 MB. If the JSON-formatted string representing the result set requires more than 10 MB, the call returns an error.
ExecuteStatementResponse
, executeStatementResponse_generatedFields
- Values for fields generated during a DML request.
<note> <p>The <code>generatedFields</code> data isn't supported by Aurora PostgreSQL. To get the values of generated fields, use the <code>RETURNING</code> clause. For more information, see <a href="https://www.postgresql.org/docs/10/dml-returning.html">Returning Data From Modified Rows</a> in the PostgreSQL documentation.</p> </note>
$sel:numberOfRecordsUpdated:ExecuteStatementResponse'
, executeStatementResponse_numberOfRecordsUpdated
- The number of records updated by the request.
$sel:records:ExecuteStatementResponse'
, executeStatementResponse_records
- The records returned by the SQL statement. This field is blank if the
formatRecordsAs
parameter is set to JSON
.
$sel:httpStatus:ExecuteStatementResponse'
, executeStatementResponse_httpStatus
- The response's http status code.
Response Lenses
executeStatementResponse_columnMetadata :: Lens' ExecuteStatementResponse (Maybe [ColumnMetadata]) Source #
Metadata for the columns included in the results. This field is blank if
the formatRecordsAs
parameter is set to JSON
.
executeStatementResponse_formattedRecords :: Lens' ExecuteStatementResponse (Maybe Text) Source #
A string value that represents the result set of a SELECT
statement in
JSON format. This value is only present when the formatRecordsAs
parameter is set to JSON
.
The size limit for this field is currently 10 MB. If the JSON-formatted string representing the result set requires more than 10 MB, the call returns an error.
executeStatementResponse_generatedFields :: Lens' ExecuteStatementResponse (Maybe [Field]) Source #
Values for fields generated during a DML request.
<note> <p>The <code>generatedFields</code> data isn't supported by Aurora PostgreSQL. To get the values of generated fields, use the <code>RETURNING</code> clause. For more information, see <a href="https://www.postgresql.org/docs/10/dml-returning.html">Returning Data From Modified Rows</a> in the PostgreSQL documentation.</p> </note>
executeStatementResponse_numberOfRecordsUpdated :: Lens' ExecuteStatementResponse (Maybe Integer) Source #
The number of records updated by the request.
executeStatementResponse_records :: Lens' ExecuteStatementResponse (Maybe [[Field]]) Source #
The records returned by the SQL statement. This field is blank if the
formatRecordsAs
parameter is set to JSON
.
executeStatementResponse_httpStatus :: Lens' ExecuteStatementResponse Int Source #
The response's http status code.