Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
f95f6c9f
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1184
Star
22015
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
f95f6c9f
编写于
3月 25, 2023
作者:
A
Alex Duan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: auto tab add create function
上级
d4c63827
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
33 addition
and
26 deletion
+33
-26
tools/shell/src/shellAuto.c
tools/shell/src/shellAuto.c
+33
-26
未找到文件。
tools/shell/src/shellAuto.c
浏览文件 @
f95f6c9f
...
...
@@ -92,7 +92,7 @@ SWords shellCommands[] = {
{
"create qnode on dnode <dnode_id> ;"
,
0
,
0
,
NULL
},
{
"create stream <anyword> into <anyword> as select"
,
0
,
0
,
NULL
},
// 26 append sub sql
{
"create topic <anyword> as select"
,
0
,
0
,
NULL
},
// 27 append sub sql
{
"create function "
,
0
,
0
,
NULL
},
{
"create function
<anyword> as <anyword> outputtype <data_types> language <language>
"
,
0
,
0
,
NULL
},
{
"create user <anyword> pass <anyword> sysinfo 0;"
,
0
,
0
,
NULL
},
{
"create user <anyword> pass <anyword> sysinfo 1;"
,
0
,
0
,
NULL
},
{
"describe <all_table>"
,
0
,
0
,
NULL
},
...
...
@@ -105,7 +105,7 @@ SWords shellCommands[] = {
{
"drop qnode on dnode <dnode_id> ;"
,
0
,
0
,
NULL
},
{
"drop user <user_name> ;"
,
0
,
0
,
NULL
},
// 40
{
"drop function"
,
0
,
0
,
NULL
},
{
"drop function
<udf_name> ;
"
,
0
,
0
,
NULL
},
{
"drop consumer group <anyword> on "
,
0
,
0
,
NULL
},
{
"drop topic <topic_name> ;"
,
0
,
0
,
NULL
},
{
"drop stream <stream_name> ;"
,
0
,
0
,
NULL
},
...
...
@@ -272,6 +272,8 @@ char* key_systable[] = {
"ins_subscriptions"
,
"ins_streams"
,
"ins_stream_tasks"
,
"ins_vnodes"
,
"ins_user_privileges"
,
"perf_connections"
,
"perf_queries"
,
"perf_consumers"
,
"perf_trans"
,
"perf_apps"
};
char
*
language
[]
=
{
"
\'
Python
\'
"
,
"
\'
C
\'
"
}
//
// ------- global variant define ---------
//
...
...
@@ -291,25 +293,29 @@ bool waitAutoFill = false;
#define WT_VAR_USERNAME 4
#define WT_VAR_TOPIC 5
#define WT_VAR_STREAM 6
#define WT_VAR_ALLTABLE 7
#define WT_VAR_FUNC 8
#define WT_VAR_KEYWORD 9
#define WT_VAR_TBACTION 10
#define WT_VAR_DBOPTION 11
#define WT_VAR_ALTER_DBOPTION 12
#define WT_VAR_DATATYPE 13
#define WT_VAR_KEYTAGS 14
#define WT_VAR_ANYWORD 15
#define WT_VAR_TBOPTION 16
#define WT_VAR_USERACTION 17
#define WT_VAR_KEYSELECT 18
#define WT_VAR_SYSTABLE 19
#define WT_VAR_CNT 20
#define WT_FROM_DB_MAX 6 // max get content from db
#define WT_VAR_UDFNAME 7
#define WT_FROM_DB_MAX 7 // max get content from db
#define WT_FROM_DB_CNT (WT_FROM_DB_MAX + 1)
#define WT_VAR_ALLTABLE 8
#define WT_VAR_FUNC 9
#define WT_VAR_KEYWORD 10
#define WT_VAR_TBACTION 11
#define WT_VAR_DBOPTION 12
#define WT_VAR_ALTER_DBOPTION 13
#define WT_VAR_DATATYPE 14
#define WT_VAR_KEYTAGS 15
#define WT_VAR_ANYWORD 16
#define WT_VAR_TBOPTION 17
#define WT_VAR_USERACTION 18
#define WT_VAR_KEYSELECT 19
#define WT_VAR_SYSTABLE 20
#define WT_VAR_LANGUAGE 21
#define WT_VAR_CNT 22
#define WT_TEXT 0xFF
char
dbName
[
256
]
=
""
;
// save use database name;
...
...
@@ -319,13 +325,13 @@ TdThreadMutex tiresMutex;
// save thread handle obtain var name from db server
TdThread
*
threads
[
WT_FROM_DB_CNT
];
// obtain var name with sql from server
char
varTypes
[
WT_VAR_CNT
][
64
]
=
{
"<db_name>"
,
"<stb_name>"
,
"<tb_name>"
,
"<dnode_id>"
,
"<user_name>"
,
"<topic_name>"
,
"<stream_name>"
,
"<all_table>"
,
"<function>"
,
"<keyword
>"
,
"<tb_actions>"
,
"<db_options>"
,
"<alter_db_options>"
,
"<data_types>"
,
"<key_tag
s>"
,
"<anyword>"
,
"<tb_options>"
,
"<user_actions>"
,
"<key_select>
"
};
char
varTypes
[
WT_VAR_CNT
][
64
]
=
{
"<db_name>"
,
"<stb_name>"
,
"<tb_name>"
,
"<dnode_id >"
,
"<user_name>"
,
"<topic_name>"
,
"<stream_name
>"
,
"<udf_name>"
,
"<all_table>"
,
"<function>"
,
"<keyword>"
,
"<tb_actions>"
,
"<db_options>"
,
"<alter_db_option
s>"
,
"<data_types>"
,
"<key_tags>"
,
"<anyword>"
,
"<tb_options>"
,
"<user_actions>"
,
"<key_select>"
,
"sys_table"
,
"language
"
};
char
varSqls
[
WT_FROM_DB_CNT
][
64
]
=
{
"show databases;"
,
"show stables;"
,
"show tables;"
,
"show dnodes;"
,
"show users;"
,
"show topics;"
,
"show streams;"
};
"show users;"
,
"show topics;"
,
"show streams;"
,
"show functions;"
};
// var words current cursor, if user press any one key except tab, cursorVar can be reset to -1
int
cursorVar
=
-
1
;
...
...
@@ -390,7 +396,7 @@ void showHelp() {
create qnode on dnode <dnode_id> ;
\n
\
create stream <stream_name> into <stb_name> as select ...
\n
\
create topic <topic_name> as select ...
\n
\
create function
...
\n
\
create function
<udf_name> as <file_name> outputtype <data_types> language
\'
C
\'
|
\'
Python
\'
;
\n
\
create user <user_name> pass <password> ...
\n
\
----- D -----
\n
\
describe <all_table>
\n
\
...
...
@@ -401,7 +407,7 @@ void showHelp() {
drop mnode on dnode <dnode_id> ;
\n
\
drop qnode on dnode <dnode_id> ;
\n
\
drop user <user_name> ;
\n
\
drop function <
function
_name>;
\n
\
drop function <
udf
_name>;
\n
\
drop consumer group ...
\n
\
drop topic <topic_name> ;
\n
\
drop stream <stream_name> ;
\n
\
...
...
@@ -643,6 +649,7 @@ bool shellAutoInit() {
GenerateVarType
(
WT_VAR_USERACTION
,
user_actions
,
sizeof
(
user_actions
)
/
sizeof
(
char
*
));
GenerateVarType
(
WT_VAR_KEYSELECT
,
key_select
,
sizeof
(
key_select
)
/
sizeof
(
char
*
));
GenerateVarType
(
WT_VAR_SYSTABLE
,
key_systable
,
sizeof
(
key_systable
)
/
sizeof
(
char
*
));
GenerateVarType
(
WT_VAR_LANGUAGE
,
key_systable
,
sizeof
(
language
)
/
sizeof
(
char
*
));
return
true
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录