Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
a8f23214
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看板
提交
a8f23214
编写于
5月 12, 2021
作者:
S
Shuduo Sang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-4068]<feature>: taosdemo supports stmt interface.
上级
39f82130
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
30 addition
and
1 deletion
+30
-1
src/kit/taosdemo/taosdemo.c
src/kit/taosdemo/taosdemo.c
+30
-1
未找到文件。
src/kit/taosdemo/taosdemo.c
浏览文件 @
a8f23214
...
@@ -120,6 +120,13 @@ enum MODE {
...
@@ -120,6 +120,13 @@ enum MODE {
MODE_BUT
MODE_BUT
};
};
enum
INTERFACE
{
TAOSC_INTERFACE
,
REST_INTERFACE
,
STMT_INTERFACE
,
INTERFACE_BUT
};
typedef
enum
enum_INSERT_MODE
{
typedef
enum
enum_INSERT_MODE
{
PROGRESSIVE_INSERT_MODE
,
PROGRESSIVE_INSERT_MODE
,
INTERLACE_INSERT_MODE
,
INTERLACE_INSERT_MODE
,
...
@@ -188,6 +195,7 @@ typedef struct SArguments_S {
...
@@ -188,6 +195,7 @@ typedef struct SArguments_S {
uint32_t
test_mode
;
uint32_t
test_mode
;
char
*
host
;
char
*
host
;
uint16_t
port
;
uint16_t
port
;
uint16_t
interface
;
char
*
user
;
char
*
user
;
char
*
password
;
char
*
password
;
char
*
database
;
char
*
database
;
...
@@ -536,6 +544,7 @@ SArguments g_args = {
...
@@ -536,6 +544,7 @@ SArguments g_args = {
0
,
// test_mode
0
,
// test_mode
"127.0.0.1"
,
// host
"127.0.0.1"
,
// host
6030
,
// port
6030
,
// port
TAOSC_INTERFACE
,
// interface
"root"
,
// user
"root"
,
// user
#ifdef _TD_POWER_
#ifdef _TD_POWER_
"powerdb"
,
// password
"powerdb"
,
// password
...
@@ -652,6 +661,8 @@ static void printHelp() {
...
@@ -652,6 +661,8 @@ static void printHelp() {
"The host to connect to TDengine. Default is localhost."
);
"The host to connect to TDengine. Default is localhost."
);
printf
(
"%s%s%s%s
\n
"
,
indent
,
"-p"
,
indent
,
printf
(
"%s%s%s%s
\n
"
,
indent
,
"-p"
,
indent
,
"The TCP/IP port number to use for the connection. Default is 0."
);
"The TCP/IP port number to use for the connection. Default is 0."
);
printf
(
"%s%s%s%s
\n
"
,
indent
,
"-I"
,
indent
,
"The interface (taosc, rest, and stmt) taosdemo uses. Default is 'taosc'."
);
printf
(
"%s%s%s%s
\n
"
,
indent
,
"-d"
,
indent
,
printf
(
"%s%s%s%s
\n
"
,
indent
,
"-d"
,
indent
,
"Destination database. Default is 'test'."
);
"Destination database. Default is 'test'."
);
printf
(
"%s%s%s%s
\n
"
,
indent
,
"-a"
,
indent
,
printf
(
"%s%s%s%s
\n
"
,
indent
,
"-a"
,
indent
,
...
@@ -741,6 +752,23 @@ static void parse_args(int argc, char *argv[], SArguments *arguments) {
...
@@ -741,6 +752,23 @@ static void parse_args(int argc, char *argv[], SArguments *arguments) {
exit
(
EXIT_FAILURE
);
exit
(
EXIT_FAILURE
);
}
}
arguments
->
port
=
atoi
(
argv
[
++
i
]);
arguments
->
port
=
atoi
(
argv
[
++
i
]);
}
else
if
(
strcmp
(
argv
[
i
],
"-I"
)
==
0
)
{
if
(
argc
==
i
+
1
)
{
printHelp
();
errorPrint
(
"%s"
,
"
\n\t
-I need a valid string following!
\n
"
);
exit
(
EXIT_FAILURE
);
}
++
i
;
if
(
0
==
strcasecmp
(
argv
[
i
],
"taosc"
))
{
arguments
->
interface
=
TAOSC_INTERFACE
;
}
else
if
(
0
==
strcasecmp
(
argv
[
i
],
"rest"
))
{
arguments
->
interface
=
REST_INTERFACE
;
}
else
if
(
0
==
strcasecmp
(
argv
[
i
],
"stmt"
))
{
arguments
->
interface
=
STMT_INTERFACE
;
}
else
{
errorPrint
(
"%s"
,
"
\n\t
-I need a valid string following!
\n
"
);
exit
(
EXIT_FAILURE
);
}
}
else
if
(
strcmp
(
argv
[
i
],
"-u"
)
==
0
)
{
}
else
if
(
strcmp
(
argv
[
i
],
"-u"
)
==
0
)
{
if
(
argc
==
i
+
1
)
{
if
(
argc
==
i
+
1
)
{
printHelp
();
printHelp
();
...
@@ -1141,7 +1169,8 @@ static void appendResultToFile(TAOS_RES *res, char* resultFile) {
...
@@ -1141,7 +1169,8 @@ static void appendResultToFile(TAOS_RES *res, char* resultFile) {
free
(
databuf
);
free
(
databuf
);
}
}
static
void
selectAndGetResult
(
threadInfo
*
pThreadInfo
,
char
*
command
,
char
*
resultFileName
)
{
static
void
selectAndGetResult
(
threadInfo
*
pThreadInfo
,
char
*
command
,
char
*
resultFileName
)
{
if
(
0
==
strncasecmp
(
g_queryInfo
.
queryMode
,
"taosc"
,
strlen
(
"taosc"
)))
{
if
(
0
==
strncasecmp
(
g_queryInfo
.
queryMode
,
"taosc"
,
strlen
(
"taosc"
)))
{
TAOS_RES
*
res
=
taos_query
(
pThreadInfo
->
taos
,
command
);
TAOS_RES
*
res
=
taos_query
(
pThreadInfo
->
taos
,
command
);
if
(
res
==
NULL
||
taos_errno
(
res
)
!=
0
)
{
if
(
res
==
NULL
||
taos_errno
(
res
)
!=
0
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录