Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
yiicenne
TDengine
提交
2e06575a
TDengine
项目概览
yiicenne
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
2e06575a
编写于
4月 05, 2020
作者:
H
hjxilinx
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-98] fix a typo
上级
d8aa6d93
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
34 addition
and
31 deletion
+34
-31
src/rpc/src/rpcMain.c
src/rpc/src/rpcMain.c
+0
-4
tests/examples/c/demo.c
tests/examples/c/demo.c
+34
-27
未找到文件。
src/rpc/src/rpcMain.c
浏览文件 @
2e06575a
...
...
@@ -1100,10 +1100,6 @@ static void rpcProcessConnError(void *param, void *id) {
SRpcInfo
*
pRpc
=
pContext
->
pRpc
;
SRpcMsg
rpcMsg
;
if
(
pRpc
==
NULL
)
{
return
;
}
tTrace
(
"%s connection error happens"
,
pRpc
->
label
);
if
(
pContext
->
numOfTry
>=
pContext
->
ipSet
.
numOfIps
)
{
...
...
tests/examples/c/demo.c
浏览文件 @
2e06575a
...
...
@@ -24,6 +24,29 @@
void
taosMsleep
(
int
mseconds
);
static
int32_t
doQuery
(
TAOS
*
taos
,
const
char
*
sql
)
{
int32_t
code
=
taos_query
(
taos
,
sql
);
if
(
code
!=
0
)
{
printf
(
"failed to execute query, reason:%s
\n
"
,
taos_errstr
(
taos
));
return
-
1
;
}
TAOS_RES
*
res
=
taos_use_result
(
taos
);
TAOS_ROW
row
=
NULL
;
char
buf
[
512
]
=
{
0
};
int32_t
numOfFields
=
taos_num_fields
(
res
);
TAOS_FIELD
*
pFields
=
taos_fetch_fields
(
res
);
while
((
row
=
taos_fetch_row
(
res
))
!=
NULL
)
{
taos_print_row
(
buf
,
row
,
pFields
,
numOfFields
);
printf
(
"%s
\n
"
,
buf
);
memset
(
buf
,
0
,
512
);
}
taos_free_result
(
res
);
}
int
main
(
int
argc
,
char
*
argv
[])
{
TAOS
*
taos
;
char
qstr
[
1024
];
...
...
@@ -35,7 +58,7 @@ int main(int argc, char *argv[]) {
return
0
;
}
taos_options
(
TSDB_OPTION_CONFIGDIR
,
"~/
first
/cfg"
);
taos_options
(
TSDB_OPTION_CONFIGDIR
,
"~/
sec
/cfg"
);
// init TAOS
taos_init
();
...
...
@@ -45,25 +68,16 @@ int main(int argc, char *argv[]) {
exit
(
1
);
}
printf
(
"success to connect to server
\n
"
);
// int32_t code = taos_query(taos, "insert into test.tm2 values(now, 1)(now+1m,2)(now+2m,3) (now+3m, 4) (now+4m, 5);");
int32_t
code
=
taos_query
(
taos
,
"insert into test.tm2 values(now, 99)"
);
if
(
code
!=
0
)
{
printf
(
"failed to execute query, reason:%s
\n
"
,
taos_errstr
(
taos
));
}
TAOS_RES
*
res
=
taos_use_result
(
taos
);
TAOS_ROW
row
=
NULL
;
char
buf
[
512
]
=
{
0
};
int32_t
numOfFields
=
taos_num_fields
(
res
);
TAOS_FIELD
*
pFields
=
taos_fetch_fields
(
res
);
while
((
row
=
taos_fetch_row
(
res
))
!=
NULL
)
{
taos_print_row
(
buf
,
row
,
pFields
,
numOfFields
);
printf
(
"%s
\n
"
,
buf
);
memset
(
buf
,
0
,
512
);
}
doQuery
(
taos
,
"create database if not exists test"
);
doQuery
(
taos
,
"use test"
);
doQuery
(
taos
,
"create table if not exists tm0 (ts timestamp, k int);"
);
doQuery
(
taos
,
"insert into tm0 values(now, 1)(now+1s, 2)(now+2s, 3)(now+3s, 4);"
);
doQuery
(
taos
,
"select * from tm0;"
);
// doQuery(taos, "insert into tm01 values(now, 1)(now+1s, 2)(now+2s, 3)(now+3s, 4);");
// doQuery(taos, "insert into tm0 values(now, 1)(now+1s, 2)(now+2s, 3)(now+3s, 4);");
// doQuery(taos, "insert into tm0 values(now, 1)(now+1s, 2)(now+2s, 3)(now+3s, 4);");
// doQuery(taos, "insert into tm0 values(now, 1)(now+1s, 2)(now+2s, 3)(now+3s, 4);");
taos_close
(
taos
);
...
...
@@ -119,14 +133,7 @@ int main(int argc, char *argv[]) {
int
num_fields
=
taos_field_count
(
taos
);
TAOS_FIELD
*
fields
=
taos_fetch_fields
(
result
);
char
temp
[
256
];
printf
(
"select * from table, result:
\n
"
);
// fetch the records row by row
while
((
row
=
taos_fetch_row
(
result
)))
{
rows
++
;
taos_print_row
(
temp
,
row
,
fields
,
num_fields
);
printf
(
"%s
\n
"
,
temp
);
}
taos_free_result
(
result
);
printf
(
"====demo end====
\n\n
"
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录