diff --git a/src/plugins/http/inc/httpJson.h b/src/plugins/http/inc/httpJson.h index fcb74253b99c0cd8921d981e3ba7a4a027bf2b31..4d182d0132528367a8e25b8f72329331be2cb5c5 100644 --- a/src/plugins/http/inc/httpJson.h +++ b/src/plugins/http/inc/httpJson.h @@ -63,9 +63,11 @@ void httpJsonString(JsonBuf* buf, char* sVal, int32_t len); void httpJsonOriginString(JsonBuf* buf, char* sVal, int32_t len); void httpJsonStringForTransMean(JsonBuf* buf, char* SVal, int32_t maxLen); void httpJsonInt64(JsonBuf* buf, int64_t num); +void httpJsonUInt64(JsonBuf* buf, uint64_t num); void httpJsonTimestamp(JsonBuf* buf, int64_t t, bool us); void httpJsonUtcTimestamp(JsonBuf* buf, int64_t t, bool us); void httpJsonInt(JsonBuf* buf, int32_t num); +void httpJsonUInt(JsonBuf* buf, uint32_t num); void httpJsonFloat(JsonBuf* buf, float num); void httpJsonDouble(JsonBuf* buf, double num); void httpJsonNull(JsonBuf* buf); diff --git a/src/plugins/http/src/httpJson.c b/src/plugins/http/src/httpJson.c index b120496898c12e4f189337387a5f9fad1fadccbe..19166e720f0e517ccd1a793742836ae4bc245bd1 100644 --- a/src/plugins/http/src/httpJson.c +++ b/src/plugins/http/src/httpJson.c @@ -256,6 +256,12 @@ void httpJsonInt64(JsonBuf* buf, int64_t num) { buf->lst += snprintf(buf->lst, MAX_NUM_STR_SZ, "%" PRId64, num); } +void httpJsonUInt64(JsonBuf* buf, uint64_t num) { + httpJsonItemToken(buf); + httpJsonTestBuf(buf, MAX_NUM_STR_SZ); + buf->lst += snprintf(buf->lst, MAX_NUM_STR_SZ, "%" PRIu64, num); +} + void httpJsonTimestamp(JsonBuf* buf, int64_t t, bool us) { char ts[35] = {0}; struct tm* ptm; @@ -303,6 +309,12 @@ void httpJsonInt(JsonBuf* buf, int32_t num) { buf->lst += snprintf(buf->lst, MAX_NUM_STR_SZ, "%d", num); } +void httpJsonUInt(JsonBuf* buf, uint32_t num) { + httpJsonItemToken(buf); + httpJsonTestBuf(buf, MAX_NUM_STR_SZ); + buf->lst += snprintf(buf->lst, MAX_NUM_STR_SZ, "%u", num); +} + void httpJsonFloat(JsonBuf* buf, float num) { httpJsonItemToken(buf); httpJsonTestBuf(buf, MAX_NUM_STR_SZ); diff --git a/src/plugins/http/src/httpRestJson.c b/src/plugins/http/src/httpRestJson.c index 61a5a361c4865d6b3dbac73773cc0b8cfc562e56..60c23e603e5107e858db2138d1aed87d5f8a5e1b 100644 --- a/src/plugins/http/src/httpRestJson.c +++ b/src/plugins/http/src/httpRestJson.c @@ -162,6 +162,18 @@ bool restBuildSqlJson(HttpContext *pContext, HttpSqlCmd *cmd, TAOS_RES *result, case TSDB_DATA_TYPE_BIGINT: httpJsonInt64(jsonBuf, *((int64_t *)row[i])); break; + case TSDB_DATA_TYPE_UTINYINT: + httpJsonUInt(jsonBuf, *((uint8_t *)row[i])); + break; + case TSDB_DATA_TYPE_USMALLINT: + httpJsonUInt(jsonBuf, *((uint16_t *)row[i])); + break; + case TSDB_DATA_TYPE_UINT: + httpJsonUInt(jsonBuf, *((uint32_t *)row[i])); + break; + case TSDB_DATA_TYPE_UBIGINT: + httpJsonUInt64(jsonBuf, *((uint64_t *)row[i])); + break; case TSDB_DATA_TYPE_FLOAT: httpJsonFloat(jsonBuf, GET_FLOAT_VAL(row[i])); break;