restJson.h 1.9 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 37 38 39 40 41 42 43 44 45 46 47 48 49
/*
 * 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
#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

void restBuildSqlAffectRowsJson(HttpContext *pContext, HttpSqlCmd *cmd, int affect_rows);

void restStartSqlJson(HttpContext *pContext, HttpSqlCmd *cmd, TAOS_RES *result);
bool restBuildSqlJson(HttpContext *pContext, HttpSqlCmd *cmd, TAOS_RES *result, int numOfRows);
bool restBuildSqlTimeJson(HttpContext *pContext, HttpSqlCmd *cmd, TAOS_RES *result, int numOfRows);
void restStopSqlJson(HttpContext *pContext, HttpSqlCmd *cmd);

#endif