tmsgtype.h 4.7 KB
Newer Older
陶建辉(Jeff)'s avatar
陶建辉(Jeff) 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
/*
 * 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/>.
 */

16 17
#ifndef _TD_COMMON_SQLMSGTYPE_H_
#define _TD_COMMON_SQLMSGTYPE_H_
陶建辉(Jeff)'s avatar
陶建辉(Jeff) 已提交
18 19 20 21 22 23 24 25 26

#ifdef __cplusplus
extern "C" {
#endif

// sql type

#ifdef TSDB_SQL_C
#define TSDB_DEFINE_SQL_TYPE( name, msg ) msg, 
H
Haojun Liao 已提交
27
char *sqlMsgType[] = {
陶建辉(Jeff)'s avatar
陶建辉(Jeff) 已提交
28 29 30 31 32 33 34 35 36 37
  "null",
#else
#define TSDB_DEFINE_SQL_TYPE( name, msg ) name,
enum {
  TSDB_SQL_NULL = 0,
#endif

  TSDB_DEFINE_SQL_TYPE( TSDB_SQL_SELECT, "select" )
  TSDB_DEFINE_SQL_TYPE( TSDB_SQL_FETCH, "fetch" )
  TSDB_DEFINE_SQL_TYPE( TSDB_SQL_INSERT, "insert" )
H
Haojun Liao 已提交
38
  TSDB_DEFINE_SQL_TYPE( TSDB_SQL_UPDATE_TAG_VAL, "update-tag-val" )
39

陶建辉(Jeff)'s avatar
陶建辉(Jeff) 已提交
40 41 42 43
  // the SQL below is for mgmt node
  TSDB_DEFINE_SQL_TYPE( TSDB_SQL_MGMT, "mgmt" )
  TSDB_DEFINE_SQL_TYPE( TSDB_SQL_CREATE_DB, "create-db" )
  TSDB_DEFINE_SQL_TYPE( TSDB_SQL_CREATE_TABLE, "create-table" )
D
dapan1121 已提交
44
  TSDB_DEFINE_SQL_TYPE( TSDB_SQL_CREATE_FUNCTION, "create-function" )  
陶建辉(Jeff)'s avatar
陶建辉(Jeff) 已提交
45 46
  TSDB_DEFINE_SQL_TYPE( TSDB_SQL_DROP_DB, "drop-db" )
  TSDB_DEFINE_SQL_TYPE( TSDB_SQL_DROP_TABLE, "drop-table" )
D
dapan1121 已提交
47
  TSDB_DEFINE_SQL_TYPE( TSDB_SQL_DROP_FUNCTION, "drop-function" )
陶建辉(Jeff)'s avatar
陶建辉(Jeff) 已提交
48 49 50 51 52 53 54 55
  TSDB_DEFINE_SQL_TYPE( TSDB_SQL_CREATE_ACCT, "create-acct" )
  TSDB_DEFINE_SQL_TYPE( TSDB_SQL_CREATE_USER, "create-user" ) 
  TSDB_DEFINE_SQL_TYPE( TSDB_SQL_DROP_ACCT, "drop-acct" )
  TSDB_DEFINE_SQL_TYPE( TSDB_SQL_DROP_USER, "drop-user" )
  TSDB_DEFINE_SQL_TYPE( TSDB_SQL_ALTER_USER, "alter-user" )
  TSDB_DEFINE_SQL_TYPE( TSDB_SQL_ALTER_ACCT, "alter-acct" )
  TSDB_DEFINE_SQL_TYPE( TSDB_SQL_ALTER_TABLE, "alter-table" )
  TSDB_DEFINE_SQL_TYPE( TSDB_SQL_ALTER_DB, "alter-db" )
Y
yihaoDeng 已提交
56
 
H
Haojun Liao 已提交
57
  TSDB_DEFINE_SQL_TYPE( TSDB_SQL_SYNC_DB_REPLICA, "sync db-replica")
陶建辉(Jeff)'s avatar
陶建辉(Jeff) 已提交
58 59 60 61 62 63 64
  TSDB_DEFINE_SQL_TYPE( TSDB_SQL_CREATE_MNODE, "create-mnode" )
  TSDB_DEFINE_SQL_TYPE( TSDB_SQL_DROP_MNODE, "drop-mnode" )
  TSDB_DEFINE_SQL_TYPE( TSDB_SQL_CREATE_DNODE, "create-dnode" )
  TSDB_DEFINE_SQL_TYPE( TSDB_SQL_DROP_DNODE, "drop-dnode" )
  TSDB_DEFINE_SQL_TYPE( TSDB_SQL_CFG_DNODE, "cfg-dnode" )
  TSDB_DEFINE_SQL_TYPE( TSDB_SQL_CFG_MNODE, "cfg-mnode" )
  TSDB_DEFINE_SQL_TYPE( TSDB_SQL_SHOW, "show" )
H
Haojun Liao 已提交
65
  TSDB_DEFINE_SQL_TYPE( TSDB_SQL_RETRIEVE_MNODE, "retrieve" )
陶建辉(Jeff)'s avatar
陶建辉(Jeff) 已提交
66 67 68
  TSDB_DEFINE_SQL_TYPE( TSDB_SQL_KILL_QUERY, "kill-query" )
  TSDB_DEFINE_SQL_TYPE( TSDB_SQL_KILL_STREAM, "kill-stream" )
  TSDB_DEFINE_SQL_TYPE( TSDB_SQL_KILL_CONNECTION, "kill-connection" )
Y
yihaoDeng 已提交
69
  TSDB_DEFINE_SQL_TYPE( TSDB_SQL_COMPACT_VNODE, "compact-vnode" )
陶建辉(Jeff)'s avatar
陶建辉(Jeff) 已提交
70 71 72 73 74 75 76 77 78

  // SQL below is for read operation
  TSDB_DEFINE_SQL_TYPE( TSDB_SQL_READ, "read" )  
  TSDB_DEFINE_SQL_TYPE( TSDB_SQL_CONNECT, "connect" )
  TSDB_DEFINE_SQL_TYPE( TSDB_SQL_USE_DB, "use-db" )
  TSDB_DEFINE_SQL_TYPE( TSDB_SQL_META, "meta" )
  TSDB_DEFINE_SQL_TYPE( TSDB_SQL_STABLEVGROUP, "stable-vgroup" )
  TSDB_DEFINE_SQL_TYPE( TSDB_SQL_MULTI_META, "multi-meta" )
  TSDB_DEFINE_SQL_TYPE( TSDB_SQL_HB, "heart-beat" )
H
Haojun Liao 已提交
79
  TSDB_DEFINE_SQL_TYPE( TSDB_SQL_RETRIEVE_FUNC, "retrieve-function" )
陶建辉(Jeff)'s avatar
陶建辉(Jeff) 已提交
80 81 82 83

  // SQL below for client local 
  TSDB_DEFINE_SQL_TYPE( TSDB_SQL_LOCAL, "local" ) 
  TSDB_DEFINE_SQL_TYPE( TSDB_SQL_DESCRIBE_TABLE, "describe-table" )
84
  TSDB_DEFINE_SQL_TYPE( TSDB_SQL_RETRIEVE_GLOBALMERGE, "retrieve-globalmerge" )
陶建辉(Jeff)'s avatar
陶建辉(Jeff) 已提交
85 86
  TSDB_DEFINE_SQL_TYPE( TSDB_SQL_TABLE_JOIN_RETRIEVE, "join-retrieve" )

87
  TSDB_DEFINE_SQL_TYPE( TSDB_SQL_SHOW_CREATE_TABLE, "show-create-table")
88
  TSDB_DEFINE_SQL_TYPE( TSDB_SQL_SHOW_CREATE_STABLE, "show-create-stable")
89 90
  TSDB_DEFINE_SQL_TYPE( TSDB_SQL_SHOW_CREATE_DATABASE, "show-create-database")

91
  // build empty result instead of accessing dnode to fetch result reset the client cache
陶建辉(Jeff)'s avatar
陶建辉(Jeff) 已提交
92 93
  TSDB_DEFINE_SQL_TYPE( TSDB_SQL_RETRIEVE_EMPTY_RESULT, "retrieve-empty-result" )

94 95 96
  TSDB_DEFINE_SQL_TYPE( TSDB_SQL_RESET_CACHE,  "reset-cache" )
  TSDB_DEFINE_SQL_TYPE( TSDB_SQL_SERV_STATUS,  "serv-status" )
  TSDB_DEFINE_SQL_TYPE( TSDB_SQL_CURRENT_DB,   "current-db" )
陶建辉(Jeff)'s avatar
陶建辉(Jeff) 已提交
97
  TSDB_DEFINE_SQL_TYPE( TSDB_SQL_SERV_VERSION, "serv-version" )
98
  TSDB_DEFINE_SQL_TYPE( TSDB_SQL_CLI_VERSION,  "cli-version" )
陶建辉(Jeff)'s avatar
陶建辉(Jeff) 已提交
99
  TSDB_DEFINE_SQL_TYPE( TSDB_SQL_CURRENT_USER, "current-user ")
100
  TSDB_DEFINE_SQL_TYPE( TSDB_SQL_CFG_LOCAL,    "cfg-local" )
陶建辉(Jeff)'s avatar
陶建辉(Jeff) 已提交
101 102 103 104 105

  TSDB_DEFINE_SQL_TYPE( TSDB_SQL_MAX, "max" )
};

// create table operation type
H
Haojun Liao 已提交
106 107
enum TSQL_CREATE_TABLE_TYPE {
  TSQL_CREATE_TABLE  = 0x1,
陶建辉(Jeff)'s avatar
陶建辉(Jeff) 已提交
108
  TSQL_CREATE_STABLE = 0x2,
H
Haojun Liao 已提交
109
  TSQL_CREATE_CTABLE = 0x3,
陶建辉(Jeff)'s avatar
陶建辉(Jeff) 已提交
110 111 112 113 114 115 116
  TSQL_CREATE_STREAM = 0x4,
};

#ifdef __cplusplus
}
#endif

117
#endif  /*_TD_COMMON_SQLMSGTYPE_H_*/