Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
e5d4d9da
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
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看板
提交
e5d4d9da
编写于
2月 13, 2023
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'main' into fix/liaohj
上级
a13ca296
df496761
变更
5
展开全部
隐藏空白更改
内联
并排
Showing
5 changed file
with
1856 addition
and
74 deletion
+1856
-74
cmake/taostools_CMakeLists.txt.in
cmake/taostools_CMakeLists.txt.in
+1
-1
source/libs/function/src/detail/tminmax.c
source/libs/function/src/detail/tminmax.c
+6
-6
tests/parallel_test/cases.task
tests/parallel_test/cases.task
+4
-0
tests/system-test/2-query/max_min_last_interval.py
tests/system-test/2-query/max_min_last_interval.py
+1711
-0
tools/shell/src/shellAuto.c
tools/shell/src/shellAuto.c
+134
-67
未找到文件。
cmake/taostools_CMakeLists.txt.in
浏览文件 @
e5d4d9da
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
# taos-tools
# taos-tools
ExternalProject_Add(taos-tools
ExternalProject_Add(taos-tools
GIT_REPOSITORY https://github.com/taosdata/taos-tools.git
GIT_REPOSITORY https://github.com/taosdata/taos-tools.git
GIT_TAG
e04f39b
GIT_TAG
22627d7
SOURCE_DIR "${TD_SOURCE_DIR}/tools/taos-tools"
SOURCE_DIR "${TD_SOURCE_DIR}/tools/taos-tools"
BINARY_DIR ""
BINARY_DIR ""
#BUILD_IN_SOURCE TRUE
#BUILD_IN_SOURCE TRUE
...
...
source/libs/function/src/detail/tminmax.c
浏览文件 @
e5d4d9da
...
@@ -372,7 +372,7 @@ static void handleInt8Col(const void* data, int32_t start, int32_t numOfRows, SM
...
@@ -372,7 +372,7 @@ static void handleInt8Col(const void* data, int32_t start, int32_t numOfRows, SM
pBuf
->
v
=
i8VectorCmpAVX2
(
data
,
numOfRows
,
isMinFunc
,
signVal
);
pBuf
->
v
=
i8VectorCmpAVX2
(
data
,
numOfRows
,
isMinFunc
,
signVal
);
}
else
{
}
else
{
if
(
!
pBuf
->
assign
)
{
if
(
!
pBuf
->
assign
)
{
pBuf
->
v
=
((
int8_t
*
)
data
)[
0
];
pBuf
->
v
=
((
int8_t
*
)
data
)[
start
];
}
}
if
(
signVal
)
{
if
(
signVal
)
{
...
@@ -406,7 +406,7 @@ static void handleInt16Col(const void* data, int32_t start, int32_t numOfRows, S
...
@@ -406,7 +406,7 @@ static void handleInt16Col(const void* data, int32_t start, int32_t numOfRows, S
pBuf
->
v
=
i16VectorCmpAVX2
(
data
,
numOfRows
,
isMinFunc
,
signVal
);
pBuf
->
v
=
i16VectorCmpAVX2
(
data
,
numOfRows
,
isMinFunc
,
signVal
);
}
else
{
}
else
{
if
(
!
pBuf
->
assign
)
{
if
(
!
pBuf
->
assign
)
{
pBuf
->
v
=
((
int16_t
*
)
data
)[
0
];
pBuf
->
v
=
((
int16_t
*
)
data
)[
start
];
}
}
if
(
signVal
)
{
if
(
signVal
)
{
...
@@ -440,7 +440,7 @@ static void handleInt32Col(const void* data, int32_t start, int32_t numOfRows, S
...
@@ -440,7 +440,7 @@ static void handleInt32Col(const void* data, int32_t start, int32_t numOfRows, S
pBuf
->
v
=
i32VectorCmpAVX2
(
data
,
numOfRows
,
isMinFunc
,
signVal
);
pBuf
->
v
=
i32VectorCmpAVX2
(
data
,
numOfRows
,
isMinFunc
,
signVal
);
}
else
{
}
else
{
if
(
!
pBuf
->
assign
)
{
if
(
!
pBuf
->
assign
)
{
pBuf
->
v
=
((
int32_t
*
)
data
)[
0
];
pBuf
->
v
=
((
int32_t
*
)
data
)[
start
];
}
}
if
(
signVal
)
{
if
(
signVal
)
{
...
@@ -470,7 +470,7 @@ static void handleInt32Col(const void* data, int32_t start, int32_t numOfRows, S
...
@@ -470,7 +470,7 @@ static void handleInt32Col(const void* data, int32_t start, int32_t numOfRows, S
static
void
handleInt64Col
(
const
void
*
data
,
int32_t
start
,
int32_t
numOfRows
,
SMinmaxResInfo
*
pBuf
,
bool
isMinFunc
,
static
void
handleInt64Col
(
const
void
*
data
,
int32_t
start
,
int32_t
numOfRows
,
SMinmaxResInfo
*
pBuf
,
bool
isMinFunc
,
bool
signVal
)
{
bool
signVal
)
{
if
(
!
pBuf
->
assign
)
{
if
(
!
pBuf
->
assign
)
{
pBuf
->
v
=
((
int64_t
*
)
data
)[
0
];
pBuf
->
v
=
((
int64_t
*
)
data
)[
start
];
}
}
if
(
signVal
)
{
if
(
signVal
)
{
...
@@ -504,7 +504,7 @@ static void handleFloatCol(SColumnInfoData* pCol, int32_t start, int32_t numOfRo
...
@@ -504,7 +504,7 @@ static void handleFloatCol(SColumnInfoData* pCol, int32_t start, int32_t numOfRo
*
val
=
floatVectorCmpAVX
(
pData
,
numOfRows
,
isMinFunc
);
*
val
=
floatVectorCmpAVX
(
pData
,
numOfRows
,
isMinFunc
);
}
else
{
}
else
{
if
(
!
pBuf
->
assign
)
{
if
(
!
pBuf
->
assign
)
{
*
val
=
pData
[
0
];
*
val
=
pData
[
start
];
}
}
if
(
isMinFunc
)
{
// min
if
(
isMinFunc
)
{
// min
...
@@ -535,7 +535,7 @@ static void handleDoubleCol(SColumnInfoData* pCol, int32_t start, int32_t numOfR
...
@@ -535,7 +535,7 @@ static void handleDoubleCol(SColumnInfoData* pCol, int32_t start, int32_t numOfR
*
val
=
(
double
)
doubleVectorCmpAVX
(
pData
,
numOfRows
,
isMinFunc
);
*
val
=
(
double
)
doubleVectorCmpAVX
(
pData
,
numOfRows
,
isMinFunc
);
}
else
{
}
else
{
if
(
!
pBuf
->
assign
)
{
if
(
!
pBuf
->
assign
)
{
*
val
=
pData
[
0
];
*
val
=
pData
[
start
];
}
}
if
(
isMinFunc
)
{
// min
if
(
isMinFunc
)
{
// min
...
...
tests/parallel_test/cases.task
浏览文件 @
e5d4d9da
...
@@ -549,6 +549,7 @@
...
@@ -549,6 +549,7 @@
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/mavg.py -R
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/mavg.py -R
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/max_partition.py
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/max_partition.py
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/max_partition.py -R
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/max_partition.py -R
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/max_min_last_interval.py
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/max.py
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/max.py
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/max.py -R
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/max.py -R
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/min.py
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/min.py
...
@@ -834,6 +835,7 @@
...
@@ -834,6 +835,7 @@
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/function_null.py -Q 2
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/function_null.py -Q 2
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/count_partition.py -Q 2
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/count_partition.py -Q 2
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/max_partition.py -Q 2
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/max_partition.py -Q 2
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/max_min_last_interval.py -Q 2
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/last_row.py -Q 2
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/last_row.py -Q 2
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/tsbsQuery.py -Q 2
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/tsbsQuery.py -Q 2
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/sml.py -Q 2
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/sml.py -Q 2
...
@@ -930,6 +932,7 @@
...
@@ -930,6 +932,7 @@
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/function_null.py -Q 3
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/function_null.py -Q 3
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/count_partition.py -Q 3
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/count_partition.py -Q 3
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/max_partition.py -Q 3
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/max_partition.py -Q 3
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/max_min_last_interval.py -Q 3
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/last_row.py -Q 3
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/last_row.py -Q 3
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/tsbsQuery.py -Q 3
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/tsbsQuery.py -Q 3
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/sml.py -Q 3
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/sml.py -Q 3
...
@@ -1027,6 +1030,7 @@
...
@@ -1027,6 +1030,7 @@
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/function_null.py -Q 4
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/function_null.py -Q 4
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/count_partition.py -Q 4
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/count_partition.py -Q 4
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/max_partition.py -Q 4
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/max_partition.py -Q 4
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/max_min_last_interval.py -Q 4
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/last_row.py -Q 4
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/last_row.py -Q 4
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/tsbsQuery.py -Q 4
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/tsbsQuery.py -Q 4
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/sml.py -Q 4
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/sml.py -Q 4
...
...
tests/system-test/2-query/max_min_last_interval.py
0 → 100644
浏览文件 @
e5d4d9da
此差异已折叠。
点击以展开。
tools/shell/src/shellAuto.c
浏览文件 @
e5d4d9da
...
@@ -32,6 +32,8 @@ void shellShowOnScreen(SShellCmd* cmd);
...
@@ -32,6 +32,8 @@ void shellShowOnScreen(SShellCmd* cmd);
void
shellInsertChar
(
SShellCmd
*
cmd
,
char
*
c
,
int
size
);
void
shellInsertChar
(
SShellCmd
*
cmd
,
char
*
c
,
int
size
);
void
shellInsertStr
(
SShellCmd
*
cmd
,
char
*
str
,
int
size
);
void
shellInsertStr
(
SShellCmd
*
cmd
,
char
*
str
,
int
size
);
bool
appendAfterSelect
(
TAOS
*
con
,
SShellCmd
*
cmd
,
char
*
p
,
int32_t
len
);
bool
appendAfterSelect
(
TAOS
*
con
,
SShellCmd
*
cmd
,
char
*
p
,
int32_t
len
);
char
*
tireSearchWord
(
int
type
,
char
*
pre
);
bool
updateTireValue
(
int
type
,
bool
autoFill
)
;
typedef
struct
SAutoPtr
{
typedef
struct
SAutoPtr
{
STire
*
p
;
STire
*
p
;
...
@@ -60,23 +62,22 @@ SWords shellCommands[] = {
...
@@ -60,23 +62,22 @@ SWords shellCommands[] = {
{
"alter database <db_name> <alter_db_options> <anyword> <alter_db_options> <anyword> <alter_db_options> <anyword> "
{
"alter database <db_name> <alter_db_options> <anyword> <alter_db_options> <anyword> <alter_db_options> <anyword> "
"<alter_db_options> <anyword> <alter_db_options> <anyword> ;"
,
"<alter_db_options> <anyword> <alter_db_options> <anyword> ;"
,
0
,
0
,
NULL
},
0
,
0
,
NULL
},
{
"alter dnode <dnode_id> balance "
,
0
,
0
,
NULL
},
{
"alter dnode <dnode_id>
\"
resetlog
\"
;"
,
0
,
0
,
NULL
},
{
"alter dnode <dnode_id> resetlog;"
,
0
,
0
,
NULL
},
{
"alter dnode <dnode_id>
\"
debugFlag
\"
\"
141
\"
;"
,
0
,
0
,
NULL
},
{
"alter dnode <dnode_id> debugFlag 141;"
,
0
,
0
,
NULL
},
{
"alter dnode <dnode_id>
\"
monitor
\"
\"
0
\"
;"
,
0
,
0
,
NULL
},
{
"alter dnode <dnode_id> monitor 1;"
,
0
,
0
,
NULL
},
{
"alter dnode <dnode_id>
\"
monitor
\"
\"
1
\"
;"
,
0
,
0
,
NULL
},
{
"alter all dnodes monitor "
,
0
,
0
,
NULL
},
{
"alter all dnodes
\"
resetlog
\"
;"
,
0
,
0
,
NULL
},
{
"alter alldnodes balance "
,
0
,
0
,
NULL
},
{
"alter all dnodes
\"
debugFlag
\"
\"
141
\"
;"
,
0
,
0
,
NULL
},
{
"alter alldnodes resetlog;"
,
0
,
0
,
NULL
},
{
"alter all dnodes
\"
monitor
\"
\"
0
\"
;"
,
0
,
0
,
NULL
},
{
"alter alldnodes debugFlag 141;"
,
0
,
0
,
NULL
},
{
"alter all dnodes
\"
monitor
\"
\"
1
\"
;"
,
0
,
0
,
NULL
},
{
"alter alldnodes monitor 1;"
,
0
,
0
,
NULL
},
{
"alter table <tb_name> <tb_actions> <anyword> ;"
,
0
,
0
,
NULL
},
{
"alter table <tb_name> <tb_actions> <anyword> ;"
,
0
,
0
,
NULL
},
{
"alter table modify column"
,
0
,
0
,
NULL
},
{
"alter table modify column"
,
0
,
0
,
NULL
},
{
"alter local
resetlog
;"
,
0
,
0
,
NULL
},
{
"alter local
\"
resetlog
\"
;"
,
0
,
0
,
NULL
},
{
"alter local
DebugFlag 143
;"
,
0
,
0
,
NULL
},
{
"alter local
\"
DebugFlag
\"
\"
143
\"
;"
,
0
,
0
,
NULL
},
{
"alter local
cDebugFlag 143
;"
,
0
,
0
,
NULL
},
{
"alter local
\"
cDebugFlag
\"
\"
143
\"
;"
,
0
,
0
,
NULL
},
{
"alter local
uDebugFlag 143
;"
,
0
,
0
,
NULL
},
{
"alter local
\"
uDebugFlag
\"
\"
143
\"
;"
,
0
,
0
,
NULL
},
{
"alter local
rpcDebugFlag 143
;"
,
0
,
0
,
NULL
},
{
"alter local
\"
rpcDebugFlag
\"
\"
143
\"
;"
,
0
,
0
,
NULL
},
{
"alter local
tmrDebugFlag 143
;"
,
0
,
0
,
NULL
},
{
"alter local
\"
tmrDebugFlag
\"
\"
143
\"
;"
,
0
,
0
,
NULL
},
{
"alter topic"
,
0
,
0
,
NULL
},
{
"alter topic"
,
0
,
0
,
NULL
},
{
"alter user <user_name> <user_actions> <anyword> ;"
,
0
,
0
,
NULL
},
{
"alter user <user_name> <user_actions> <anyword> ;"
,
0
,
0
,
NULL
},
// 20
// 20
...
@@ -108,6 +109,7 @@ SWords shellCommands[] = {
...
@@ -108,6 +109,7 @@ SWords shellCommands[] = {
{
"drop topic <topic_name> ;"
,
0
,
0
,
NULL
},
{
"drop topic <topic_name> ;"
,
0
,
0
,
NULL
},
{
"drop stream <stream_name> ;"
,
0
,
0
,
NULL
},
{
"drop stream <stream_name> ;"
,
0
,
0
,
NULL
},
{
"explain select"
,
0
,
0
,
NULL
},
// 44 append sub sql
{
"explain select"
,
0
,
0
,
NULL
},
// 44 append sub sql
{
"flush database <db_name> ;"
,
0
,
0
,
NULL
},
{
"help;"
,
0
,
0
,
NULL
},
{
"help;"
,
0
,
0
,
NULL
},
{
"grant all on <anyword> to <user_name> ;"
,
0
,
0
,
NULL
},
{
"grant all on <anyword> to <user_name> ;"
,
0
,
0
,
NULL
},
{
"grant read on <anyword> to <user_name> ;"
,
0
,
0
,
NULL
},
{
"grant read on <anyword> to <user_name> ;"
,
0
,
0
,
NULL
},
...
@@ -121,7 +123,6 @@ SWords shellCommands[] = {
...
@@ -121,7 +123,6 @@ SWords shellCommands[] = {
{
"revoke read on <anyword> from <user_name> ;"
,
0
,
0
,
NULL
},
{
"revoke read on <anyword> from <user_name> ;"
,
0
,
0
,
NULL
},
{
"revoke write on <anyword> from <user_name> ;"
,
0
,
0
,
NULL
},
{
"revoke write on <anyword> from <user_name> ;"
,
0
,
0
,
NULL
},
{
"select * from <all_table>"
,
0
,
0
,
NULL
},
{
"select * from <all_table>"
,
0
,
0
,
NULL
},
{
"select _block_dist() from <all_table>
\\
G;"
,
0
,
0
,
NULL
},
{
"select client_version();"
,
0
,
0
,
NULL
},
{
"select client_version();"
,
0
,
0
,
NULL
},
// 60
// 60
{
"select current_user();"
,
0
,
0
,
NULL
},
{
"select current_user();"
,
0
,
0
,
NULL
},
...
@@ -247,7 +248,7 @@ char* db_options[] = {"keep ",
...
@@ -247,7 +248,7 @@ char* db_options[] = {"keep ",
"wal_retention_size "
,
"wal_retention_size "
,
"wal_segment_size "
};
"wal_segment_size "
};
char
*
alter_db_options
[]
=
{
"
keep "
,
"cachemodel "
,
"cachesize "
,
"wal_fsync_period "
,
"wal_level "
};
char
*
alter_db_options
[]
=
{
"
cachemodel "
,
"replica "
,
"keep "
,
"cachesize "
,
"wal_fsync_period "
,
"wal_level "
};
char
*
data_types
[]
=
{
"timestamp"
,
"int"
,
char
*
data_types
[]
=
{
"timestamp"
,
"int"
,
"int unsigned"
,
"varchar(16)"
,
"int unsigned"
,
"varchar(16)"
,
...
@@ -262,6 +263,14 @@ char* key_tags[] = {"tags("};
...
@@ -262,6 +263,14 @@ char* key_tags[] = {"tags("};
char
*
key_select
[]
=
{
"select "
};
char
*
key_select
[]
=
{
"select "
};
char
*
key_systable
[]
=
{
"ins_dnodes"
,
"ins_mnodes"
,
"ins_modules"
,
"ins_qnodes"
,
"ins_snodes"
,
"ins_cluster"
,
"ins_databases"
,
"ins_functions"
,
"ins_indexes"
,
"ins_stables"
,
"ins_tables"
,
"ins_tags"
,
"ins_users"
,
"ins_grants"
,
"ins_vgroups"
,
"ins_configs"
,
"ins_dnode_variables"
,
"ins_topics"
,
"ins_subscriptions"
,
"ins_streams"
,
"ins_stream_tasks"
,
"ins_vnodes"
,
"ins_user_privileges"
,
"perf_connections"
,
"perf_queries"
,
"perf_consumers"
,
"perf_trans"
,
"perf_apps"
};
//
//
// ------- gobal variant define ---------
// ------- gobal variant define ---------
//
//
...
@@ -293,8 +302,9 @@ bool waitAutoFill = false;
...
@@ -293,8 +302,9 @@ bool waitAutoFill = false;
#define WT_VAR_TBOPTION 16
#define WT_VAR_TBOPTION 16
#define WT_VAR_USERACTION 17
#define WT_VAR_USERACTION 17
#define WT_VAR_KEYSELECT 18
#define WT_VAR_KEYSELECT 18
#define WT_VAR_SYSTABLE 19
#define WT_VAR_CNT
19
#define WT_VAR_CNT
20
#define WT_FROM_DB_MAX 6 // max get content from db
#define WT_FROM_DB_MAX 6 // max get content from db
#define WT_FROM_DB_CNT (WT_FROM_DB_MAX + 1)
#define WT_FROM_DB_CNT (WT_FROM_DB_MAX + 1)
...
@@ -327,19 +337,19 @@ int cntDel = 0; // delete byte count after next press tab
...
@@ -327,19 +337,19 @@ int cntDel = 0; // delete byte count after next press tab
// show auto tab introduction
// show auto tab introduction
void
printfIntroduction
()
{
void
printfIntroduction
()
{
printf
(
"
****************************** Tab Completion
**********************************
\n
"
);
printf
(
"
****************************** Tab Completion ***
**********************************
\n
"
);
printf
(
"
* The TDengine CLI supports tab completion for a variety of items,
*
\n
"
);
printf
(
"
* The TDengine CLI supports tab completion for a variety of items,
*
\n
"
);
printf
(
"
* including database names, table names, function names and keywords.
*
\n
"
);
printf
(
"
* including database names, table names, function names and keywords.
*
\n
"
);
printf
(
"
* The full list of shortcut keys is as follows:
*
\n
"
);
printf
(
"
* The full list of shortcut keys is as follows:
*
\n
"
);
printf
(
"
* [ TAB ] ...... complete the current word
*
\n
"
);
printf
(
"
* [ TAB ] ...... complete the current word
*
\n
"
);
printf
(
"
* ...... if used on a blank line, display all valid commands
*
\n
"
);
printf
(
"
* ...... if used on a blank line, display all supported commands
*
\n
"
);
printf
(
"
* [ Ctrl + A ] ...... move cursor to the st[A]rt of the line
*
\n
"
);
printf
(
"
* [ Ctrl + A ] ...... move cursor to the st[A]rt of the line
*
\n
"
);
printf
(
"
* [ Ctrl + E ] ...... move cursor to the [E]nd of the line
*
\n
"
);
printf
(
"
* [ Ctrl + E ] ...... move cursor to the [E]nd of the line
*
\n
"
);
printf
(
"
* [ Ctrl + W ] ...... move cursor to the middle of the line
*
\n
"
);
printf
(
"
* [ Ctrl + W ] ...... move cursor to the middle of the line
*
\n
"
);
printf
(
"
* [ Ctrl + L ] ...... clear the entire screen
*
\n
"
);
printf
(
"
* [ Ctrl + L ] ...... clear the entire screen
*
\n
"
);
printf
(
"
* [ Ctrl + K ] ...... clear the screen after the cursor
*
\n
"
);
printf
(
"
* [ Ctrl + K ] ...... clear the screen after the cursor
*
\n
"
);
printf
(
"
* [ Ctrl + U ] ...... clear the screen before the cursor
*
\n
"
);
printf
(
"
* [ Ctrl + U ] ...... clear the screen before the cursor
*
\n
"
);
printf
(
"
**********************************************************************************
\n\n
"
);
printf
(
"
***
**********************************************************************************
\n\n
"
);
}
}
void
showHelp
()
{
void
showHelp
()
{
...
@@ -348,23 +358,24 @@ void showHelp() {
...
@@ -348,23 +358,24 @@ void showHelp() {
"
\n
\
"
\n
\
----- A -----
\n
\
----- A -----
\n
\
alter database <db_name> <db_options>
\n
\
alter database <db_name> <db_options>
\n
\
alter dnode <dnode_id> balance
\n
\
alter dnode <dnode_id> 'resetlog';
\n
\
alter dnode <dnode_id> resetlog;
\n
\
alter dnode <dnode_id> 'monitor' '0';
\n
\
alter all dnodes monitor
\n
\
alter dnode <dnode_id> 'monitor'
\"
1
\"
;
\n
\
alter alldnodes balance
\n
\
alter dnode <dnode_id>
\"
debugflag
\"
\"
143
\"
;
\n
\
alter alldnodes resetlog;
\n
\
alter all dnodes
\"
monitor
\"
\"
0
\"
;
\n
\
alter alldnodes debugFlag
\n
\
alter all dnodes
\"
monitor
\"
\"
1
\"
;
\n
\
alter alldnodes monitor
\n
\
alter all dnodes
\"
resetlog
\"
;
\n
\
alter all dnodes
\"
debugFlag
\"
\n
\
alter table <tb_name> <tb_actions> ;
\n
\
alter table <tb_name> <tb_actions> ;
\n
\
alter table modify column
\n
\
alter table modify column
\n
\
alter local
resetlog
;
\n
\
alter local
\"
resetlog
\"
;
\n
\
alter local
DebugFlag 143
;
\n
\
alter local
\"
DebugFlag
\"
\"
143
\"
;
\n
\
alter topic
\n
\
alter topic
\n
\
alter user <user_name> <user_actions> ...
\n
\
alter user <user_name> <user_actions> ...
\n
\
----- C -----
\n
\
----- C -----
\n
\
create table <tb_name> using <stb_name> tags ...
\n
\
create table <tb_name> using <stb_name> tags ...
\n
\
create database <db_name> <db_options> ...
\n
\
create database <db_name> <db_options> ...
\n
\
create dnode
...
\
n
\
create dnode
\"
fqdn:port
\"
n\
create index ...
\n
\
create index ...
\n
\
create mnode on dnode <dnode_id> ;
\n
\
create mnode on dnode <dnode_id> ;
\n
\
create qnode on dnode <dnode_id> ;
\n
\
create qnode on dnode <dnode_id> ;
\n
\
...
@@ -387,6 +398,8 @@ void showHelp() {
...
@@ -387,6 +398,8 @@ void showHelp() {
drop stream <stream_name> ;
\n
\
drop stream <stream_name> ;
\n
\
----- E -----
\n
\
----- E -----
\n
\
explain select clause ...
\n
\
explain select clause ...
\n
\
----- F -----
\n
\
flush database <db_name>;
\n
\
----- H -----
\n
\
----- H -----
\n
\
help;
\n
\
help;
\n
\
----- I -----
\n
\
----- I -----
\n
\
...
@@ -409,7 +422,6 @@ void showHelp() {
...
@@ -409,7 +422,6 @@ void showHelp() {
revoke write on <priv_level> from <user_name> ;
\n
\
revoke write on <priv_level> from <user_name> ;
\n
\
----- S -----
\n
\
----- S -----
\n
\
select * from <all_table> where ...
\n
\
select * from <all_table> where ...
\n
\
select _block_dist() from <all_table>;
\n
\
select client_version();
\n
\
select client_version();
\n
\
select current_user();
\n
\
select current_user();
\n
\
select database();
\n
\
select database();
\n
\
...
@@ -619,12 +631,17 @@ bool shellAutoInit() {
...
@@ -619,12 +631,17 @@ bool shellAutoInit() {
GenerateVarType
(
WT_VAR_TBOPTION
,
tb_options
,
sizeof
(
tb_options
)
/
sizeof
(
char
*
));
GenerateVarType
(
WT_VAR_TBOPTION
,
tb_options
,
sizeof
(
tb_options
)
/
sizeof
(
char
*
));
GenerateVarType
(
WT_VAR_USERACTION
,
user_actions
,
sizeof
(
user_actions
)
/
sizeof
(
char
*
));
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_KEYSELECT
,
key_select
,
sizeof
(
key_select
)
/
sizeof
(
char
*
));
GenerateVarType
(
WT_VAR_SYSTABLE
,
key_systable
,
sizeof
(
key_systable
)
/
sizeof
(
char
*
));
return
true
;
return
true
;
}
}
// set conn
// set conn
void
shellSetConn
(
TAOS
*
conn
)
{
varCon
=
conn
;
}
void
shellSetConn
(
TAOS
*
conn
)
{
varCon
=
conn
;
// init database and stable
updateTireValue
(
WT_VAR_DBNAME
,
false
);
}
// exit shell auto funciton, shell exit call once
// exit shell auto funciton, shell exit call once
void
shellAutoExit
()
{
void
shellAutoExit
()
{
...
@@ -800,9 +817,42 @@ void* varObtainThread(void* param) {
...
@@ -800,9 +817,42 @@ void* varObtainThread(void* param) {
return
NULL
;
return
NULL
;
}
}
// return true is need update value by async
bool
updateTireValue
(
int
type
,
bool
autoFill
)
{
// TYPE CONTEXT GET FROM DB
taosThreadMutexLock
(
&
tiresMutex
);
// check need obtain from server
if
(
tires
[
type
]
==
NULL
)
{
waitAutoFill
=
autoFill
;
// need async obtain var names from db sever
if
(
threads
[
type
]
!=
NULL
)
{
if
(
taosThreadRunning
(
threads
[
type
]))
{
// thread running , need not obtain again, return
taosThreadMutexUnlock
(
&
tiresMutex
);
return
NULL
;
}
// destroy previous thread handle for new create thread handle
taosDestroyThread
(
threads
[
type
]);
threads
[
type
]
=
NULL
;
}
// create new
void
*
param
=
taosMemoryMalloc
(
sizeof
(
int
));
*
((
int
*
)
param
)
=
type
;
threads
[
type
]
=
taosCreateThread
(
varObtainThread
,
param
);
taosThreadMutexUnlock
(
&
tiresMutex
);
return
true
;
}
taosThreadMutexUnlock
(
&
tiresMutex
);
return
false
;
}
// only match next one word from all match words, return valuue must free by caller
// only match next one word from all match words, return valuue must free by caller
char
*
matchNextPrefix
(
STire
*
tire
,
char
*
pre
)
{
char
*
matchNextPrefix
(
STire
*
tire
,
char
*
pre
)
{
SMatch
*
match
=
NULL
;
SMatch
*
match
=
NULL
;
if
(
tire
==
NULL
)
return
NULL
;
// re-use last result
// re-use last result
if
(
lastMatch
)
{
if
(
lastMatch
)
{
...
@@ -888,32 +938,9 @@ char* tireSearchWord(int type, char* pre) {
...
@@ -888,32 +938,9 @@ char* tireSearchWord(int type, char* pre) {
return
matchNextPrefix
(
tire
,
pre
);
return
matchNextPrefix
(
tire
,
pre
);
}
}
// TYPE CONTEXT GET FROM DB
if
(
updateTireValue
(
type
,
true
))
{
taosThreadMutexLock
(
&
tiresMutex
);
// check need obtain from server
if
(
tires
[
type
]
==
NULL
)
{
waitAutoFill
=
true
;
// need async obtain var names from db sever
if
(
threads
[
type
]
!=
NULL
)
{
if
(
taosThreadRunning
(
threads
[
type
]))
{
// thread running , need not obtain again, return
taosThreadMutexUnlock
(
&
tiresMutex
);
return
NULL
;
}
// destroy previous thread handle for new create thread handle
taosDestroyThread
(
threads
[
type
]);
threads
[
type
]
=
NULL
;
}
// create new
void
*
param
=
taosMemoryMalloc
(
sizeof
(
int
));
*
((
int
*
)
param
)
=
type
;
threads
[
type
]
=
taosCreateThread
(
varObtainThread
,
param
);
taosThreadMutexUnlock
(
&
tiresMutex
);
return
NULL
;
return
NULL
;
}
}
taosThreadMutexUnlock
(
&
tiresMutex
);
// can obtain var names from local
// can obtain var names from local
STire
*
tire
=
getAutoPtr
(
type
);
STire
*
tire
=
getAutoPtr
(
type
);
...
@@ -1116,6 +1143,7 @@ void printScreen(TAOS* con, SShellCmd* cmd, SWords* match) {
...
@@ -1116,6 +1143,7 @@ void printScreen(TAOS* con, SShellCmd* cmd, SWords* match) {
// main key press tab , matched return true else false
// main key press tab , matched return true else false
bool
firstMatchCommand
(
TAOS
*
con
,
SShellCmd
*
cmd
)
{
bool
firstMatchCommand
(
TAOS
*
con
,
SShellCmd
*
cmd
)
{
if
(
con
==
NULL
||
cmd
==
NULL
)
return
false
;
// parse command
// parse command
SWords
*
input
=
(
SWords
*
)
taosMemoryMalloc
(
sizeof
(
SWords
));
SWords
*
input
=
(
SWords
*
)
taosMemoryMalloc
(
sizeof
(
SWords
));
memset
(
input
,
0
,
sizeof
(
SWords
));
memset
(
input
,
0
,
sizeof
(
SWords
));
...
@@ -1660,6 +1688,41 @@ bool matchOther(TAOS* con, SShellCmd* cmd) {
...
@@ -1660,6 +1688,41 @@ bool matchOther(TAOS* con, SShellCmd* cmd) {
return
false
;
return
false
;
}
}
// last match if nothing matched
bool
matchEnd
(
TAOS
*
con
,
SShellCmd
*
cmd
)
{
// str dump
bool
ret
=
false
;
char
*
ps
=
strndup
(
cmd
->
command
,
cmd
->
commandSize
);
char
*
last
=
lastWord
(
ps
);
char
*
elast
=
strrchr
(
last
,
'.'
);
// find end last
if
(
elast
)
{
last
=
elast
+
1
;
}
// less one char can match
if
(
strlen
(
last
)
==
0
)
{
goto
_return
;
}
// match database
if
(
elast
==
NULL
)
{
// dot need not completed with dbname
if
(
fillWithType
(
con
,
cmd
,
last
,
WT_VAR_DBNAME
))
{
ret
=
true
;
goto
_return
;
}
}
if
(
fillWithType
(
con
,
cmd
,
last
,
WT_VAR_SYSTABLE
))
{
ret
=
true
;
goto
_return
;
}
_return:
taosMemoryFree
(
ps
);
return
ret
;
}
// main key press tab
// main key press tab
void
pressTabKey
(
SShellCmd
*
cmd
)
{
void
pressTabKey
(
SShellCmd
*
cmd
)
{
// check
// check
...
@@ -1695,6 +1758,9 @@ void pressTabKey(SShellCmd* cmd) {
...
@@ -1695,6 +1758,9 @@ void pressTabKey(SShellCmd* cmd) {
matched
=
matchSelectQuery
(
varCon
,
cmd
);
matched
=
matchSelectQuery
(
varCon
,
cmd
);
if
(
matched
)
return
;
if
(
matched
)
return
;
// match end
matched
=
matchEnd
(
varCon
,
cmd
);
return
;
return
;
}
}
...
@@ -1911,6 +1977,7 @@ void callbackAutoTab(char* sqlstr, TAOS* pSql, bool usedb) {
...
@@ -1911,6 +1977,7 @@ void callbackAutoTab(char* sqlstr, TAOS* pSql, bool usedb) {
if
(
dealUseDB
(
sql
))
{
if
(
dealUseDB
(
sql
))
{
// change to new db
// change to new db
updateTireValue
(
WT_VAR_STABLE
,
false
);
return
;
return
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录