Skip to content

Commit

Permalink
Minor cleanuo
Browse files Browse the repository at this point in the history
Signed-off-by: currantw <[email protected]>
  • Loading branch information
currantw committed Nov 15, 2024
1 parent 44336bf commit f39036d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 10 deletions.
5 changes: 2 additions & 3 deletions src/sqlodbc/dlg_specific.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ void makeConnectString(char *connect_string, const ConnInfo *ci, UWORD len) {
/* fundamental info */
nlen = MAX_CONNECT_STRING;

// Format string
const char* connect_string_format =
const char* connect_format_string =
"%s=%s;"
INI_SERVER "=%s;"
"database=OpenSearch;"
Expand All @@ -59,7 +58,7 @@ void makeConnectString(char *connect_string, const ConnInfo *ci, UWORD len) {

olen = snprintf(
connect_string, nlen,
connect_string_format,
connect_format_string,
got_dsn ? "DSN" : "DRIVER", got_dsn ? ci->dsn : ci->drivername,
ci->server,
ci->port,
Expand Down
7 changes: 3 additions & 4 deletions src/sqlodbc/opensearch_communication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ OpenSearchCommunication::IssueRequest(
// Generate http request
Aws::Http::URI host(m_rt_opts.conn.server.c_str());
if (!m_rt_opts.conn.port.empty()) {
host.SetPort((uint16_t)atoi(m_rt_opts.conn.port.c_str()));
host.SetPort((uint16_t) atoi(m_rt_opts.conn.port.c_str()));
}
host.SetPath(endpoint.c_str());

Expand Down Expand Up @@ -439,7 +439,7 @@ OpenSearchCommunication::IssueRequest(
}

// Handle authentication
std::string& auth_type = m_rt_opts.auth.auth_type;
const std::string& auth_type = m_rt_opts.auth.auth_type;

if (auth_type == AUTHTYPE_BASIC) {
std::string userpw_str =
Expand All @@ -452,7 +452,6 @@ OpenSearchCommunication::IssueRequest(
request->SetAuthorization("Basic " + hashed_userpw);
}

// TODO #70: Handle serverless
else if (auth_type == AUTHTYPE_IAM) {
std::shared_ptr< Aws::Auth::ProfileConfigFileAWSCredentialsProvider >
credential_provider = Aws::MakeShared<
Expand Down Expand Up @@ -1097,7 +1096,7 @@ void OpenSearchCommunication::SetSqlEndpoint() {
*/
bool OpenSearchCommunication::isServerless() {

// Specified in DSN configuration
// Specified in DSN configuration.
const std::string& is_serverless = m_rt_opts.conn.is_serverless;

if(!is_serverless.empty()) {
Expand Down
4 changes: 1 addition & 3 deletions src/sqlodbc/opensearch_communication.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ class OpenSearchCommunication {
void SetErrorDetails(std::string reason, std::string message,
ConnErrorType error_type);
void SetErrorDetails(ErrorDetails details);
bool isServerless();

// TODO #35 - Go through and add error messages on exit conditions
std::string m_error_message;
Expand All @@ -97,9 +98,6 @@ class OpenSearchCommunication {
std::string m_response_str;
std::shared_ptr< Aws::Http::HttpClient > m_http_client;
std::string m_error_message_to_user;

// TODO #70 - Support serverless
bool isServerless();
};

#endif

0 comments on commit f39036d

Please sign in to comment.