From 557aa20d32eaed71809935443e11b212325b4c24 Mon Sep 17 00:00:00 2001 From: freemine Date: Sat, 7 Nov 2020 10:41:30 +0800 Subject: [PATCH] 1. setup dll functions (ConfigDSN ...) compiled and exported only on windows 2. add 'Server' key in Odbc.ini to allow connecting server other than localhost via DSN --- src/connector/odbc/src/install.sh | 5 +-- src/connector/odbc/src/todbc.c | 59 ++++++++++++++++--------------- 2 files changed, 33 insertions(+), 31 deletions(-) diff --git a/src/connector/odbc/src/install.sh b/src/connector/odbc/src/install.sh index 6f45ce4357..02f31de70e 100755 --- a/src/connector/odbc/src/install.sh +++ b/src/connector/odbc/src/install.sh @@ -9,14 +9,15 @@ rm -f "${BLD_DIR}/template.dsn" cat > "${BLD_DIR}/template.ini" < "${BLD_DIR}/template.dsn" <taos = taos_connect(ip, userName, auth, NULL, port); + conn->taos = taos_connect(ip, uid, pwd, NULL, (uint16_t)port); if (!conn->taos) { - SET_ERROR(conn, "08001", terrno, "failed to connect to data source"); + SET_ERROR(conn, "08001", terrno, "failed to connect to data source for DSN[%s] @[%s:%d]", dsn, ip, port); break; } } while (0); - tsdb_conv_free(client_to_server, serverName, &buffer, (const char*)ServerName); - tsdb_conv_free(client_to_server, userName, &buffer, (const char*)UserName); - tsdb_conv_free(client_to_server, auth, &buffer, (const char*)Authentication); + tsdb_conv_free(client_to_server, dsn, &buffer, (const char*)ServerName); + tsdb_conv_free(client_to_server, uid, &buffer, (const char*)UserName); + tsdb_conv_free(client_to_server, pwd, &buffer, (const char*)Authentication); + tsdb_conv_free(client_to_server, svr, &buffer, (const char*)server); return conn->taos ? SQL_SUCCESS : SQL_ERROR; } @@ -2877,6 +2875,8 @@ SQLRETURN SQL_API SQLSetStmtAttr(SQLHSTMT StatementHandle, return r; } +#ifdef _MSC_VER + #define LOG(fmt, ...) \ do { \ FILE *fout = fopen("C:\\test\\test.log", "ab+"); \ @@ -3125,6 +3125,7 @@ BOOL INSTAPI ConfigDriver(HWND hwndParent, WORD fRequest, LPCSTR lpszDriver, LPC return FALSE; } +#endif // _MSC_VER static void init_routine(void) { -- GitLab