From af7e3ffa29d2b8ef7e6f732edb3ad87fb9b53929 Mon Sep 17 00:00:00 2001 From: liu0x54 Date: Thu, 7 May 2020 15:03:33 +0000 Subject: [PATCH] [TD-228] fix python connector to support binary interface change --- src/plugins/http/src/gcJson.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/plugins/http/src/gcJson.c b/src/plugins/http/src/gcJson.c index 09990c123e..98069f434d 100644 --- a/src/plugins/http/src/gcJson.c +++ b/src/plugins/http/src/gcJson.c @@ -121,6 +121,7 @@ bool gcBuildQueryJson(HttpContext *pContext, HttpSqlCmd *cmd, TAOS_RES *result, for (int k = 0; k < numOfRows; ++k) { TAOS_ROW row = taos_fetch_row(result); + int32_t* length = taos_fetch_lengths(result); // for group by if (groupFields != -1) { @@ -150,7 +151,11 @@ bool gcBuildQueryJson(HttpContext *pContext, HttpSqlCmd *cmd, TAOS_RES *result, break; case TSDB_DATA_TYPE_BINARY: case TSDB_DATA_TYPE_NCHAR: - len += snprintf(target + len, HTTP_GC_TARGET_SIZE - len, "%s:%s", fields[i].name, (char *)row[i]); + if (row[i]!= NULL){ + len += snprintf(target + len, HTTP_GC_TARGET_SIZE - len, "%s:", fields[i].name); + memcpy(target + len, (char *) row[i], length[i]); + len = strlen(target); + } break; default: len += snprintf(target + len, HTTP_GC_TARGET_SIZE - len, "%s:%s", fields[i].name, "-"); -- GitLab