Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
e01365f4
T
TDengine
项目概览
慢慢CG
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
e01365f4
编写于
3月 10, 2021
作者:
S
Shuduo Sang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-3143] <fix>: make taosdemo restful work on Windows.
上级
07d234af
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
30 addition
and
26 deletion
+30
-26
src/kit/taosdemo/taosdemo.c
src/kit/taosdemo/taosdemo.c
+30
-26
未找到文件。
src/kit/taosdemo/taosdemo.c
浏览文件 @
e01365f4
...
...
@@ -1601,7 +1601,7 @@ void ERROR_EXIT(const char *msg) { perror(msg); exit(0); }
int
postProceSql
(
char
*
host
,
uint16_t
port
,
char
*
sqlstr
)
{
char
*
req_fmt
=
"POST %s HTTP/1.1
\r\n
Host: %s:%d
\r\n
Accept: */*
\r\n
%s
\r\n
Content-Length: %d
\r\n
Content-Type: application/x-www-form-urlencoded
\r\n\r\n
%s"
;
char
*
req_fmt
=
"POST %s HTTP/1.1
\r\n
Host: %s:%d
\r\n
Accept: */*
\r\n
Authorization: Basic
%s
\r\n
Content-Length: %d
\r\n
Content-Type: application/x-www-form-urlencoded
\r\n\r\n
%s"
;
char
*
url
=
"/rest/sql"
;
...
...
@@ -1656,7 +1656,7 @@ int postProceSql(char* host, uint16_t port, char* sqlstr)
for
(
int
l
=
0
;
l
<
mod_table
[
userpass_buf_len
%
3
];
l
++
)
base64_buf
[
encoded_len
-
1
-
l
]
=
'='
;
printf
(
"auth string base64 encoded: %s
\n
"
,
base64_buf
);
debugPrint
(
"%s() LN%d: auth string base64 encoded: %s
\n
"
,
__func__
,
__LINE__
,
base64_buf
);
char
*
auth
=
base64_buf
;
#ifdef TD_WINDOWS
...
...
@@ -1705,7 +1705,7 @@ int postProceSql(char* host, uint16_t port, char* sqlstr)
free
(
request_buf
);
ERROR_EXIT
(
"ERROR too long request"
);
}
printf
(
"Request:
\n
%s
\n
"
,
request_buf
);
verbosePrint
(
"%s() LN%d: Request:
\n
%s
\n
"
,
__func__
,
__LINE__
,
request_buf
);
req_str_len
=
strlen
(
request_buf
);
sent
=
0
;
...
...
@@ -4447,42 +4447,46 @@ static void* syncWriteWithStb(void *sarg) {
winfo
->
totalRowsInserted
+=
k
;
int64_t
startTs
=
taosGetTimestampUs
();
int64_t
endTs
;
int
affectedRows
;
if
(
0
==
strncasecmp
(
superTblInfo
->
insertMode
,
"taosc"
,
strlen
(
"taosc"
)))
{
int64_t
startTs
;
int64_t
endTs
;
startTs
=
taosGetTimestampUs
();
verbosePrint
(
"%s() LN%d %s
\n
"
,
__func__
,
__LINE__
,
buffer
);
int
affectedRows
=
queryDbExec
(
winfo
->
taos
,
buffer
,
INSERT_TYPE
);
affectedRows
=
queryDbExec
(
winfo
->
taos
,
buffer
,
INSERT_TYPE
);
if
(
0
>
affectedRows
){
goto
free_and_statistics_2
;
}
else
{
endTs
=
taosGetTimestampUs
();
int64_t
delay
=
endTs
-
startTs
;
if
(
delay
>
winfo
->
maxDelay
)
winfo
->
maxDelay
=
delay
;
if
(
delay
<
winfo
->
minDelay
)
winfo
->
minDelay
=
delay
;
winfo
->
cntDelay
++
;
winfo
->
totalDelay
+=
delay
;
}
winfo
->
totalAffectedRows
+=
affectedRows
;
int64_t
currentPrintTime
=
taosGetTimestampMs
();
if
(
currentPrintTime
-
lastPrintTime
>
30
*
1000
)
{
printf
(
"thread[%d] has currently inserted rows: %"
PRId64
", affected rows: %"
PRId64
"
\n
"
,
winfo
->
threadID
,
winfo
->
totalRowsInserted
,
winfo
->
totalAffectedRows
);
lastPrintTime
=
currentPrintTime
;
}
}
else
{
verbosePrint
(
"%s() LN%d %s
\n
"
,
__func__
,
__LINE__
,
buffer
);
int
retCode
=
postProceSql
(
g_Dbs
.
host
,
g_Dbs
.
port
,
buffer
);
if
(
0
!=
retCode
)
{
printf
(
"========restful return fail, threadID[%d]
\n
"
,
winfo
->
threadID
);
goto
free_and_statistics_2
;
}
affectedRows
=
k
;
}
endTs
=
taosGetTimestampUs
();
int64_t
delay
=
endTs
-
startTs
;
if
(
delay
>
winfo
->
maxDelay
)
winfo
->
maxDelay
=
delay
;
if
(
delay
<
winfo
->
minDelay
)
winfo
->
minDelay
=
delay
;
winfo
->
cntDelay
++
;
winfo
->
totalDelay
+=
delay
;
winfo
->
totalAffectedRows
+=
affectedRows
;
int64_t
currentPrintTime
=
taosGetTimestampMs
();
if
(
currentPrintTime
-
lastPrintTime
>
30
*
1000
)
{
printf
(
"thread[%d] has currently inserted rows: %"
PRId64
", affected rows: %"
PRId64
"
\n
"
,
winfo
->
threadID
,
winfo
->
totalRowsInserted
,
winfo
->
totalAffectedRows
);
lastPrintTime
=
currentPrintTime
;
}
if
(
g_args
.
insert_interval
)
{
et
=
taosGetTimestampMs
();
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录