Skip to content

Commit

Permalink
chore: fix connection string builder
Browse files Browse the repository at this point in the history
  • Loading branch information
karenc-bq committed Jul 3, 2024
1 parent 27750c2 commit 9cca427
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
4 changes: 0 additions & 4 deletions driver/connection_handler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@

#include <codecvt>
#include <locale>
#include <iostream>

#ifdef __linux__
sqlwchar_string to_sqlwchar_string(const std::string& src) {
Expand All @@ -58,8 +57,6 @@ CONNECTION_HANDLER::CONNECTION_HANDLER(DBC* dbc) : dbc{dbc} {}
CONNECTION_HANDLER::~CONNECTION_HANDLER() = default;

SQLRETURN CONNECTION_HANDLER::do_connect(DBC* dbc_ptr, DataSource* ds, bool failover_enabled, bool is_monitor_connection) {
SQLCHAR conn_in[4096];
sprintf(reinterpret_cast<char*>(conn_in), "authmode=%s;authhost=%s;authport=%d;port=%d", ds->opt_AUTH_MODE, ds->opt_AUTH_HOST, ds->opt_PORT, ds->opt_AUTH_PORT);
return dbc_ptr->connect(ds, failover_enabled, is_monitor_connection);
}

Expand All @@ -68,7 +65,6 @@ CONNECTION_PROXY* CONNECTION_HANDLER::connect(std::shared_ptr<HOST_INFO> host_in
if (dbc == nullptr || host_info == nullptr) {
return nullptr;
}

DataSource* ds_to_use = new DataSource();
ds_to_use->copy(ds ? ds : &dbc->ds);
const auto new_host = to_sqlwchar_string(host_info->get_host());
Expand Down
5 changes: 4 additions & 1 deletion driver/handle.cc
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
#include "secrets_manager_proxy.h"

#include <mutex>
#include <iostream>

thread_local long thread_count = 0;

Expand Down Expand Up @@ -120,7 +121,9 @@ void DBC::close()
void DBC::init_proxy_chain(DataSource* dsrc)
{
CONNECTION_PROXY *head = new MYSQL_PROXY(this, dsrc);

SQLCHAR conn_in[4096];
sprintf(reinterpret_cast<char*>(conn_in), "[init_proxy_chain] auth_mode=%s;", dsrc->opt_AUTH_MODE);
std::cout << conn_in << std::endl;
if (dsrc->opt_ENABLE_FAILURE_DETECTION) {
CONNECTION_PROXY* efm_proxy = new EFM_PROXY(this, dsrc);
efm_proxy->set_next_proxy(head);
Expand Down
2 changes: 0 additions & 2 deletions driver/iam_proxy.cc
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,6 @@ bool IAM_PROXY::invoke_func_with_generated_token(std::function<bool(const char*)
std::string auth_token = this->get_auth_token(auth_host, region, iam_port,
(const char*)ds->opt_UID, ds->opt_AUTH_EXPIRATION);

MYLOG_DBC_TRACE(dbc, "[IAM_PLUGIN] auth_host=%s", auth_host);
MYLOG_DBC_TRACE(dbc, "[IAM_PLUGIN] auth_token=%s", auth_token.c_str());
bool connect_result = func(auth_token.c_str());
if (!connect_result) {
if (using_cached_token) {
Expand Down
3 changes: 3 additions & 0 deletions integration/connection_string_builder.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include <stdexcept>
#include <string>
#include <memory>
#include <iostream>

class ConnectionStringBuilder;

Expand Down Expand Up @@ -142,6 +143,8 @@ class ConnectionString {
snprintf(conn_in + length, sizeof(conn_in) - length, "\0");

std::string connection_string(conn_in);
std::cout << "[CONNECTION STR] " << connection_string << std::endl;

return connection_string;
}

Expand Down

0 comments on commit 9cca427

Please sign in to comment.