aws_sdk_rdsdata/operation/execute_statement/
_execute_statement_output.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>The response elements represent the output of a request to run a SQL statement against a database.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct ExecuteStatementOutput {
7    /// <p>The records returned by the SQL statement. This field is blank if the <code>formatRecordsAs</code> parameter is set to <code>JSON</code>.</p>
8    pub records: ::std::option::Option<::std::vec::Vec<::std::vec::Vec<crate::types::Field>>>,
9    /// <p>Metadata for the columns included in the results. This field is blank if the <code>formatRecordsAs</code> parameter is set to <code>JSON</code>.</p>
10    pub column_metadata: ::std::option::Option<::std::vec::Vec<crate::types::ColumnMetadata>>,
11    /// <p>The number of records updated by the request.</p>
12    pub number_of_records_updated: i64,
13    /// <p>Values for fields generated during a DML request.</p><note>
14    /// <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>
15    /// </note>
16    pub generated_fields: ::std::option::Option<::std::vec::Vec<crate::types::Field>>,
17    /// <p>A string value that represents the result set of a <code>SELECT</code> statement in JSON format. This value is only present when the <code>formatRecordsAs</code> parameter is set to <code>JSON</code>.</p>
18    /// <p>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.</p>
19    pub formatted_records: ::std::option::Option<::std::string::String>,
20    _request_id: Option<String>,
21}
22impl ExecuteStatementOutput {
23    /// <p>The records returned by the SQL statement. This field is blank if the <code>formatRecordsAs</code> parameter is set to <code>JSON</code>.</p>
24    ///
25    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.records.is_none()`.
26    pub fn records(&self) -> &[::std::vec::Vec<crate::types::Field>] {
27        self.records.as_deref().unwrap_or_default()
28    }
29    /// <p>Metadata for the columns included in the results. This field is blank if the <code>formatRecordsAs</code> parameter is set to <code>JSON</code>.</p>
30    ///
31    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.column_metadata.is_none()`.
32    pub fn column_metadata(&self) -> &[crate::types::ColumnMetadata] {
33        self.column_metadata.as_deref().unwrap_or_default()
34    }
35    /// <p>The number of records updated by the request.</p>
36    pub fn number_of_records_updated(&self) -> i64 {
37        self.number_of_records_updated
38    }
39    /// <p>Values for fields generated during a DML request.</p><note>
40    /// <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>
41    /// </note>
42    ///
43    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.generated_fields.is_none()`.
44    pub fn generated_fields(&self) -> &[crate::types::Field] {
45        self.generated_fields.as_deref().unwrap_or_default()
46    }
47    /// <p>A string value that represents the result set of a <code>SELECT</code> statement in JSON format. This value is only present when the <code>formatRecordsAs</code> parameter is set to <code>JSON</code>.</p>
48    /// <p>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.</p>
49    pub fn formatted_records(&self) -> ::std::option::Option<&str> {
50        self.formatted_records.as_deref()
51    }
52}
53impl ::aws_types::request_id::RequestId for ExecuteStatementOutput {
54    fn request_id(&self) -> Option<&str> {
55        self._request_id.as_deref()
56    }
57}
58impl ExecuteStatementOutput {
59    /// Creates a new builder-style object to manufacture [`ExecuteStatementOutput`](crate::operation::execute_statement::ExecuteStatementOutput).
60    pub fn builder() -> crate::operation::execute_statement::builders::ExecuteStatementOutputBuilder {
61        crate::operation::execute_statement::builders::ExecuteStatementOutputBuilder::default()
62    }
63}
64
65/// A builder for [`ExecuteStatementOutput`](crate::operation::execute_statement::ExecuteStatementOutput).
66#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
67#[non_exhaustive]
68pub struct ExecuteStatementOutputBuilder {
69    pub(crate) records: ::std::option::Option<::std::vec::Vec<::std::vec::Vec<crate::types::Field>>>,
70    pub(crate) column_metadata: ::std::option::Option<::std::vec::Vec<crate::types::ColumnMetadata>>,
71    pub(crate) number_of_records_updated: ::std::option::Option<i64>,
72    pub(crate) generated_fields: ::std::option::Option<::std::vec::Vec<crate::types::Field>>,
73    pub(crate) formatted_records: ::std::option::Option<::std::string::String>,
74    _request_id: Option<String>,
75}
76impl ExecuteStatementOutputBuilder {
77    /// Appends an item to `records`.
78    ///
79    /// To override the contents of this collection use [`set_records`](Self::set_records).
80    ///
81    /// <p>The records returned by the SQL statement. This field is blank if the <code>formatRecordsAs</code> parameter is set to <code>JSON</code>.</p>
82    pub fn records(mut self, input: ::std::vec::Vec<crate::types::Field>) -> Self {
83        let mut v = self.records.unwrap_or_default();
84        v.push(input);
85        self.records = ::std::option::Option::Some(v);
86        self
87    }
88    /// <p>The records returned by the SQL statement. This field is blank if the <code>formatRecordsAs</code> parameter is set to <code>JSON</code>.</p>
89    pub fn set_records(mut self, input: ::std::option::Option<::std::vec::Vec<::std::vec::Vec<crate::types::Field>>>) -> Self {
90        self.records = input;
91        self
92    }
93    /// <p>The records returned by the SQL statement. This field is blank if the <code>formatRecordsAs</code> parameter is set to <code>JSON</code>.</p>
94    pub fn get_records(&self) -> &::std::option::Option<::std::vec::Vec<::std::vec::Vec<crate::types::Field>>> {
95        &self.records
96    }
97    /// Appends an item to `column_metadata`.
98    ///
99    /// To override the contents of this collection use [`set_column_metadata`](Self::set_column_metadata).
100    ///
101    /// <p>Metadata for the columns included in the results. This field is blank if the <code>formatRecordsAs</code> parameter is set to <code>JSON</code>.</p>
102    pub fn column_metadata(mut self, input: crate::types::ColumnMetadata) -> Self {
103        let mut v = self.column_metadata.unwrap_or_default();
104        v.push(input);
105        self.column_metadata = ::std::option::Option::Some(v);
106        self
107    }
108    /// <p>Metadata for the columns included in the results. This field is blank if the <code>formatRecordsAs</code> parameter is set to <code>JSON</code>.</p>
109    pub fn set_column_metadata(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::ColumnMetadata>>) -> Self {
110        self.column_metadata = input;
111        self
112    }
113    /// <p>Metadata for the columns included in the results. This field is blank if the <code>formatRecordsAs</code> parameter is set to <code>JSON</code>.</p>
114    pub fn get_column_metadata(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::ColumnMetadata>> {
115        &self.column_metadata
116    }
117    /// <p>The number of records updated by the request.</p>
118    pub fn number_of_records_updated(mut self, input: i64) -> Self {
119        self.number_of_records_updated = ::std::option::Option::Some(input);
120        self
121    }
122    /// <p>The number of records updated by the request.</p>
123    pub fn set_number_of_records_updated(mut self, input: ::std::option::Option<i64>) -> Self {
124        self.number_of_records_updated = input;
125        self
126    }
127    /// <p>The number of records updated by the request.</p>
128    pub fn get_number_of_records_updated(&self) -> &::std::option::Option<i64> {
129        &self.number_of_records_updated
130    }
131    /// Appends an item to `generated_fields`.
132    ///
133    /// To override the contents of this collection use [`set_generated_fields`](Self::set_generated_fields).
134    ///
135    /// <p>Values for fields generated during a DML request.</p><note>
136    /// <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>
137    /// </note>
138    pub fn generated_fields(mut self, input: crate::types::Field) -> Self {
139        let mut v = self.generated_fields.unwrap_or_default();
140        v.push(input);
141        self.generated_fields = ::std::option::Option::Some(v);
142        self
143    }
144    /// <p>Values for fields generated during a DML request.</p><note>
145    /// <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>
146    /// </note>
147    pub fn set_generated_fields(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Field>>) -> Self {
148        self.generated_fields = input;
149        self
150    }
151    /// <p>Values for fields generated during a DML request.</p><note>
152    /// <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>
153    /// </note>
154    pub fn get_generated_fields(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Field>> {
155        &self.generated_fields
156    }
157    /// <p>A string value that represents the result set of a <code>SELECT</code> statement in JSON format. This value is only present when the <code>formatRecordsAs</code> parameter is set to <code>JSON</code>.</p>
158    /// <p>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.</p>
159    pub fn formatted_records(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
160        self.formatted_records = ::std::option::Option::Some(input.into());
161        self
162    }
163    /// <p>A string value that represents the result set of a <code>SELECT</code> statement in JSON format. This value is only present when the <code>formatRecordsAs</code> parameter is set to <code>JSON</code>.</p>
164    /// <p>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.</p>
165    pub fn set_formatted_records(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
166        self.formatted_records = input;
167        self
168    }
169    /// <p>A string value that represents the result set of a <code>SELECT</code> statement in JSON format. This value is only present when the <code>formatRecordsAs</code> parameter is set to <code>JSON</code>.</p>
170    /// <p>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.</p>
171    pub fn get_formatted_records(&self) -> &::std::option::Option<::std::string::String> {
172        &self.formatted_records
173    }
174    pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
175        self._request_id = Some(request_id.into());
176        self
177    }
178
179    pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
180        self._request_id = request_id;
181        self
182    }
183    /// Consumes the builder and constructs a [`ExecuteStatementOutput`](crate::operation::execute_statement::ExecuteStatementOutput).
184    pub fn build(self) -> crate::operation::execute_statement::ExecuteStatementOutput {
185        crate::operation::execute_statement::ExecuteStatementOutput {
186            records: self.records,
187            column_metadata: self.column_metadata,
188            number_of_records_updated: self.number_of_records_updated.unwrap_or_default(),
189            generated_fields: self.generated_fields,
190            formatted_records: self.formatted_records,
191            _request_id: self._request_id,
192        }
193    }
194}