diff --git a/src/connector/odbc/tests/main.c b/src/connector/odbc/tests/main.c index c61969ef650f1a57c5138200c6f040aecedd6603..1bb174e7b9f6b43ff9c88070667a37cffbb52a1b 100644 --- a/src/connector/odbc/tests/main.c +++ b/src/connector/odbc/tests/main.c @@ -497,13 +497,6 @@ int main(int argc, char *argv[]) { return 0; } - if (argc==2 && strcmp(argv[1], "uninstall")==0) { - DWORD usage = 0; - BOOL ok = SQLRemoveDriver("TAOS ODBC", TRUE, &usage); - D("ok/usage: %d/%d", ok, usage); - return ok ? 0 : 1; - } - const char *dsn = (argc>1) ? argv[1] : NULL; const char *uid = (argc>2) ? argv[2] : NULL; const char *pwd = (argc>3) ? argv[3] : NULL; diff --git a/src/connector/odbc/tools/CMakeLists.txt b/src/connector/odbc/tools/CMakeLists.txt index 9d7025928f7d40044a1aaffa5b59259ffe788e5b..5d8afb092dbf987cfa77f2fa8ba5f3c63816a39c 100644 --- a/src/connector/odbc/tools/CMakeLists.txt +++ b/src/connector/odbc/tools/CMakeLists.txt @@ -2,7 +2,7 @@ PROJECT(TDengine) IF (TD_LINUX) ADD_EXECUTABLE(todbcinst main.c) - TARGET_LINK_LIBRARIES(todbcinst odbc) + TARGET_LINK_LIBRARIES(todbcinst odbc odbcinst) ENDIF () IF (TD_WINDOWS_64) diff --git a/src/connector/odbc/tools/main.c b/src/connector/odbc/tools/main.c index d613ce151be866468ea040b7250ecc69365f5751..b9422830c047b0361a68b090829ab3fcc7aa21ee 100644 --- a/src/connector/odbc/tools/main.c +++ b/src/connector/odbc/tools/main.c @@ -7,6 +7,7 @@ #endif #include +#include #include #include @@ -36,14 +37,17 @@ int main(int argc, char *argv[]) { } static void usage(const char *arg0) { - fprintf(stderr, "%s -h | -i -n [TaosDriverName] -p [TaosDriverPath] | -u [-f] [TaosDriverName]\n", arg0); + fprintf(stderr, "%s -h | -i -n [TaosDriverName] -p [TaosDriverPath] | -u [-f] -n [TaosDriverName]\n", arg0); return; } static int do_install(int i, int argc, char *argv[]) { - int forceful = 0; const char* driverName = NULL; +#ifdef _MSC_VER const char* driverFile = "todbc.dll"; +#else + const char* driverFile = "libtodbc.so"; +#endif const char* driverPath = NULL; for (; i < argc; ++i) { const char *arg = argv[i]; @@ -82,7 +86,7 @@ static int do_install(int i, int argc, char *argv[]) { char buf[8192]; snprintf(buf, sizeof(buf), "%s%cDriver=%s%cFileUage=0%cConnectFunctions=YYN%c", driverName, 0, driverFile, 0, 0, 0); - BOOL ok = TRUE; + BOOL ok = 1; DWORD usageCount = 1; char installed[PATH_MAX + 1]; WORD len = 0; @@ -91,7 +95,13 @@ static int do_install(int i, int argc, char *argv[]) { fprintf(stderr, "failed to query TaosDriverName: [%s]\n", driverName); return -1; } - if (stricmp(driverPath, installed)) { + int r = 0; +#ifdef _MSC_VER + r = stricmp(driverPath, installed); +#else + r = strcasecmp(driverPath, installed); +#endif + if (r) { fprintf(stderr, "previously installed TaosDriver [%s] has different target path [%s]\n" "it shall be uninstalled before you can install it to different path [%s]\n", driverName, installed, driverPath); @@ -134,10 +144,10 @@ static int do_uninstall(int i, int argc, char *argv[]) { fprintf(stderr, "TaosDriverName not specified\n"); return -1; } - BOOL ok = TRUE; + BOOL ok = 1; DWORD usageCount = 1; do { - ok = SQLRemoveDriver(driverName, FALSE, &usageCount); + ok = SQLRemoveDriver(driverName, 0, &usageCount); if (!ok) { fprintf(stderr, "failed to remove driver [%s]\n", driverName); return -1;