From 36c701108330e142d4a2dd454cff8a4725e579b5 Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Sat, 21 Aug 2021 10:34:03 +0800 Subject: [PATCH] [TD-5992] add set config interface for connector --- src/client/src/tscSystem.c | 3 ++- src/client/tests/cliTest.cpp | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/client/src/tscSystem.c b/src/client/src/tscSystem.c index f7e0979bdd..884c172577 100644 --- a/src/client/src/tscSystem.c +++ b/src/client/src/tscSystem.c @@ -124,7 +124,7 @@ int32_t tscAcquireRpc(const char *key, const char *user, const char *secretEncry static pthread_mutex_t setConfMutex = PTHREAD_MUTEX_INITIALIZER; static bool setConfFlag = false; int taos_set_config(const char *config){ - if(taos_init() == false){ + if(taos_init()){ tscError("failed to call taos_init"); return -1; } @@ -150,6 +150,7 @@ int taos_set_config(const char *config){ } taosReadConfigOption(item->string, item->valuestring, NULL, NULL); } + taosPrintGlobalCfg(); setConfFlag = true; pthread_mutex_unlock(&setConfMutex); return 0; diff --git a/src/client/tests/cliTest.cpp b/src/client/tests/cliTest.cpp index d8f155c088..99bd258c04 100644 --- a/src/client/tests/cliTest.cpp +++ b/src/client/tests/cliTest.cpp @@ -262,8 +262,9 @@ TEST(testCase, result_field_test) { taos_options(TSDB_OPTION_CONFIGDIR, "~/first/cfg"); taos_init(); - //char *config = "{\"tempDir:\"/root/tmp/\",\"sercerPort\":\"3333\"}"; - //taos_set_config(config); + const char *config = "{\"tempDir\":\"/root/tmp/\",\"serverPort\":\"3333\"}"; + taos_set_config(config); + taos_set_config(config); validateResultFields(); stmtInsertTest(); } -- GitLab