Skip to content
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions driver/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ WHILE(${DRIVER_INDEX} LESS ${DRIVERS_COUNT})
base_metrics_holder.cc catalog.cc catalog_no_i_s.cc cluster_topology_info.cc
cluster_aware_hit_metrics_holder.cc cluster_aware_metrics_container.cc
cluster_aware_metrics.cc cluster_aware_time_metrics_holder.cc
connect.cc cursor.cc desc.cc dll.cc driver.cc
connect.cc cursor.cc desc.cc dll.cc driver.cc efm_proxy.cc
error.cc execute.cc failover_connection_handler.cc failover_handler.cc
failover_reader_handler.cc failover_writer_handler.cc handle.cc host_info.cc info.cc
monitor.cc monitor_connection_context.cc monitor_service.cc monitor_thread_container.cc
Expand All @@ -84,7 +84,7 @@ WHILE(${DRIVER_INDEX} LESS ${DRIVERS_COUNT})
SET(DRIVER_SRCS ${DRIVER_SRCS} driver${CONNECTOR_DRIVER_TYPE_SHORT}.def driver${CONNECTOR_DRIVER_TYPE_SHORT}.rc
base_metrics_holder.h catalog.h cluster_aware_hit_metrics_holder.h cluster_aware_metrics_container.h
cluster_aware_metrics.h cluster_aware_time_metrics_holder.h cluster_topology_info.h
driver.h error.h failover.h host_info.h monitor.h monitor_connection_context.h monitor_service.h
driver.h efm_proxy.h error.h failover.h host_info.h monitor.h monitor_connection_context.h monitor_service.h
monitor_thread_container.h mylog.h mysql_proxy.h myutil.h parse.h query_parsing.h topology_service.h
../MYODBC_MYSQL.h ../MYODBC_CONF.h ../MYODBC_ODBC.h)
ENDIF(WIN32)
Expand Down
11 changes: 7 additions & 4 deletions driver/connect.cc
Original file line number Diff line number Diff line change
Expand Up @@ -751,7 +751,7 @@ SQLRETURN DBC::connect(DataSource *dsrc, bool failover_enabled)
ds_set_strnattr(&dsrc->server8, (SQLCHAR*)host, strlen(host));
dsrc->port = port;

Aws::SDKOptions options;
//Aws::SDKOptions options;
//Aws::InitAPI(options); TODO: causing SSL connection error: SSL_CTX_new failed
//Aws::ShutdownAPI(options);

Expand Down Expand Up @@ -1056,7 +1056,8 @@ SQLRETURN SQL_API MySQLConnect(SQLHDBC hdbc,
if (ds->save_queries && !dbc->log_file)
dbc->log_file = init_log_file();

dbc->mysql_proxy = new MYSQL_PROXY(dbc, ds);
dbc->init_proxy_chain(ds);
dbc->connection_handler = std::make_shared<CONNECTION_HANDLER>(dbc);
dbc->fh = new FAILOVER_HANDLER(dbc, ds);
rc = dbc->fh->init_cluster_info();
if (!dbc->ds)
Expand Down Expand Up @@ -1173,7 +1174,8 @@ SQLRETURN SQL_API MySQLDriverConnect(SQLHDBC hdbc, SQLHWND hwnd,
if (ds->save_queries && !dbc->log_file)
dbc->log_file = init_log_file();

dbc->mysql_proxy = new MYSQL_PROXY(dbc, ds);
dbc->init_proxy_chain(ds);
dbc->connection_handler = std::make_shared<CONNECTION_HANDLER>(dbc);
dbc->fh = new FAILOVER_HANDLER(dbc, ds);
rc = dbc->fh->init_cluster_info();
if (rc == SQL_SUCCESS || rc == SQL_SUCCESS_WITH_INFO)
Expand Down Expand Up @@ -1352,7 +1354,8 @@ SQLRETURN SQL_API MySQLDriverConnect(SQLHDBC hdbc, SQLHWND hwnd,
if (ds->save_queries && !dbc->log_file)
dbc->log_file = init_log_file();

dbc->mysql_proxy = new MYSQL_PROXY(dbc, ds);
dbc->init_proxy_chain(ds);
dbc->connection_handler = std::make_shared<CONNECTION_HANDLER>(dbc);
dbc->fh = new FAILOVER_HANDLER(dbc, ds);
rc = dbc->fh->init_cluster_info();
if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO)
Expand Down
2 changes: 1 addition & 1 deletion driver/dll.cc
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ void myodbc_init(void)

// This library_init call is causing the test my_data to crash on mac.
// TODO: Find alternate solution
// mysql_library_init(0, nullptr, nullptr);
mysql_library_init(0, nullptr, nullptr);

if(!mysys_inited)
{
Expand Down
5 changes: 4 additions & 1 deletion driver/driver.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,10 @@
#include "../MYODBC_MYSQL.h"
#include "../MYODBC_CONF.h"
#include "../MYODBC_ODBC.h"
#include "util/installer.h"
#include "efm_proxy.h"
#include "failover.h"
#include "mysql_proxy.h"
#include "util/installer.h"

/* Disable _attribute__ on non-gcc compilers. */
#if !defined(__attribute__) && !defined(__GNUC__)
Expand Down Expand Up @@ -643,6 +644,7 @@ struct DBC
fido_callback_func fido_callback = nullptr;

FAILOVER_HANDLER *fh = nullptr; /* Failover handler */
std::shared_ptr<CONNECTION_HANDLER> connection_handler = nullptr;

DBC(ENV *p_env);
void free_explicit_descriptors();
Expand All @@ -654,6 +656,7 @@ struct DBC
SQLRETURN connect(DataSource *dsrc, bool failover_enabled);
void execute_prep_stmt(MYSQL_STMT *pstmt, std::string &query,
MYSQL_BIND *param_bind, MYSQL_BIND *result_bind);
void init_proxy_chain(DataSource *dsrc);

inline bool transactions_supported() {
return mysql_proxy->get_server_capabilities() & CLIENT_TRANSACTIONS;
Expand Down
Loading