Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
860ede89
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看板
提交
860ede89
编写于
3月 02, 2021
作者:
sangshuduo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-3113] <fix>: remove curl from TDengine. fix windows compile issue.
上级
b2294d84
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
12 addition
and
12 deletion
+12
-12
src/kit/taosdemo/taosdemo.c
src/kit/taosdemo/taosdemo.c
+12
-12
未找到文件。
src/kit/taosdemo/taosdemo.c
浏览文件 @
860ede89
...
@@ -65,6 +65,9 @@
...
@@ -65,6 +65,9 @@
#define ENABLE_VIRTUAL_TERMINAL_PROCESSING 0x0004
#define ENABLE_VIRTUAL_TERMINAL_PROCESSING 0x0004
#endif
#endif
#define REQ_EXTRA_BUF_LEN 1024
#define RESP_BUF_LEN 4096
static
HANDLE
g_stdoutHandle
;
static
HANDLE
g_stdoutHandle
;
static
DWORD
g_consoleMode
;
static
DWORD
g_consoleMode
;
...
@@ -1510,10 +1513,7 @@ static void printfQuerySystemInfo(TAOS * taos) {
...
@@ -1510,10 +1513,7 @@ static void printfQuerySystemInfo(TAOS * taos) {
}
}
#define REQ_EXTRA_BUF_LEN 1024
void
ERROR_EXIT
(
const
char
*
msg
)
{
perror
(
msg
);
exit
(
0
);
}
#define RESP_BUF_LEN 4096
void
ERROR
(
const
char
*
msg
)
{
perror
(
msg
);
exit
(
0
);
}
int
postProceSql
(
char
*
host
,
uint16_t
port
,
char
*
sqlstr
)
int
postProceSql
(
char
*
host
,
uint16_t
port
,
char
*
sqlstr
)
{
{
...
@@ -1533,7 +1533,7 @@ int postProceSql(char* host, uint16_t port, char* sqlstr)
...
@@ -1533,7 +1533,7 @@ int postProceSql(char* host, uint16_t port, char* sqlstr)
request_buf
=
malloc
(
req_buf_len
);
request_buf
=
malloc
(
req_buf_len
);
if
(
NULL
==
request_buf
)
if
(
NULL
==
request_buf
)
ERROR
(
"ERROR, cannot allocate memory."
);
ERROR
_EXIT
(
"ERROR, cannot allocate memory."
);
int
r
=
snprintf
(
request_buf
,
int
r
=
snprintf
(
request_buf
,
req_buf_len
,
req_buf_len
,
...
@@ -1541,20 +1541,20 @@ int postProceSql(char* host, uint16_t port, char* sqlstr)
...
@@ -1541,20 +1541,20 @@ int postProceSql(char* host, uint16_t port, char* sqlstr)
auth
,
strlen
(
sqlstr
),
sqlstr
);
auth
,
strlen
(
sqlstr
),
sqlstr
);
if
(
r
>=
req_buf_len
)
{
if
(
r
>=
req_buf_len
)
{
free
(
request_buf
);
free
(
request_buf
);
ERROR
(
"ERROR too long request"
);
ERROR
_EXIT
(
"ERROR too long request"
);
}
}
printf
(
"Request:
\n
%s
\n
"
,
request_buf
);
printf
(
"Request:
\n
%s
\n
"
,
request_buf
);
sockfd
=
socket
(
AF_INET
,
SOCK_STREAM
,
0
);
sockfd
=
socket
(
AF_INET
,
SOCK_STREAM
,
0
);
if
(
sockfd
<
0
)
{
if
(
sockfd
<
0
)
{
free
(
request_buf
);
free
(
request_buf
);
ERROR
(
"ERROR opening socket"
);
ERROR
_EXIT
(
"ERROR opening socket"
);
}
}
server
=
gethostbyname
(
host
);
server
=
gethostbyname
(
host
);
if
(
server
==
NULL
)
{
if
(
server
==
NULL
)
{
free
(
request_buf
);
free
(
request_buf
);
ERROR
(
"ERROR, no such host"
);
ERROR
_EXIT
(
"ERROR, no such host"
);
}
}
memset
(
&
serv_addr
,
0
,
sizeof
(
serv_addr
));
memset
(
&
serv_addr
,
0
,
sizeof
(
serv_addr
));
...
@@ -1564,7 +1564,7 @@ int postProceSql(char* host, uint16_t port, char* sqlstr)
...
@@ -1564,7 +1564,7 @@ int postProceSql(char* host, uint16_t port, char* sqlstr)
if
(
connect
(
sockfd
,(
struct
sockaddr
*
)
&
serv_addr
,
sizeof
(
serv_addr
))
<
0
)
{
if
(
connect
(
sockfd
,(
struct
sockaddr
*
)
&
serv_addr
,
sizeof
(
serv_addr
))
<
0
)
{
free
(
request_buf
);
free
(
request_buf
);
ERROR
(
"ERROR connecting"
);
ERROR
_EXIT
(
"ERROR connecting"
);
}
}
req_str_len
=
strlen
(
request_buf
);
req_str_len
=
strlen
(
request_buf
);
...
@@ -1572,7 +1572,7 @@ int postProceSql(char* host, uint16_t port, char* sqlstr)
...
@@ -1572,7 +1572,7 @@ int postProceSql(char* host, uint16_t port, char* sqlstr)
do
{
do
{
bytes
=
write
(
sockfd
,
request_buf
+
sent
,
req_str_len
-
sent
);
bytes
=
write
(
sockfd
,
request_buf
+
sent
,
req_str_len
-
sent
);
if
(
bytes
<
0
)
if
(
bytes
<
0
)
ERROR
(
"ERROR writing message to socket"
);
ERROR
_EXIT
(
"ERROR writing message to socket"
);
if
(
bytes
==
0
)
if
(
bytes
==
0
)
break
;
break
;
sent
+=
bytes
;
sent
+=
bytes
;
...
@@ -1585,7 +1585,7 @@ int postProceSql(char* host, uint16_t port, char* sqlstr)
...
@@ -1585,7 +1585,7 @@ int postProceSql(char* host, uint16_t port, char* sqlstr)
bytes
=
read
(
sockfd
,
response_buf
+
received
,
resp_len
-
received
);
bytes
=
read
(
sockfd
,
response_buf
+
received
,
resp_len
-
received
);
if
(
bytes
<
0
)
{
if
(
bytes
<
0
)
{
free
(
request_buf
);
free
(
request_buf
);
ERROR
(
"ERROR reading response from socket"
);
ERROR
_EXIT
(
"ERROR reading response from socket"
);
}
}
if
(
bytes
==
0
)
if
(
bytes
==
0
)
break
;
break
;
...
@@ -1594,7 +1594,7 @@ int postProceSql(char* host, uint16_t port, char* sqlstr)
...
@@ -1594,7 +1594,7 @@ int postProceSql(char* host, uint16_t port, char* sqlstr)
if
(
received
==
resp_len
)
{
if
(
received
==
resp_len
)
{
free
(
request_buf
);
free
(
request_buf
);
ERROR
(
"ERROR storing complete response from socket"
);
ERROR
_EXIT
(
"ERROR storing complete response from socket"
);
}
}
printf
(
"Response:
\n
%s
\n
"
,
response_buf
);
printf
(
"Response:
\n
%s
\n
"
,
response_buf
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录