Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
45ef1c74
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,发现更多精彩内容 >>
未验证
提交
45ef1c74
编写于
1月 07, 2023
作者:
S
Shengliang Guan
提交者:
GitHub
1月 07, 2023
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #19402 from taosdata/chore/sangshuduo/TD-19391-oem-support
chore: prompt support
上级
5c3eaad3
a2fcbde7
变更
13
隐藏空白更改
内联
并排
Showing
13 changed file
with
72 addition
and
362 deletion
+72
-362
packaging/release.sh
packaging/release.sh
+0
-319
source/dnode/mgmt/node_mgmt/src/dmNodes.c
source/dnode/mgmt/node_mgmt/src/dmNodes.c
+3
-3
source/os/src/osLocale.c
source/os/src/osLocale.c
+1
-1
source/os/src/osString.c
source/os/src/osString.c
+3
-3
tools/shell/CMakeLists.txt
tools/shell/CMakeLists.txt
+4
-0
tools/shell/inc/shellAuto.h
tools/shell/inc/shellAuto.h
+2
-2
tools/shell/inc/shellInt.h
tools/shell/inc/shellInt.h
+3
-2
tools/shell/inc/shellTire.h
tools/shell/inc/shellTire.h
+1
-1
tools/shell/src/shellArguments.c
tools/shell/src/shellArguments.c
+25
-10
tools/shell/src/shellAuto.c
tools/shell/src/shellAuto.c
+21
-13
tools/shell/src/shellEngine.c
tools/shell/src/shellEngine.c
+3
-2
tools/shell/src/shellUtil.c
tools/shell/src/shellUtil.c
+5
-5
tools/shell/src/shellWebsocket.c
tools/shell/src/shellWebsocket.c
+1
-1
未找到文件。
packaging/release.sh
已删除
100755 → 0
浏览文件 @
5c3eaad3
#!/bin/bash
#
# Generate the deb package for ubuntu, or rpm package for centos, or tar.gz package for other linux os
set
-e
# set -x
# release.sh -v [cluster | edge]
# -c [aarch32 | aarch64 | x64 | x86 | mips64 | loongarch64...]
# -o [Linux | Kylin | Alpine | Raspberrypi | Darwin | Windows | Ningsi60 | Ningsi80 |...]
# -V [stable | beta]
# -l [full | lite]
# -s [static | dynamic]
# -d [taos | ...]
# -n [2.0.0.3]
# -m [2.0.0.0]
# -H [ false | true]
# set parameters by default value
verMode
=
edge
# [cluster, edge, cloud]
verType
=
stable
# [stable, beta]
cpuType
=
x64
# [aarch32 | aarch64 | x64 | x86 | mips64 loongarch64...]
osType
=
Linux
# [Linux | Kylin | Alpine | Raspberrypi | Darwin | Windows | Ningsi60 | Ningsi80 |...]
pagMode
=
full
# [full | lite]
soMode
=
dynamic
# [static | dynamic]
dbName
=
taos
# [taos | ...]
allocator
=
glibc
# [glibc | jemalloc]
verNumber
=
""
verNumberComp
=
"3.0.0.0"
httpdBuild
=
false
while
getopts
"hv:V:c:o:l:s:d:a:n:m:H:"
arg
;
do
case
$arg
in
v
)
#echo "verMode=$OPTARG"
verMode
=
$(
echo
$OPTARG
)
;;
V
)
#echo "verType=$OPTARG"
verType
=
$(
echo
$OPTARG
)
;;
c
)
#echo "cpuType=$OPTARG"
cpuType
=
$(
echo
$OPTARG
)
;;
l
)
#echo "pagMode=$OPTARG"
pagMode
=
$(
echo
$OPTARG
)
;;
s
)
#echo "soMode=$OPTARG"
soMode
=
$(
echo
$OPTARG
)
;;
d
)
#echo "dbName=$OPTARG"
dbName
=
$(
echo
$OPTARG
)
;;
a
)
#echo "allocator=$OPTARG"
allocator
=
$(
echo
$OPTARG
)
;;
n
)
#echo "verNumber=$OPTARG"
verNumber
=
$(
echo
$OPTARG
)
;;
m
)
#echo "verNumberComp=$OPTARG"
verNumberComp
=
$(
echo
$OPTARG
)
;;
o
)
#echo "osType=$OPTARG"
osType
=
$(
echo
$OPTARG
)
;;
H
)
#echo "httpdBuild=$OPTARG"
httpdBuild
=
$(
echo
$OPTARG
)
;;
h
)
echo
"Usage:
$(
basename
$0
)
-v [cluster | edge] "
echo
" -c [aarch32 | aarch64 | x64 | x86 | mips64 | loongarch64 ...] "
echo
" -o [Linux | Kylin | Alpine | Raspberrypi | Darwin | Windows | Ningsi60 | Ningsi80 |...] "
echo
" -V [stable | beta] "
echo
" -l [full | lite] "
echo
" -a [glibc | jemalloc] "
echo
" -s [static | dynamic] "
echo
" -d [taos | ...] "
echo
" -n [version number] "
echo
" -m [compatible version number] "
echo
" -H [false | true] "
exit
0
;;
?
)
#unknow option
echo
"unkonw argument"
exit
1
;;
esac
done
osType
=
$(
uname
)
echo
"verMode=
${
verMode
}
verType=
${
verType
}
cpuType=
${
cpuType
}
osType=
${
osType
}
pagMode=
${
pagMode
}
soMode=
${
soMode
}
dbName=
${
dbName
}
allocator=
${
allocator
}
verNumber=
${
verNumber
}
verNumberComp=
${
verNumberComp
}
httpdBuild=
${
httpdBuild
}
"
curr_dir
=
$(
pwd
)
if
[
"
$osType
"
==
"Darwin"
]
;
then
script_dir
=
$(
dirname
$0
)
cd
${
script_dir
}
script_dir
=
"
$(
pwd
)
"
top_dir
=
${
script_dir
}
/..
else
script_dir
=
"
$(
dirname
$(
readlink
-f
$0
))
"
top_dir
=
"
$(
readlink
-f
${
script_dir
}
/..
)
"
fi
csudo
=
""
#if command -v sudo > /dev/null; then
# csudo="sudo "
#fi
function
is_valid_version
()
{
[
-z
$1
]
&&
return
1
||
:
rx
=
'^([0-9]+\.){3}(\*|[0-9]+)$'
if
[[
$1
=
~
$rx
]]
;
then
return
0
fi
return
1
}
function
vercomp
()
{
if
[[
$1
==
$2
]]
;
then
echo
0
exit
0
fi
local
IFS
=
.
local
i
ver1
=(
$1
)
ver2
=(
$2
)
# fill empty fields in ver1 with zeros
for
((
i
=
${#
ver1
[@]
}
;
i <
${#
ver2
[@]
}
;
i++
))
;
do
ver1[i]
=
0
done
for
((
i
=
0
;
i <
${#
ver1
[@]
}
;
i++
))
;
do
if
[[
-z
${
ver2
[i]
}
]]
;
then
# fill empty fields in ver2 with zeros
ver2[i]
=
0
fi
if
((
10#
${
ver1
[i]
}
>
10#
${
ver2
[i]
}
))
;
then
echo
1
exit
0
fi
if
((
10#
${
ver1
[i]
}
< 10#
${
ver2
[i]
}
))
;
then
echo
2
exit
0
fi
done
echo
0
}
# 1. check version information
if
(
(!
is_valid_version
$verNumber
)
||
(!
is_valid_version
$verNumberComp
)
||
[[
"
$(
vercomp
$verNumber
$verNumberComp
)
"
==
'2'
]])
;
then
echo
"please enter correct version"
exit
0
fi
echo
"=======================new version number:
${
verNumber
}
, compatible version:
${
verNumberComp
}
======================================"
build_time
=
$(
date
+
"%F %R"
)
# get commint id from git
gitinfo
=
$(
git rev-parse
--verify
HEAD
)
if
[[
"
$verMode
"
==
"cluster"
]]
||
[[
"
$verMode
"
==
"cloud"
]]
;
then
enterprise_dir
=
"
${
top_dir
}
/../enterprise"
cd
${
enterprise_dir
}
gitinfoOfInternal
=
$(
git rev-parse
--verify
HEAD
)
else
gitinfoOfInternal
=
NULL
fi
cd
"
${
curr_dir
}
"
# 2. cmake executable file
compile_dir
=
"
${
top_dir
}
/debug"
if
[
-d
${
compile_dir
}
]
;
then
rm
-rf
${
compile_dir
}
fi
mkdir
-p
${
compile_dir
}
cd
${
compile_dir
}
if
[[
"
$allocator
"
==
"jemalloc"
]]
;
then
allocator_macro
=
"-DJEMALLOC_ENABLED=true"
else
allocator_macro
=
""
fi
if
[[
"
$dbName
"
!=
"taos"
]]
;
then
source
${
enterprise_dir
}
/packaging/oem/sed_
$dbName
.sh
replace_community_
$dbName
fi
if
[[
"
$httpdBuild
"
==
"true"
]]
;
then
BUILD_HTTP
=
true
else
BUILD_HTTP
=
false
fi
if
[[
"
$verMode
"
==
"cluster"
]]
||
[[
"
$verMode
"
==
"cloud"
]]
;
then
BUILD_HTTP
=
internal
fi
if
[[
"
$pagMode
"
==
"full"
]]
;
then
BUILD_TOOLS
=
true
else
BUILD_TOOLS
=
false
fi
# check support cpu type
if
[[
"
$cpuType
"
==
"x64"
]]
||
[[
"
$cpuType
"
==
"aarch64"
]]
||
[[
"
$cpuType
"
==
"aarch32"
]]
||
[[
"
$cpuType
"
==
"arm64"
]]
||
[[
"
$cpuType
"
==
"arm32"
]]
||
[[
"
$cpuType
"
==
"mips64"
]]
||
[[
"
$cpuType
"
==
"loongarch64"
]]
;
then
if
[
"
$verMode
"
==
"edge"
]
;
then
# community-version compile
cmake ../
-DCPUTYPE
=
${
cpuType
}
-DWEBSOCKET
=
true
-DOSTYPE
=
${
osType
}
-DSOMODE
=
${
soMode
}
-DDBNAME
=
${
dbName
}
-DVERTYPE
=
${
verType
}
-DVERDATE
=
"
${
build_time
}
"
-DGITINFO
=
${
gitinfo
}
-DGITINFOI
=
${
gitinfoOfInternal
}
-DVERNUMBER
=
${
verNumber
}
-DVERCOMPATIBLE
=
${
verNumberComp
}
-DPAGMODE
=
${
pagMode
}
-DBUILD_HTTP
=
${
BUILD_HTTP
}
-DBUILD_TOOLS
=
${
BUILD_TOOLS
}
${
allocator_macro
}
elif
[
"
$verMode
"
==
"cloud"
]
;
then
cmake ../../
-DCPUTYPE
=
${
cpuType
}
-DWEBSOCKET
=
true
-DBUILD_TAOSX
=
true
-DBUILD_CLOUD
=
true
-DOSTYPE
=
${
osType
}
-DSOMODE
=
${
soMode
}
-DDBNAME
=
${
dbName
}
-DVERTYPE
=
${
verType
}
-DVERDATE
=
"
${
build_time
}
"
-DGITINFO
=
${
gitinfo
}
-DGITINFOI
=
${
gitinfoOfInternal
}
-DVERNUMBER
=
${
verNumber
}
-DVERCOMPATIBLE
=
${
verNumberComp
}
-DBUILD_HTTP
=
${
BUILD_HTTP
}
-DBUILD_TOOLS
=
${
BUILD_TOOLS
}
${
allocator_macro
}
elif
[
"
$verMode
"
==
"cluster"
]
;
then
if
[[
"
$dbName
"
!=
"taos"
]]
;
then
replace_enterprise_
$dbName
fi
cmake ../../
-DCPUTYPE
=
${
cpuType
}
-DWEBSOCKET
=
true
-DBUILD_TAOSX
=
true
-DOSTYPE
=
${
osType
}
-DSOMODE
=
${
soMode
}
-DDBNAME
=
${
dbName
}
-DVERTYPE
=
${
verType
}
-DVERDATE
=
"
${
build_time
}
"
-DGITINFO
=
${
gitinfo
}
-DGITINFOI
=
${
gitinfoOfInternal
}
-DVERNUMBER
=
${
verNumber
}
-DVERCOMPATIBLE
=
${
verNumberComp
}
-DBUILD_HTTP
=
${
BUILD_HTTP
}
-DBUILD_TOOLS
=
${
BUILD_TOOLS
}
${
allocator_macro
}
fi
else
echo
"input cpuType=
${
cpuType
}
error!!!"
exit
1
fi
ostype
=
`
uname
`
if
[
"
${
ostype
}
"
==
"Darwin"
]
;
then
CORES
=
$(
sysctl
-n
hw.ncpu
)
else
CORES
=
$(
grep
-c
^processor /proc/cpuinfo
)
fi
if
[[
"
$allocator
"
==
"jemalloc"
]]
;
then
# jemalloc need compile first, so disable parallel build
make
-j
${
CORES
}
&&
${
csudo
}
make
install
else
make
-j
${
CORES
}
&&
${
csudo
}
make
install
fi
cd
${
curr_dir
}
# 3. Call the corresponding script for packaging
if
[
"
$osType
"
!=
"Darwin"
]
;
then
if
[[
"
$verMode
"
!=
"cluster"
]]
&&
[[
"
$verMode
"
!=
"cloud"
]]
&&
[[
"
$pagMode
"
==
"full"
]]
&&
[[
"
$cpuType
"
==
"x64"
]]
&&
[[
"
$dbName
"
==
"taos"
]]
;
then
ret
=
'0'
command
-v
dpkg
>
/dev/null 2>&1
||
{
ret
=
'1'
;
}
if
[
"
$ret
"
-eq
0
]
;
then
echo
"====do deb package for the ubuntu system===="
output_dir
=
"
${
top_dir
}
/debs"
if
[
-d
${
output_dir
}
]
;
then
rm
-rf
${
output_dir
}
fi
mkdir
-p
${
output_dir
}
cd
${
script_dir
}
/deb
${
csudo
}
./makedeb.sh
${
compile_dir
}
${
output_dir
}
${
verNumber
}
${
cpuType
}
${
osType
}
${
verMode
}
${
verType
}
if
[[
"
$pagMode
"
==
"full"
]]
;
then
if
[
-d
${
top_dir
}
/tools/taos-tools/packaging/deb
]
;
then
cd
${
top_dir
}
/tools/taos-tools/packaging/deb
taos_tools_ver
=
$(
git tag |grep
-v
taos |
sort
|
tail
-1
)
[
-z
"
$taos_tools_ver
"
]
&&
taos_tools_ver
=
"0.1.0"
${
csudo
}
./make-taos-tools-deb.sh
${
top_dir
}
\
${
compile_dir
}
${
output_dir
}
${
taos_tools_ver
}
${
cpuType
}
${
osType
}
${
verMode
}
${
verType
}
fi
fi
else
echo
"==========dpkg command not exist, so not release deb package!!!"
fi
ret
=
'0'
command
-v
rpmbuild
>
/dev/null 2>&1
||
{
ret
=
'1'
;
}
if
[
"
$ret
"
-eq
0
]
;
then
echo
"====do rpm package for the centos system===="
output_dir
=
"
${
top_dir
}
/rpms"
if
[
-d
${
output_dir
}
]
;
then
rm
-rf
${
output_dir
}
fi
mkdir
-p
${
output_dir
}
cd
${
script_dir
}
/rpm
${
csudo
}
./makerpm.sh
${
compile_dir
}
${
output_dir
}
${
verNumber
}
${
cpuType
}
${
osType
}
${
verMode
}
${
verType
}
if
[[
"
$pagMode
"
==
"full"
]]
;
then
if
[
-d
${
top_dir
}
/tools/taos-tools/packaging/rpm
]
;
then
cd
${
top_dir
}
/tools/taos-tools/packaging/rpm
taos_tools_ver
=
$(
git tag |grep
-v
taos |
sort
|
tail
-1
)
[
-z
"
$taos_tools_ver
"
]
&&
taos_tools_ver
=
"0.1.0"
${
csudo
}
./make-taos-tools-rpm.sh
${
top_dir
}
\
${
compile_dir
}
${
output_dir
}
${
taos_tools_ver
}
${
cpuType
}
${
osType
}
${
verMode
}
${
verType
}
fi
fi
else
echo
"==========rpmbuild command not exist, so not release rpm package!!!"
fi
fi
echo
"====do tar.gz package for all systems===="
cd
${
script_dir
}
/tools
${
csudo
}
./makepkg.sh
${
compile_dir
}
${
verNumber
}
"
${
build_time
}
"
${
cpuType
}
${
osType
}
${
verMode
}
${
verType
}
${
pagMode
}
${
verNumberComp
}
${
dbName
}
${
csudo
}
./makeclient.sh
${
compile_dir
}
${
verNumber
}
"
${
build_time
}
"
${
cpuType
}
${
osType
}
${
verMode
}
${
verType
}
${
pagMode
}
${
dbName
}
else
cd
${
script_dir
}
/tools
./makepkg.sh
${
compile_dir
}
${
verNumber
}
"
${
build_time
}
"
${
cpuType
}
${
osType
}
${
verMode
}
${
verType
}
${
pagMode
}
${
verNumberComp
}
${
dbName
}
./makeclient.sh
${
compile_dir
}
${
verNumber
}
"
${
build_time
}
"
${
cpuType
}
${
osType
}
${
verMode
}
${
verType
}
${
pagMode
}
${
dbName
}
fi
source/dnode/mgmt/node_mgmt/src/dmNodes.c
浏览文件 @
45ef1c74
...
@@ -109,8 +109,8 @@ static int32_t dmStartNodes(SDnode *pDnode) {
...
@@ -109,8 +109,8 @@ static int32_t dmStartNodes(SDnode *pDnode) {
}
}
}
}
dInfo
(
"T
Dengine
initialized successfully"
);
dInfo
(
"T
he daemon
initialized successfully"
);
dmReportStartup
(
"T
Dengine
"
,
"initialized successfully"
);
dmReportStartup
(
"T
he daemon
"
,
"initialized successfully"
);
return
0
;
return
0
;
}
}
...
@@ -142,7 +142,7 @@ int32_t dmRunDnode(SDnode *pDnode) {
...
@@ -142,7 +142,7 @@ int32_t dmRunDnode(SDnode *pDnode) {
while
(
1
)
{
while
(
1
)
{
if
(
pDnode
->
stop
)
{
if
(
pDnode
->
stop
)
{
dInfo
(
"T
Dengine
is about to stop"
);
dInfo
(
"T
he daemon
is about to stop"
);
dmSetStatus
(
pDnode
,
DND_STAT_STOPPED
);
dmSetStatus
(
pDnode
,
DND_STAT_STOPPED
);
dmStopNodes
(
pDnode
);
dmStopNodes
(
pDnode
);
dmCloseNodes
(
pDnode
);
dmCloseNodes
(
pDnode
);
...
...
source/os/src/osLocale.c
浏览文件 @
45ef1c74
...
@@ -71,7 +71,7 @@ char *taosCharsetReplace(char *charsetstr) {
...
@@ -71,7 +71,7 @@ char *taosCharsetReplace(char *charsetstr) {
* seems does not response as expected.
* seems does not response as expected.
*
*
* In some Linux systems, setLocale(LC_CTYPE, "") may return NULL, in which case the launch of
* In some Linux systems, setLocale(LC_CTYPE, "") may return NULL, in which case the launch of
* both the
TDengine
Server and the Client may be interrupted.
* both the Server and the Client may be interrupted.
*
*
* In case that the setLocale failed to be executed, the right charset needs to be set.
* In case that the setLocale failed to be executed, the right charset needs to be set.
*/
*/
...
...
source/os/src/osString.c
浏览文件 @
45ef1c74
...
@@ -217,7 +217,7 @@ void taosReleaseConv(int32_t idx, iconv_t conv, ConvType type) {
...
@@ -217,7 +217,7 @@ void taosReleaseConv(int32_t idx, iconv_t conv, ConvType type) {
bool
taosMbsToUcs4
(
const
char
*
mbs
,
size_t
mbsLength
,
TdUcs4
*
ucs4
,
int32_t
ucs4_max_len
,
int32_t
*
len
)
{
bool
taosMbsToUcs4
(
const
char
*
mbs
,
size_t
mbsLength
,
TdUcs4
*
ucs4
,
int32_t
ucs4_max_len
,
int32_t
*
len
)
{
#ifdef DISALLOW_NCHAR_WITHOUT_ICONV
#ifdef DISALLOW_NCHAR_WITHOUT_ICONV
printf
(
"Nchar cannot be read and written without iconv, please install iconv library and recompile
TDengine
.
\n
"
);
printf
(
"Nchar cannot be read and written without iconv, please install iconv library and recompile.
\n
"
);
return
-
1
;
return
-
1
;
#else
#else
memset
(
ucs4
,
0
,
ucs4_max_len
);
memset
(
ucs4
,
0
,
ucs4_max_len
);
...
@@ -245,7 +245,7 @@ bool taosMbsToUcs4(const char *mbs, size_t mbsLength, TdUcs4 *ucs4, int32_t ucs4
...
@@ -245,7 +245,7 @@ bool taosMbsToUcs4(const char *mbs, size_t mbsLength, TdUcs4 *ucs4, int32_t ucs4
int32_t
taosUcs4ToMbs
(
TdUcs4
*
ucs4
,
int32_t
ucs4_max_len
,
char
*
mbs
)
{
int32_t
taosUcs4ToMbs
(
TdUcs4
*
ucs4
,
int32_t
ucs4_max_len
,
char
*
mbs
)
{
#ifdef DISALLOW_NCHAR_WITHOUT_ICONV
#ifdef DISALLOW_NCHAR_WITHOUT_ICONV
printf
(
"Nchar cannot be read and written without iconv, please install iconv library and recompile
TDengine
.
\n
"
);
printf
(
"Nchar cannot be read and written without iconv, please install iconv library and recompile.
\n
"
);
return
-
1
;
return
-
1
;
#else
#else
...
@@ -263,7 +263,7 @@ int32_t taosUcs4ToMbs(TdUcs4 *ucs4, int32_t ucs4_max_len, char *mbs) {
...
@@ -263,7 +263,7 @@ int32_t taosUcs4ToMbs(TdUcs4 *ucs4, int32_t ucs4_max_len, char *mbs) {
}
}
bool
taosValidateEncodec
(
const
char
*
encodec
)
{
bool
taosValidateEncodec
(
const
char
*
encodec
)
{
#ifdef DISALLOW_NCHAR_WITHOUT_ICONV
#ifdef DISALLOW_NCHAR_WITHOUT_ICONV
printf
(
"Nchar cannot be read and written without iconv, please install iconv library and recompile
TDengine
.
\n
"
);
printf
(
"Nchar cannot be read and written without iconv, please install iconv library and recompile.
\n
"
);
return
true
;
return
true
;
#else
#else
iconv_t
cd
=
iconv_open
(
encodec
,
DEFAULT_UNICODE_ENCODEC
);
iconv_t
cd
=
iconv_open
(
encodec
,
DEFAULT_UNICODE_ENCODEC
);
...
...
tools/shell/CMakeLists.txt
浏览文件 @
45ef1c74
...
@@ -26,6 +26,10 @@ ELSE ()
...
@@ -26,6 +26,10 @@ ELSE ()
SET
(
LINK_WEBSOCKET
""
)
SET
(
LINK_WEBSOCKET
""
)
ENDIF
()
ENDIF
()
IF
(
CUS_NAME OR CUS_PROMPT
)
ADD_DEFINITIONS
(
-I
${
CMAKE_CURRENT_SOURCE_DIR
}
/../../../enterprise/packaging
)
ENDIF
(
CUS_NAME
)
if
(
TD_WINDOWS
)
if
(
TD_WINDOWS
)
target_link_libraries
(
shell PUBLIC taos_static
${
LINK_WEBSOCKET
}
)
target_link_libraries
(
shell PUBLIC taos_static
${
LINK_WEBSOCKET
}
)
else
()
else
()
...
...
tools/shell/inc/shellAuto.h
浏览文件 @
45ef1c74
...
@@ -24,13 +24,13 @@ void pressTabKey(SShellCmd* cmd);
...
@@ -24,13 +24,13 @@ void pressTabKey(SShellCmd* cmd);
// press othr key
// press othr key
void
pressOtherKey
(
char
c
);
void
pressOtherKey
(
char
c
);
// init shell auto func
it
on , shell start call once
// init shell auto func
ti
on , shell start call once
bool
shellAutoInit
();
bool
shellAutoInit
();
// set conn
// set conn
void
shellSetConn
(
TAOS
*
conn
);
void
shellSetConn
(
TAOS
*
conn
);
// exit shell auto func
it
on, shell exit call once
// exit shell auto func
ti
on, shell exit call once
void
shellAutoExit
();
void
shellAutoExit
();
// callback autotab module
// callback autotab module
...
...
tools/shell/inc/shellInt.h
浏览文件 @
45ef1c74
...
@@ -80,8 +80,9 @@ typedef struct {
...
@@ -80,8 +80,9 @@ typedef struct {
}
SShellArgs
;
}
SShellArgs
;
typedef
struct
{
typedef
struct
{
const
char
*
clientVersion
;
const
char
*
clientVersion
;
const
char
*
promptHeader
;
char
cusName
[
32
];
char
promptHeader
[
32
];
const
char
*
promptContinue
;
const
char
*
promptContinue
;
const
char
*
osname
;
const
char
*
osname
;
int32_t
promptSize
;
int32_t
promptSize
;
...
...
tools/shell/inc/shellTire.h
浏览文件 @
45ef1c74
...
@@ -19,7 +19,7 @@
...
@@ -19,7 +19,7 @@
//
//
// The prefix search tree is a efficient storage words and search words tree, it support 95 visible ascii code character
// The prefix search tree is a efficient storage words and search words tree, it support 95 visible ascii code character
//
//
#define FIRST_ASCII 40 // first visi
a
ble char is '0'
#define FIRST_ASCII 40 // first visible char is '0'
#define LAST_ASCII 122 // last visilbe char is 'z'
#define LAST_ASCII 122 // last visilbe char is 'z'
// capacity save char is 95
// capacity save char is 95
...
...
tools/shell/src/shellArguments.c
浏览文件 @
45ef1c74
...
@@ -19,10 +19,25 @@
...
@@ -19,10 +19,25 @@
#include "shellInt.h"
#include "shellInt.h"
#define TAOS_CONSOLE_PROMPT_HEADER "taos> "
#ifndef CUS_NAME
char
cusName
[]
=
"TDengine"
;
#endif
#ifndef CUS_PROMPT
char
cusPrompt
[]
=
"taos"
;
#endif
#ifndef CUS_EMAIL
char
cusEmail
[]
=
"<support@taosdata.com>"
;
#endif
#if defined(CUS_NAME) || defined(CUS_PROMPT) || defined(CUS_EMAIL)
#include "cus_name.h"
#endif
#define TAOS_CONSOLE_PROMPT_CONTINUE " -> "
#define TAOS_CONSOLE_PROMPT_CONTINUE " -> "
#define SHELL_HOST "T
Dengin
e server FQDN to connect. The default host is localhost."
#define SHELL_HOST "T
h
e server FQDN to connect. The default host is localhost."
#define SHELL_PORT "The TCP/IP port number to use for the connection."
#define SHELL_PORT "The TCP/IP port number to use for the connection."
#define SHELL_USER "The user name to use when connecting to the server."
#define SHELL_USER "The user name to use when connecting to the server."
#define SHELL_PASSWORD "The password to use when connecting to the server."
#define SHELL_PASSWORD "The password to use when connecting to the server."
...
@@ -41,7 +56,6 @@
...
@@ -41,7 +56,6 @@
#define SHELL_PKT_LEN "Packet length used for net test, default is 1024 bytes."
#define SHELL_PKT_LEN "Packet length used for net test, default is 1024 bytes."
#define SHELL_PKT_NUM "Packet numbers used for net test, default is 100."
#define SHELL_PKT_NUM "Packet numbers used for net test, default is 100."
#define SHELL_VERSION "Print program version."
#define SHELL_VERSION "Print program version."
#define SHELL_EMAIL "<support@taosdata.com>"
#ifdef WEBSOCKET
#ifdef WEBSOCKET
#define SHELL_DSN "The dsn to use when connecting to cloud server."
#define SHELL_DSN "The dsn to use when connecting to cloud server."
...
@@ -78,7 +92,7 @@ void shellPrintHelp() {
...
@@ -78,7 +92,7 @@ void shellPrintHelp() {
#endif
#endif
printf
(
"%s%s%s%s
\r\n
"
,
indent
,
"-w,"
,
indent
,
SHELL_WIDTH
);
printf
(
"%s%s%s%s
\r\n
"
,
indent
,
"-w,"
,
indent
,
SHELL_WIDTH
);
printf
(
"%s%s%s%s
\r\n
"
,
indent
,
"-V,"
,
indent
,
SHELL_VERSION
);
printf
(
"%s%s%s%s
\r\n
"
,
indent
,
"-V,"
,
indent
,
SHELL_VERSION
);
printf
(
"
\r\n\r\n
Report bugs to %s.
\r\n
"
,
SHELL_EMAIL
);
printf
(
"
\r\n\r\n
Report bugs to %s.
\r\n
"
,
cusEmail
);
}
}
#ifdef LINUX
#ifdef LINUX
...
@@ -86,7 +100,7 @@ void shellPrintHelp() {
...
@@ -86,7 +100,7 @@ void shellPrintHelp() {
#include <termio.h>
#include <termio.h>
const
char
*
argp_program_version
=
version
;
const
char
*
argp_program_version
=
version
;
const
char
*
argp_program_bug_address
=
SHELL_EMAIL
;
const
char
*
argp_program_bug_address
=
cusEmail
;
static
struct
argp_option
shellOptions
[]
=
{
static
struct
argp_option
shellOptions
[]
=
{
{
"host"
,
'h'
,
"HOST"
,
0
,
SHELL_HOST
},
{
"host"
,
'h'
,
"HOST"
,
0
,
SHELL_HOST
},
...
@@ -388,12 +402,13 @@ static int32_t shellCheckArgs() {
...
@@ -388,12 +402,13 @@ static int32_t shellCheckArgs() {
int32_t
shellParseArgs
(
int32_t
argc
,
char
*
argv
[])
{
int32_t
shellParseArgs
(
int32_t
argc
,
char
*
argv
[])
{
shellInitArgs
(
argc
,
argv
);
shellInitArgs
(
argc
,
argv
);
shell
.
info
.
clientVersion
=
shell
.
info
.
clientVersion
=
"Welcome to the TDengine Command Line Interface, Client Version:%s
\r\n
"
"Welcome to the %s Command Line Interface, Client Version:%s
\r\n
"
"Copyright (c) 2022 by TDengine, all rights reserved.
\r\n\r\n
"
;
"Copyright (c) 2022 by %s, all rights reserved.
\r\n\r\n
"
;
shell
.
info
.
promptHeader
=
TAOS_CONSOLE_PROMPT_HEADER
;
strcpy
(
shell
.
info
.
cusName
,
cusName
);
sprintf
(
shell
.
info
.
promptHeader
,
"%s> "
,
cusPrompt
);
shell
.
info
.
promptContinue
=
TAOS_CONSOLE_PROMPT_CONTINUE
;
shell
.
info
.
promptContinue
=
TAOS_CONSOLE_PROMPT_CONTINUE
;
shell
.
info
.
promptSize
=
6
;
shell
.
info
.
promptSize
=
strlen
(
shell
.
info
.
promptHeader
)
;
snprintf
(
shell
.
info
.
programVersion
,
sizeof
(
shell
.
info
.
programVersion
),
"version: %s"
,
version
);
snprintf
(
shell
.
info
.
programVersion
,
sizeof
(
shell
.
info
.
programVersion
),
"version: %s"
,
version
);
#if defined(_TD_WINDOWS_64) || defined(_TD_WINDOWS_32)
#if defined(_TD_WINDOWS_64) || defined(_TD_WINDOWS_32)
...
...
tools/shell/src/shellAuto.c
浏览文件 @
45ef1c74
...
@@ -264,7 +264,7 @@ char* key_tags[] = {"tags("};
...
@@ -264,7 +264,7 @@ char* key_tags[] = {"tags("};
char
*
key_select
[]
=
{
"select "
};
char
*
key_select
[]
=
{
"select "
};
//
//
// ------- gobal variant define ---------
// ------- g
l
obal variant define ---------
//
//
int32_t
firstMatchIndex
=
-
1
;
// first match shellCommands index
int32_t
firstMatchIndex
=
-
1
;
// first match shellCommands index
int32_t
lastMatchIndex
=
-
1
;
// last match shellCommands index
int32_t
lastMatchIndex
=
-
1
;
// last match shellCommands index
...
@@ -329,7 +329,15 @@ int cntDel = 0; // delete byte count after next press tab
...
@@ -329,7 +329,15 @@ 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
"
);
char
secondLine
[
160
]
=
"
\0
"
;
sprintf
(
secondLine
,
" * The %s CLI supports tab completion for a variety of items, "
,
shell
.
info
.
cusName
);
printf
(
"%s"
,
secondLine
);
int
secondLineLen
=
strlen
(
secondLine
);
while
(
84
-
(
secondLineLen
++
)
>
0
)
{
printf
(
" "
);
}
printf
(
"*
\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
"
);
...
@@ -344,7 +352,7 @@ void printfIntroduction() {
...
@@ -344,7 +352,7 @@ void printfIntroduction() {
}
}
void
showHelp
()
{
void
showHelp
()
{
printf
(
"
\n
The
TDengine CLI supports the following commands:"
);
printf
(
"
\n
The
%s CLI supports the following commands:"
,
shell
.
info
.
cusName
);
printf
(
printf
(
"
\n
\
"
\n
\
----- A -----
\n
\
----- A -----
\n
\
...
@@ -595,7 +603,7 @@ void GenerateVarType(int type, char** p, int count) {
...
@@ -595,7 +603,7 @@ void GenerateVarType(int type, char** p, int count) {
// -------------------- shell auto ----------------
// -------------------- shell auto ----------------
//
//
// init shell auto func
it
on , shell start call once
// init shell auto func
ti
on , shell start call once
bool
shellAutoInit
()
{
bool
shellAutoInit
()
{
// command
// command
int32_t
count
=
SHELL_COMMAND_COUNT
();
int32_t
count
=
SHELL_COMMAND_COUNT
();
...
@@ -628,7 +636,7 @@ bool shellAutoInit() {
...
@@ -628,7 +636,7 @@ bool shellAutoInit() {
// set conn
// set conn
void
shellSetConn
(
TAOS
*
conn
)
{
varCon
=
conn
;
}
void
shellSetConn
(
TAOS
*
conn
)
{
varCon
=
conn
;
}
// exit shell auto func
it
on, shell exit call once
// exit shell auto func
ti
on, shell exit call once
void
shellAutoExit
()
{
void
shellAutoExit
()
{
// free command
// free command
int32_t
count
=
SHELL_COMMAND_COUNT
();
int32_t
count
=
SHELL_COMMAND_COUNT
();
...
@@ -645,7 +653,7 @@ void shellAutoExit() {
...
@@ -645,7 +653,7 @@ void shellAutoExit() {
}
}
}
}
taosThreadMutexUnlock
(
&
tiresMutex
);
taosThreadMutexUnlock
(
&
tiresMutex
);
// dest
or
y
// dest
ro
y
taosThreadMutexDestroy
(
&
tiresMutex
);
taosThreadMutexDestroy
(
&
tiresMutex
);
// free threads
// free threads
...
@@ -666,7 +674,7 @@ void shellAutoExit() {
...
@@ -666,7 +674,7 @@ void shellAutoExit() {
//
//
// ------------------- auto ptr for tires --------------------------
// ------------------- auto ptr for tires --------------------------
//
//
bool
setNewAu
ot
Ptr
(
int
type
,
STire
*
pNew
)
{
bool
setNewAu
to
Ptr
(
int
type
,
STire
*
pNew
)
{
if
(
pNew
==
NULL
)
return
false
;
if
(
pNew
==
NULL
)
return
false
;
taosThreadMutexLock
(
&
tiresMutex
);
taosThreadMutexLock
(
&
tiresMutex
);
...
@@ -709,7 +717,7 @@ void putBackAutoPtr(int type, STire* tire) {
...
@@ -709,7 +717,7 @@ void putBackAutoPtr(int type, STire* tire) {
if
(
tires
[
type
]
!=
tire
)
{
if
(
tires
[
type
]
!=
tire
)
{
// update by out, can't put back , so free
// update by out, can't put back , so free
if
(
--
tire
->
ref
==
1
)
{
if
(
--
tire
->
ref
==
1
)
{
// support multi thread getAu
ot
Ptr
// support multi thread getAu
to
Ptr
freeTire
(
tire
);
freeTire
(
tire
);
}
}
...
@@ -767,7 +775,7 @@ int writeVarNames(int type, TAOS_RES* tres) {
...
@@ -767,7 +775,7 @@ int writeVarNames(int type, TAOS_RES* tres) {
}
while
(
row
!=
NULL
);
}
while
(
row
!=
NULL
);
// replace old tire
// replace old tire
setNewAu
ot
Ptr
(
type
,
tire
);
setNewAu
to
Ptr
(
type
,
tire
);
return
numOfRows
;
return
numOfRows
;
}
}
...
@@ -1035,7 +1043,7 @@ SWords* matchCommand(SWords* input, bool continueSearch) {
...
@@ -1035,7 +1043,7 @@ SWords* matchCommand(SWords* input, bool continueSearch) {
for
(
int32_t
i
=
0
;
i
<
count
;
i
++
)
{
for
(
int32_t
i
=
0
;
i
<
count
;
i
++
)
{
SWords
*
shellCommand
=
shellCommands
+
i
;
SWords
*
shellCommand
=
shellCommands
+
i
;
if
(
continueSearch
&&
lastMatchIndex
!=
-
1
&&
i
<=
lastMatchIndex
)
{
if
(
continueSearch
&&
lastMatchIndex
!=
-
1
&&
i
<=
lastMatchIndex
)
{
// new match must greate than lastMatchIndex
// new match must greate
r
than lastMatchIndex
if
(
varMode
&&
i
==
lastMatchIndex
)
{
if
(
varMode
&&
i
==
lastMatchIndex
)
{
// do nothing, var match on lastMatchIndex
// do nothing, var match on lastMatchIndex
}
else
{
}
else
{
...
@@ -1164,7 +1172,7 @@ void createInputFromFirst(SWords* input, SWords* firstMatch) {
...
@@ -1164,7 +1172,7 @@ void createInputFromFirst(SWords* input, SWords* firstMatch) {
for
(
int
i
=
0
;
i
<
firstMatch
->
matchIndex
&&
word
;
i
++
)
{
for
(
int
i
=
0
;
i
<
firstMatch
->
matchIndex
&&
word
;
i
++
)
{
// combine source from each word
// combine source from each word
strncpy
(
input
->
source
+
input
->
source_len
,
word
->
word
,
word
->
len
);
strncpy
(
input
->
source
+
input
->
source_len
,
word
->
word
,
word
->
len
);
strcat
(
input
->
source
,
" "
);
// append blank sp
lit
e
strcat
(
input
->
source
,
" "
);
// append blank sp
ac
e
input
->
source_len
+=
word
->
len
+
1
;
// 1 is blank length
input
->
source_len
+=
word
->
len
+
1
;
// 1 is blank length
// move next
// move next
word
=
word
->
next
;
word
=
word
->
next
;
...
@@ -1393,7 +1401,7 @@ bool appendAfterSelect(TAOS* con, SShellCmd* cmd, char* sql, int32_t len) {
...
@@ -1393,7 +1401,7 @@ bool appendAfterSelect(TAOS* con, SShellCmd* cmd, char* sql, int32_t len) {
return
true
;
return
true
;
}
}
// fill func
it
on
// fill func
ti
on
if
(
fieldEnd
)
{
if
(
fieldEnd
)
{
// fields is end , need match keyword
// fields is end , need match keyword
ret
=
fillWithType
(
con
,
cmd
,
last
,
WT_VAR_KEYWORD
);
ret
=
fillWithType
(
con
,
cmd
,
last
,
WT_VAR_KEYWORD
);
...
@@ -1576,7 +1584,7 @@ bool matchCreateTable(TAOS* con, SShellCmd* cmd) {
...
@@ -1576,7 +1584,7 @@ bool matchCreateTable(TAOS* con, SShellCmd* cmd) {
// tb options
// tb options
if
(
!
ret
)
{
if
(
!
ret
)
{
// find like create ta
lb
e st (...) tags(..) <here is fill tb option area>
// find like create ta
bl
e st (...) tags(..) <here is fill tb option area>
char
*
p1
=
strchr
(
ps
,
')'
);
// first ')' end
char
*
p1
=
strchr
(
ps
,
')'
);
// first ')' end
if
(
p1
)
{
if
(
p1
)
{
if
(
strchr
(
p1
+
1
,
')'
))
{
// second ')' end
if
(
strchr
(
p1
+
1
,
')'
))
{
// second ')' end
...
...
tools/shell/src/shellEngine.c
浏览文件 @
45ef1c74
...
@@ -1072,7 +1072,8 @@ void *shellThreadLoop(void *arg) {
...
@@ -1072,7 +1072,8 @@ void *shellThreadLoop(void *arg) {
}
}
int32_t
shellExecute
()
{
int32_t
shellExecute
()
{
printf
(
shell
.
info
.
clientVersion
,
taos_get_client_info
());
printf
(
shell
.
info
.
clientVersion
,
shell
.
info
.
cusName
,
taos_get_client_info
(),
shell
.
info
.
cusName
);
fflush
(
stdout
);
fflush
(
stdout
);
SShellArgs
*
pArgs
=
&
shell
.
args
;
SShellArgs
*
pArgs
=
&
shell
.
args
;
...
@@ -1127,7 +1128,7 @@ int32_t shellExecute() {
...
@@ -1127,7 +1128,7 @@ int32_t shellExecute() {
}
}
if
(
tsem_init
(
&
shell
.
cancelSem
,
0
,
0
)
!=
0
)
{
if
(
tsem_init
(
&
shell
.
cancelSem
,
0
,
0
)
!=
0
)
{
printf
(
"failed to create cancel semphore
\r\n
"
);
printf
(
"failed to create cancel sem
a
phore
\r\n
"
);
return
-
1
;
return
-
1
;
}
}
...
...
tools/shell/src/shellUtil.c
浏览文件 @
45ef1c74
...
@@ -50,19 +50,19 @@ bool shellRegexMatch(const char *s, const char *reg, int32_t cflags) {
...
@@ -50,19 +50,19 @@ bool shellRegexMatch(const char *s, const char *reg, int32_t cflags) {
int32_t
shellCheckIntSize
()
{
int32_t
shellCheckIntSize
()
{
if
(
sizeof
(
int8_t
)
!=
1
)
{
if
(
sizeof
(
int8_t
)
!=
1
)
{
printf
(
"
taos
int8 size is %d(!= 1)"
,
(
int
)
sizeof
(
int8_t
));
printf
(
"int8 size is %d(!= 1)"
,
(
int
)
sizeof
(
int8_t
));
return
-
1
;
return
-
1
;
}
}
if
(
sizeof
(
int16_t
)
!=
2
)
{
if
(
sizeof
(
int16_t
)
!=
2
)
{
printf
(
"
taos
int16 size is %d(!= 2)"
,
(
int
)
sizeof
(
int16_t
));
printf
(
"int16 size is %d(!= 2)"
,
(
int
)
sizeof
(
int16_t
));
return
-
1
;
return
-
1
;
}
}
if
(
sizeof
(
int32_t
)
!=
4
)
{
if
(
sizeof
(
int32_t
)
!=
4
)
{
printf
(
"
taos
int32 size is %d(!= 4)"
,
(
int
)
sizeof
(
int32_t
));
printf
(
"int32 size is %d(!= 4)"
,
(
int
)
sizeof
(
int32_t
));
return
-
1
;
return
-
1
;
}
}
if
(
sizeof
(
int64_t
)
!=
8
)
{
if
(
sizeof
(
int64_t
)
!=
8
)
{
printf
(
"
taos
int64 size is %d(!= 8)"
,
(
int
)
sizeof
(
int64_t
));
printf
(
"int64 size is %d(!= 8)"
,
(
int
)
sizeof
(
int64_t
));
return
-
1
;
return
-
1
;
}
}
return
0
;
return
0
;
...
@@ -80,7 +80,7 @@ void shellGenerateAuth() {
...
@@ -80,7 +80,7 @@ void shellGenerateAuth() {
void
shellDumpConfig
()
{
void
shellDumpConfig
()
{
SConfig
*
pCfg
=
taosGetCfg
();
SConfig
*
pCfg
=
taosGetCfg
();
if
(
pCfg
==
NULL
)
{
if
(
pCfg
==
NULL
)
{
printf
(
"
TDengine
read global config failed!
\r\n
"
);
printf
(
"read global config failed!
\r\n
"
);
}
else
{
}
else
{
cfgDumpCfg
(
pCfg
,
1
,
true
);
cfgDumpCfg
(
pCfg
,
1
,
true
);
}
}
...
...
tools/shell/src/shellWebsocket.c
浏览文件 @
45ef1c74
...
@@ -235,7 +235,7 @@ void shellRunSingleCommandWebsocketImp(char *command) {
...
@@ -235,7 +235,7 @@ void shellRunSingleCommandWebsocketImp(char *command) {
if
(
reconnectNum
==
0
)
{
if
(
reconnectNum
==
0
)
{
continue
;
continue
;
}
else
{
}
else
{
fprintf
(
stderr
,
"T
Dengin
e server is disconnected, will try to reconnect
\n
"
);
fprintf
(
stderr
,
"T
h
e server is disconnected, will try to reconnect
\n
"
);
}
}
return
;
return
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录