httpRestJson.h 2.2 KB
Newer Older
H
hzcheng 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
/*
 * Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
 *
 * This program is free software: you can use, redistribute, and/or modify
 * it under the terms of the GNU Affero General Public License, version 3
 * or later ("AGPL"), as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef TDENGINE_REST_JSON_H
#define TDENGINE_REST_JSON_H
#include <stdbool.h>
#include "httpHandle.h"
#include "httpJson.h"
#include "taos.h"

#define REST_JSON_SUCCESS        "succ"
#define REST_JSON_SUCCESS_LEN    4
#define REST_JSON_FAILURE        "error"
#define REST_JSON_FAILURE_LEN    5
#define REST_JSON_STATUS         "status"
#define REST_JSON_STATUS_LEN     6
#define REST_JSON_CODE           "code"
#define REST_JSON_CODE_LEN       4
#define REST_JSON_DESC           "desc"
#define REST_JSON_DESC_LEN       4
#define REST_JSON_DATA           "data"
#define REST_JSON_DATA_LEN       4
#define REST_JSON_HEAD           "head"
#define REST_JSON_HEAD_LEN       4
37 38
#define REST_JSON_HEAD_INFO      "column_meta"
#define REST_JSON_HEAD_INFO_LEN  11
H
hzcheng 已提交
39 40 41 42 43
#define REST_JSON_ROWS           "rows"
#define REST_JSON_ROWS_LEN       4
#define REST_JSON_AFFECT_ROWS    "affected_rows"
#define REST_JSON_AFFECT_ROWS_LEN 13

S
slguan 已提交
44
#define REST_TIMESTAMP_FMT_LOCAL_STRING 0
S
slguan 已提交
45 46
#define REST_TIMESTAMP_FMT_TIMESTAMP    1
#define REST_TIMESTAMP_FMT_UTC_STRING   2
S
slguan 已提交
47

S
TD-1311  
Shengliang Guan 已提交
48
void restBuildSqlAffectRowsJson(HttpContext *pContext, HttpSqlCmd *cmd, int32_t affect_rows);
H
hzcheng 已提交
49 50

void restStartSqlJson(HttpContext *pContext, HttpSqlCmd *cmd, TAOS_RES *result);
S
TD-1311  
Shengliang Guan 已提交
51 52 53
bool restBuildSqlTimestampJson(HttpContext *pContext, HttpSqlCmd *cmd, TAOS_RES *result, int32_t numOfRows);
bool restBuildSqlLocalTimeStringJson(HttpContext *pContext, HttpSqlCmd *cmd, TAOS_RES *result, int32_t numOfRows);
bool restBuildSqlUtcTimeStringJson(HttpContext *pContext, HttpSqlCmd *cmd, TAOS_RES *result, int32_t numOfRows);
H
hzcheng 已提交
54 55
void restStopSqlJson(HttpContext *pContext, HttpSqlCmd *cmd);

56
#endif