提交 ea17b403 编写于 作者: wmmhello's avatar wmmhello

[TD-5992] modify return msg

上级 f8b19dea
...@@ -180,8 +180,8 @@ JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_setConfigImp(JNIE ...@@ -180,8 +180,8 @@ JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_setConfigImp(JNIE
if (!cfg) { if (!cfg) {
return -1; return -1;
} }
return 0;
return taos_set_config(cfg); //return taos_set_config(cfg);
} }
JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_setOptions(JNIEnv *env, jobject jobj, jint optionIndex, JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_setOptions(JNIEnv *env, jobject jobj, jint optionIndex,
......
...@@ -454,13 +454,20 @@ static setConfRet taos_set_config_imp(const char *config){ ...@@ -454,13 +454,20 @@ static setConfRet taos_set_config_imp(const char *config){
strcpy(ret.retMsg, "parse json error"); strcpy(ret.retMsg, "parse json error");
return ret; return ret;
} }
if(!cJSON_IsObject(root) || cJSON_GetArraySize(root) == 0) {
int size = cJSON_GetArraySize(root);
if(!cJSON_IsObject(root) || size == 0) {
ret.retCode = -3; ret.retCode = -3;
strcpy(ret.retMsg, "json content is invalid, must be not empty object"); strcpy(ret.retMsg, "json content is invalid, must be not empty object");
return ret; return ret;
} }
int size = cJSON_GetArraySize(root); if(size >= 1000) {
ret.retCode = -6;
strcpy(ret.retMsg, "json object size is too long");
return ret;
}
for(int i = 0; i < size; i++){ for(int i = 0; i < size; i++){
cJSON *item = cJSON_GetArrayItem(root, i); cJSON *item = cJSON_GetArrayItem(root, i);
if(!item) { if(!item) {
...@@ -471,9 +478,11 @@ static setConfRet taos_set_config_imp(const char *config){ ...@@ -471,9 +478,11 @@ static setConfRet taos_set_config_imp(const char *config){
if(!taosReadConfigOption(item->string, item->valuestring, NULL, NULL, TAOS_CFG_CSTATUS_OPTION, TSDB_CFG_CTYPE_B_CLIENT)){ if(!taosReadConfigOption(item->string, item->valuestring, NULL, NULL, TAOS_CFG_CSTATUS_OPTION, TSDB_CFG_CTYPE_B_CLIENT)){
ret.retCode = -1; ret.retCode = -1;
if (strlen(ret.retMsg) == 0){ if (strlen(ret.retMsg) == 0){
sprintf(ret.retMsg, "part error|%s", item->string); snprintf(ret.retMsg, 1000, "part error|%s", item->string);
}else{ }else{
sprintf(ret.retMsg, "%s|%s", ret.retMsg, item->string); char tmp[1024] = {0};
strcpy(tmp, ret.retMsg);
snprintf(ret.retMsg, 1000, "%s|%s", tmp, item->string);
} }
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册