[TD-3158]<fix>: replace head_type with column_meta in http response
This commit is contained in:
parent
b627f69c52
commit
9d875dba45
|
@ -34,8 +34,8 @@
|
|||
#define REST_JSON_DATA_LEN 4
|
||||
#define REST_JSON_HEAD "head"
|
||||
#define REST_JSON_HEAD_LEN 4
|
||||
#define REST_JSON_HEAD_TYPE "head_type"
|
||||
#define REST_JSON_HEAD_TYPE_LEN 9
|
||||
#define REST_JSON_HEAD_INFO "column_meta"
|
||||
#define REST_JSON_HEAD_INFO_LEN 11
|
||||
#define REST_JSON_ROWS "rows"
|
||||
#define REST_JSON_ROWS_LEN 4
|
||||
#define REST_JSON_AFFECT_ROWS "affected_rows"
|
||||
|
|
|
@ -75,24 +75,42 @@ void restStartSqlJson(HttpContext *pContext, HttpSqlCmd *cmd, TAOS_RES *result)
|
|||
// head array end
|
||||
httpJsonToken(jsonBuf, JsonArrEnd);
|
||||
|
||||
// head_type begin
|
||||
// column_meta begin
|
||||
httpJsonItemToken(jsonBuf);
|
||||
httpJsonPairHead(jsonBuf, REST_JSON_HEAD_TYPE, REST_JSON_HEAD_TYPE_LEN);
|
||||
// head_type array begin
|
||||
httpJsonPairHead(jsonBuf, REST_JSON_HEAD_INFO, REST_JSON_HEAD_INFO_LEN);
|
||||
// column_meta array begin
|
||||
httpJsonItemToken(jsonBuf);
|
||||
httpJsonToken(jsonBuf, JsonArrStt);
|
||||
|
||||
if (num_fields == 0) {
|
||||
httpJsonItemToken(jsonBuf);
|
||||
httpJsonToken(jsonBuf, JsonArrStt);
|
||||
|
||||
httpJsonItemToken(jsonBuf);
|
||||
httpJsonString(jsonBuf, REST_JSON_AFFECT_ROWS, REST_JSON_AFFECT_ROWS_LEN);
|
||||
httpJsonItemToken(jsonBuf);
|
||||
httpJsonInt(jsonBuf, TSDB_DATA_TYPE_INT);
|
||||
httpJsonItemToken(jsonBuf);
|
||||
httpJsonInt(jsonBuf, 4);
|
||||
|
||||
httpJsonToken(jsonBuf, JsonArrEnd);
|
||||
} else {
|
||||
for (int32_t i = 0; i < num_fields; ++i) {
|
||||
httpJsonItemToken(jsonBuf);
|
||||
httpJsonToken(jsonBuf, JsonArrStt);
|
||||
|
||||
httpJsonItemToken(jsonBuf);
|
||||
httpJsonString(jsonBuf, fields[i].name, (int32_t)strlen(fields[i].name));
|
||||
httpJsonItemToken(jsonBuf);
|
||||
httpJsonInt(jsonBuf, fields[i].type);
|
||||
httpJsonItemToken(jsonBuf);
|
||||
httpJsonInt(jsonBuf, fields[i].bytes);
|
||||
|
||||
httpJsonToken(jsonBuf, JsonArrEnd);
|
||||
}
|
||||
}
|
||||
|
||||
// head_type array end
|
||||
// column_meta array end
|
||||
httpJsonToken(jsonBuf, JsonArrEnd);
|
||||
|
||||
// data begin
|
||||
|
|
Loading…
Reference in New Issue