Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
03c3d1aa
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,发现更多精彩内容 >>
提交
03c3d1aa
编写于
8月 19, 2021
作者:
sangshuduo
提交者:
Shuduo Sang
8月 20, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
cherry pick with
ab6cde02
上级
7f959497
变更
7
显示空白变更内容
内联
并排
Showing
7 changed file
with
22 addition
and
23 deletion
+22
-23
src/inc/taosdef.h
src/inc/taosdef.h
+2
-0
src/kit/shell/inc/shell.h
src/kit/shell/inc/shell.h
+0
-1
src/kit/shell/src/shellDarwin.c
src/kit/shell/src/shellDarwin.c
+2
-2
src/kit/shell/src/shellLinux.c
src/kit/shell/src/shellLinux.c
+2
-2
src/kit/shell/src/shellWindows.c
src/kit/shell/src/shellWindows.c
+2
-2
src/kit/taosdemo/taosdemo.c
src/kit/taosdemo/taosdemo.c
+11
-12
src/kit/taosdump/taosdump.c
src/kit/taosdump/taosdump.c
+3
-4
未找到文件。
src/inc/taosdef.h
浏览文件 @
03c3d1aa
...
@@ -87,6 +87,8 @@ extern const int32_t TYPE_BYTES[15];
...
@@ -87,6 +87,8 @@ extern const int32_t TYPE_BYTES[15];
#define TSDB_DEFAULT_PASS "taosdata"
#define TSDB_DEFAULT_PASS "taosdata"
#endif
#endif
#define SHELL_MAX_PASSWORD_LEN 20
#define TSDB_TRUE 1
#define TSDB_TRUE 1
#define TSDB_FALSE 0
#define TSDB_FALSE 0
#define TSDB_OK 0
#define TSDB_OK 0
...
...
src/kit/shell/inc/shell.h
浏览文件 @
03c3d1aa
...
@@ -25,7 +25,6 @@
...
@@ -25,7 +25,6 @@
#define MAX_USERNAME_SIZE 64
#define MAX_USERNAME_SIZE 64
#define MAX_DBNAME_SIZE 64
#define MAX_DBNAME_SIZE 64
#define MAX_IP_SIZE 20
#define MAX_IP_SIZE 20
#define MAX_PASSWORD_SIZE 20
#define MAX_HISTORY_SIZE 1000
#define MAX_HISTORY_SIZE 1000
#define MAX_COMMAND_SIZE 1048586
#define MAX_COMMAND_SIZE 1048586
#define HISTORY_FILE ".taos_history"
#define HISTORY_FILE ".taos_history"
...
...
src/kit/shell/src/shellDarwin.c
浏览文件 @
03c3d1aa
...
@@ -66,7 +66,7 @@ void printHelp() {
...
@@ -66,7 +66,7 @@ void printHelp() {
char
DARWINCLIENT_VERSION
[]
=
"Welcome to the TDengine shell from %s, Client Version:%s
\n
"
char
DARWINCLIENT_VERSION
[]
=
"Welcome to the TDengine shell from %s, Client Version:%s
\n
"
"Copyright (c) 2020 by TAOS Data, Inc. All rights reserved.
\n\n
"
;
"Copyright (c) 2020 by TAOS Data, Inc. All rights reserved.
\n\n
"
;
char
g_password
[
MAX_PASSWORD_SIZE
];
char
g_password
[
SHELL_MAX_PASSWORD_LEN
];
void
shellParseArgument
(
int
argc
,
char
*
argv
[],
SShellArguments
*
arguments
)
{
void
shellParseArgument
(
int
argc
,
char
*
argv
[],
SShellArguments
*
arguments
)
{
wordexp_t
full_path
;
wordexp_t
full_path
;
...
@@ -91,7 +91,7 @@ void shellParseArgument(int argc, char *argv[], SShellArguments *arguments) {
...
@@ -91,7 +91,7 @@ void shellParseArgument(int argc, char *argv[], SShellArguments *arguments) {
}
}
getchar
();
getchar
();
}
else
{
}
else
{
tstrncpy
(
g_password
,
(
char
*
)(
argv
[
i
]
+
2
),
MAX_PASSWORD_SIZE
);
tstrncpy
(
g_password
,
(
char
*
)(
argv
[
i
]
+
2
),
SHELL_MAX_PASSWORD_LEN
);
}
}
arguments
->
password
=
g_password
;
arguments
->
password
=
g_password
;
}
}
...
...
src/kit/shell/src/shellLinux.c
浏览文件 @
03c3d1aa
...
@@ -160,7 +160,7 @@ static struct argp argp = {options, parse_opt, args_doc, doc};
...
@@ -160,7 +160,7 @@ static struct argp argp = {options, parse_opt, args_doc, doc};
char
LINUXCLIENT_VERSION
[]
=
"Welcome to the TDengine shell from %s, Client Version:%s
\n
"
char
LINUXCLIENT_VERSION
[]
=
"Welcome to the TDengine shell from %s, Client Version:%s
\n
"
"Copyright (c) 2020 by TAOS Data, Inc. All rights reserved.
\n\n
"
;
"Copyright (c) 2020 by TAOS Data, Inc. All rights reserved.
\n\n
"
;
char
g_password
[
MAX_PASSWORD_SIZE
];
char
g_password
[
SHELL_MAX_PASSWORD_LEN
];
static
void
parse_password
(
static
void
parse_password
(
int
argc
,
char
*
argv
[],
SShellArguments
*
arguments
)
{
int
argc
,
char
*
argv
[],
SShellArguments
*
arguments
)
{
...
@@ -175,7 +175,7 @@ static void parse_password(
...
@@ -175,7 +175,7 @@ static void parse_password(
}
}
getchar
();
getchar
();
}
else
{
}
else
{
tstrncpy
(
g_password
,
(
char
*
)(
argv
[
i
]
+
2
),
MAX_PASSWORD_SIZE
);
tstrncpy
(
g_password
,
(
char
*
)(
argv
[
i
]
+
2
),
SHELL_MAX_PASSWORD_LEN
);
}
}
arguments
->
password
=
g_password
;
arguments
->
password
=
g_password
;
arguments
->
is_use_passwd
=
true
;
arguments
->
is_use_passwd
=
true
;
...
...
src/kit/shell/src/shellWindows.c
浏览文件 @
03c3d1aa
...
@@ -64,7 +64,7 @@ void printHelp() {
...
@@ -64,7 +64,7 @@ void printHelp() {
exit
(
EXIT_SUCCESS
);
exit
(
EXIT_SUCCESS
);
}
}
char
g_password
[
MAX_PASSWORD_SIZE
];
char
g_password
[
SHELL_MAX_PASSWORD_LEN
];
void
shellParseArgument
(
int
argc
,
char
*
argv
[],
SShellArguments
*
arguments
)
{
void
shellParseArgument
(
int
argc
,
char
*
argv
[],
SShellArguments
*
arguments
)
{
for
(
int
i
=
1
;
i
<
argc
;
i
++
)
{
for
(
int
i
=
1
;
i
<
argc
;
i
++
)
{
...
@@ -89,7 +89,7 @@ void shellParseArgument(int argc, char *argv[], SShellArguments *arguments) {
...
@@ -89,7 +89,7 @@ void shellParseArgument(int argc, char *argv[], SShellArguments *arguments) {
}
}
getchar
();
getchar
();
}
else
{
}
else
{
tstrncpy
(
g_password
,
(
char
*
)(
argv
[
i
]
+
2
),
MAX_PASSWORD_SIZE
);
tstrncpy
(
g_password
,
(
char
*
)(
argv
[
i
]
+
2
),
SHELL_MAX_PASSWORD_LEN
);
}
}
arguments
->
password
=
g_password
;
arguments
->
password
=
g_password
;
}
}
...
...
src/kit/taosdemo/taosdemo.c
浏览文件 @
03c3d1aa
...
@@ -77,7 +77,6 @@ extern char configDir[];
...
@@ -77,7 +77,6 @@ extern char configDir[];
#define COL_BUFFER_LEN ((TSDB_COL_NAME_LEN + 15) * TSDB_MAX_COLUMNS)
#define COL_BUFFER_LEN ((TSDB_COL_NAME_LEN + 15) * TSDB_MAX_COLUMNS)
#define MAX_USERNAME_SIZE 64
#define MAX_USERNAME_SIZE 64
#define MAX_PASSWORD_SIZE 16
#define MAX_HOSTNAME_SIZE 253 // https://man7.org/linux/man-pages/man7/hostname.7.html
#define MAX_HOSTNAME_SIZE 253 // https://man7.org/linux/man-pages/man7/hostname.7.html
#define MAX_TB_NAME_SIZE 64
#define MAX_TB_NAME_SIZE 64
#define MAX_DATA_SIZE (16*TSDB_MAX_COLUMNS)+20 // max record len: 16*MAX_COLUMNS, timestamp string and ,('') need extra space
#define MAX_DATA_SIZE (16*TSDB_MAX_COLUMNS)+20 // max record len: 16*MAX_COLUMNS, timestamp string and ,('') need extra space
...
@@ -216,7 +215,7 @@ typedef struct SArguments_S {
...
@@ -216,7 +215,7 @@ typedef struct SArguments_S {
uint16_t
port
;
uint16_t
port
;
uint16_t
iface
;
uint16_t
iface
;
char
*
user
;
char
*
user
;
char
password
[
MAX_PASSWORD_SIZE
];
char
password
[
SHELL_MAX_PASSWORD_LEN
];
char
*
database
;
char
*
database
;
int
replica
;
int
replica
;
char
*
tb_prefix
;
char
*
tb_prefix
;
...
@@ -366,7 +365,7 @@ typedef struct SDbs_S {
...
@@ -366,7 +365,7 @@ typedef struct SDbs_S {
uint16_t
port
;
uint16_t
port
;
char
user
[
MAX_USERNAME_SIZE
];
char
user
[
MAX_USERNAME_SIZE
];
char
password
[
MAX_PASSWORD_SIZE
];
char
password
[
SHELL_MAX_PASSWORD_LEN
];
char
resultFile
[
MAX_FILE_NAME_LEN
];
char
resultFile
[
MAX_FILE_NAME_LEN
];
bool
use_metric
;
bool
use_metric
;
bool
insert_only
;
bool
insert_only
;
...
@@ -432,7 +431,7 @@ typedef struct SQueryMetaInfo_S {
...
@@ -432,7 +431,7 @@ typedef struct SQueryMetaInfo_S {
uint16_t
port
;
uint16_t
port
;
struct
sockaddr_in
serv_addr
;
struct
sockaddr_in
serv_addr
;
char
user
[
MAX_USERNAME_SIZE
];
char
user
[
MAX_USERNAME_SIZE
];
char
password
[
MAX_PASSWORD_SIZE
];
char
password
[
SHELL_MAX_PASSWORD_LEN
];
char
dbName
[
TSDB_DB_NAME_LEN
];
char
dbName
[
TSDB_DB_NAME_LEN
];
char
queryMode
[
SMALL_BUFF_LEN
];
// taosc, rest
char
queryMode
[
SMALL_BUFF_LEN
];
// taosc, rest
...
@@ -874,7 +873,7 @@ static void parse_args(int argc, char *argv[], SArguments *arguments) {
...
@@ -874,7 +873,7 @@ static void parse_args(int argc, char *argv[], SArguments *arguments) {
}
}
taosSetConsoleEcho
(
true
);
taosSetConsoleEcho
(
true
);
}
else
{
}
else
{
tstrncpy
(
arguments
->
password
,
(
char
*
)(
argv
[
i
]
+
2
),
MAX_PASSWORD_SIZE
);
tstrncpy
(
arguments
->
password
,
(
char
*
)(
argv
[
i
]
+
2
),
SHELL_MAX_PASSWORD_LEN
);
}
}
}
else
if
(
strcmp
(
argv
[
i
],
"-o"
)
==
0
)
{
}
else
if
(
strcmp
(
argv
[
i
],
"-o"
)
==
0
)
{
if
(
argc
==
i
+
1
)
{
if
(
argc
==
i
+
1
)
{
...
@@ -3806,9 +3805,9 @@ static bool getMetaFromInsertJsonFile(cJSON* root) {
...
@@ -3806,9 +3805,9 @@ static bool getMetaFromInsertJsonFile(cJSON* root) {
cJSON
*
password
=
cJSON_GetObjectItem
(
root
,
"password"
);
cJSON
*
password
=
cJSON_GetObjectItem
(
root
,
"password"
);
if
(
password
&&
password
->
type
==
cJSON_String
&&
password
->
valuestring
!=
NULL
)
{
if
(
password
&&
password
->
type
==
cJSON_String
&&
password
->
valuestring
!=
NULL
)
{
tstrncpy
(
g_Dbs
.
password
,
password
->
valuestring
,
MAX_PASSWORD_SIZE
);
tstrncpy
(
g_Dbs
.
password
,
password
->
valuestring
,
SHELL_MAX_PASSWORD_LEN
);
}
else
if
(
!
password
)
{
}
else
if
(
!
password
)
{
tstrncpy
(
g_Dbs
.
password
,
"taosdata"
,
MAX_PASSWORD_SIZE
);
tstrncpy
(
g_Dbs
.
password
,
"taosdata"
,
SHELL_MAX_PASSWORD_LEN
);
}
}
cJSON
*
resultfile
=
cJSON_GetObjectItem
(
root
,
"result_file"
);
cJSON
*
resultfile
=
cJSON_GetObjectItem
(
root
,
"result_file"
);
...
@@ -4544,9 +4543,9 @@ static bool getMetaFromQueryJsonFile(cJSON* root) {
...
@@ -4544,9 +4543,9 @@ static bool getMetaFromQueryJsonFile(cJSON* root) {
cJSON
*
password
=
cJSON_GetObjectItem
(
root
,
"password"
);
cJSON
*
password
=
cJSON_GetObjectItem
(
root
,
"password"
);
if
(
password
&&
password
->
type
==
cJSON_String
&&
password
->
valuestring
!=
NULL
)
{
if
(
password
&&
password
->
type
==
cJSON_String
&&
password
->
valuestring
!=
NULL
)
{
tstrncpy
(
g_queryInfo
.
password
,
password
->
valuestring
,
MAX_PASSWORD_SIZE
);
tstrncpy
(
g_queryInfo
.
password
,
password
->
valuestring
,
SHELL_MAX_PASSWORD_LEN
);
}
else
if
(
!
password
)
{
}
else
if
(
!
password
)
{
tstrncpy
(
g_queryInfo
.
password
,
"taosdata"
,
MAX_PASSWORD_SIZE
);;
tstrncpy
(
g_queryInfo
.
password
,
"taosdata"
,
SHELL_MAX_PASSWORD_LEN
);;
}
}
cJSON
*
answerPrompt
=
cJSON_GetObjectItem
(
root
,
"confirm_parameter_prompt"
);
// yes, no,
cJSON
*
answerPrompt
=
cJSON_GetObjectItem
(
root
,
"confirm_parameter_prompt"
);
// yes, no,
...
@@ -8888,7 +8887,7 @@ static void initOfInsertMeta() {
...
@@ -8888,7 +8887,7 @@ static void initOfInsertMeta() {
tstrncpy
(
g_Dbs
.
host
,
"127.0.0.1"
,
MAX_HOSTNAME_SIZE
);
tstrncpy
(
g_Dbs
.
host
,
"127.0.0.1"
,
MAX_HOSTNAME_SIZE
);
g_Dbs
.
port
=
6030
;
g_Dbs
.
port
=
6030
;
tstrncpy
(
g_Dbs
.
user
,
TSDB_DEFAULT_USER
,
MAX_USERNAME_SIZE
);
tstrncpy
(
g_Dbs
.
user
,
TSDB_DEFAULT_USER
,
MAX_USERNAME_SIZE
);
tstrncpy
(
g_Dbs
.
password
,
TSDB_DEFAULT_PASS
,
MAX_PASSWORD_SIZE
);
tstrncpy
(
g_Dbs
.
password
,
TSDB_DEFAULT_PASS
,
SHELL_MAX_PASSWORD_LEN
);
g_Dbs
.
threadCount
=
2
;
g_Dbs
.
threadCount
=
2
;
g_Dbs
.
use_metric
=
g_args
.
use_metric
;
g_Dbs
.
use_metric
=
g_args
.
use_metric
;
...
@@ -8901,7 +8900,7 @@ static void initOfQueryMeta() {
...
@@ -8901,7 +8900,7 @@ static void initOfQueryMeta() {
tstrncpy
(
g_queryInfo
.
host
,
"127.0.0.1"
,
MAX_HOSTNAME_SIZE
);
tstrncpy
(
g_queryInfo
.
host
,
"127.0.0.1"
,
MAX_HOSTNAME_SIZE
);
g_queryInfo
.
port
=
6030
;
g_queryInfo
.
port
=
6030
;
tstrncpy
(
g_queryInfo
.
user
,
TSDB_DEFAULT_USER
,
MAX_USERNAME_SIZE
);
tstrncpy
(
g_queryInfo
.
user
,
TSDB_DEFAULT_USER
,
MAX_USERNAME_SIZE
);
tstrncpy
(
g_queryInfo
.
password
,
TSDB_DEFAULT_PASS
,
MAX_PASSWORD_SIZE
);
tstrncpy
(
g_queryInfo
.
password
,
TSDB_DEFAULT_PASS
,
SHELL_MAX_PASSWORD_LEN
);
}
}
static
void
setParaFromArg
()
{
static
void
setParaFromArg
()
{
...
@@ -8915,7 +8914,7 @@ static void setParaFromArg() {
...
@@ -8915,7 +8914,7 @@ static void setParaFromArg() {
tstrncpy
(
g_Dbs
.
user
,
g_args
.
user
,
MAX_USERNAME_SIZE
);
tstrncpy
(
g_Dbs
.
user
,
g_args
.
user
,
MAX_USERNAME_SIZE
);
}
}
tstrncpy
(
g_Dbs
.
password
,
g_args
.
password
,
MAX_PASSWORD_SIZE
);
tstrncpy
(
g_Dbs
.
password
,
g_args
.
password
,
SHELL_MAX_PASSWORD_LEN
);
if
(
g_args
.
port
)
{
if
(
g_args
.
port
)
{
g_Dbs
.
port
=
g_args
.
port
;
g_Dbs
.
port
=
g_args
.
port
;
...
...
src/kit/taosdump/taosdump.c
浏览文件 @
03c3d1aa
...
@@ -248,14 +248,12 @@ static struct argp_option options[] = {
...
@@ -248,14 +248,12 @@ static struct argp_option options[] = {
{
0
}
{
0
}
};
};
#define MAX_PASSWORD_SIZE 20
/* Used by main to communicate with parse_opt. */
/* Used by main to communicate with parse_opt. */
typedef
struct
arguments
{
typedef
struct
arguments
{
// connection option
// connection option
char
*
host
;
char
*
host
;
char
*
user
;
char
*
user
;
char
password
[
MAX_PASSWORD_SIZE
];
char
password
[
SHELL_MAX_PASSWORD_LEN
];
uint16_t
port
;
uint16_t
port
;
char
cversion
[
12
];
char
cversion
[
12
];
uint16_t
mysqlFlag
;
uint16_t
mysqlFlag
;
...
@@ -567,7 +565,8 @@ static void parse_password(
...
@@ -567,7 +565,8 @@ static void parse_password(
}
}
taosSetConsoleEcho
(
true
);
taosSetConsoleEcho
(
true
);
}
else
{
}
else
{
tstrncpy
(
arguments
->
password
,
(
char
*
)(
argv
[
i
]
+
2
),
MAX_PASSWORD_SIZE
);
tstrncpy
(
arguments
->
password
,
(
char
*
)(
argv
[
i
]
+
2
),
SHELL_MAX_PASSWORD_LEN
);
}
}
argv
[
i
]
=
""
;
argv
[
i
]
=
""
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录