98 lines
2.2 KiB
C++
98 lines
2.2 KiB
C++
/**
|
|
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
* SPDX-License-Identifier: Apache-2.0.
|
|
*/
|
|
|
|
#include <aws/qldb-session/model/ExecuteStatementRequest.h>
|
|
#include <aws/core/utils/json/JsonSerializer.h>
|
|
|
|
#include <utility>
|
|
|
|
using namespace Aws::Utils::Json;
|
|
using namespace Aws::Utils;
|
|
|
|
namespace Aws
|
|
{
|
|
namespace QLDBSession
|
|
{
|
|
namespace Model
|
|
{
|
|
|
|
ExecuteStatementRequest::ExecuteStatementRequest() :
|
|
m_transactionIdHasBeenSet(false),
|
|
m_statementHasBeenSet(false),
|
|
m_parametersHasBeenSet(false)
|
|
{
|
|
}
|
|
|
|
ExecuteStatementRequest::ExecuteStatementRequest(JsonView jsonValue) :
|
|
m_transactionIdHasBeenSet(false),
|
|
m_statementHasBeenSet(false),
|
|
m_parametersHasBeenSet(false)
|
|
{
|
|
*this = jsonValue;
|
|
}
|
|
|
|
ExecuteStatementRequest& ExecuteStatementRequest::operator =(JsonView jsonValue)
|
|
{
|
|
if(jsonValue.ValueExists("TransactionId"))
|
|
{
|
|
m_transactionId = jsonValue.GetString("TransactionId");
|
|
|
|
m_transactionIdHasBeenSet = true;
|
|
}
|
|
|
|
if(jsonValue.ValueExists("Statement"))
|
|
{
|
|
m_statement = jsonValue.GetString("Statement");
|
|
|
|
m_statementHasBeenSet = true;
|
|
}
|
|
|
|
if(jsonValue.ValueExists("Parameters"))
|
|
{
|
|
Array<JsonView> parametersJsonList = jsonValue.GetArray("Parameters");
|
|
for(unsigned parametersIndex = 0; parametersIndex < parametersJsonList.GetLength(); ++parametersIndex)
|
|
{
|
|
m_parameters.push_back(parametersJsonList[parametersIndex].AsObject());
|
|
}
|
|
m_parametersHasBeenSet = true;
|
|
}
|
|
|
|
return *this;
|
|
}
|
|
|
|
JsonValue ExecuteStatementRequest::Jsonize() const
|
|
{
|
|
JsonValue payload;
|
|
|
|
if(m_transactionIdHasBeenSet)
|
|
{
|
|
payload.WithString("TransactionId", m_transactionId);
|
|
|
|
}
|
|
|
|
if(m_statementHasBeenSet)
|
|
{
|
|
payload.WithString("Statement", m_statement);
|
|
|
|
}
|
|
|
|
if(m_parametersHasBeenSet)
|
|
{
|
|
Array<JsonValue> parametersJsonList(m_parameters.size());
|
|
for(unsigned parametersIndex = 0; parametersIndex < parametersJsonList.GetLength(); ++parametersIndex)
|
|
{
|
|
parametersJsonList[parametersIndex].AsObject(m_parameters[parametersIndex].Jsonize());
|
|
}
|
|
payload.WithArray("Parameters", std::move(parametersJsonList));
|
|
|
|
}
|
|
|
|
return payload;
|
|
}
|
|
|
|
} // namespace Model
|
|
} // namespace QLDBSession
|
|
} // namespace Aws
|