Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
bcba45e3
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看板
提交
bcba45e3
编写于
7月 13, 2021
作者:
S
Shenglian Zhou
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
retry afer batch execute reconfigure table
上级
ddb783f4
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
36 addition
and
33 deletion
+36
-33
src/client/src/tscParseLineProtocol.c
src/client/src/tscParseLineProtocol.c
+33
-28
tests/examples/c/apitest.c
tests/examples/c/apitest.c
+3
-5
未找到文件。
src/client/src/tscParseLineProtocol.c
浏览文件 @
bcba45e3
...
...
@@ -324,7 +324,7 @@ static int32_t applySchemaAction(TAOS* taos, SSchemaAction* action) {
return
code
;
}
static
int32_t
dest
or
ySmlSTableSchema
(
SSmlSTableSchema
*
schema
)
{
static
int32_t
dest
ro
ySmlSTableSchema
(
SSmlSTableSchema
*
schema
)
{
taosHashCleanup
(
schema
->
tagHash
);
taosHashCleanup
(
schema
->
fieldHash
);
taosArrayDestroy
(
schema
->
tags
);
...
...
@@ -435,7 +435,7 @@ static int32_t reconcileDBSchemas(TAOS* taos, SArray* stableSchemas) {
pointSchema
->
precision
=
dbSchema
.
precision
;
dest
or
ySmlSTableSchema
(
&
dbSchema
);
dest
ro
ySmlSTableSchema
(
&
dbSchema
);
}
else
if
(
code
==
TSDB_CODE_SUCCESS
)
{
size_t
pointTagSize
=
taosArrayGetSize
(
pointSchema
->
tags
);
size_t
pointFieldSize
=
taosArrayGetSize
(
pointSchema
->
fields
);
...
...
@@ -469,7 +469,7 @@ static int32_t reconcileDBSchemas(TAOS* taos, SArray* stableSchemas) {
pointSchema
->
precision
=
dbSchema
.
precision
;
dest
or
ySmlSTableSchema
(
&
dbSchema
);
dest
ro
ySmlSTableSchema
(
&
dbSchema
);
}
else
{
return
code
;
}
...
...
@@ -565,42 +565,47 @@ static int32_t insertChildTableBatch(TAOS* taos, char* cTableName, SArray* cols
}
snprintf
(
sql
+
strlen
(
sql
)
-
1
,
freeBytes
-
strlen
(
sql
)
+
1
,
")"
);
TAOS_STMT
*
stmt
=
taos_stmt_init
(
taos
);
int32_t
code
;
code
=
taos_stmt_prepare
(
stmt
,
sql
,
strlen
(
sql
));
if
(
code
!=
0
)
{
printf
(
"%s"
,
taos_stmt_errstr
(
stmt
));
return
code
;
}
code
=
taos_stmt_set_tbname
(
stmt
,
cTableName
);
if
(
code
!=
0
)
{
printf
(
"%s"
,
taos_stmt_errstr
(
stmt
));
return
code
;
}
int32_t
code
=
0
;
int32_t
try
=
0
;
do
{
TAOS_STMT
*
stmt
=
taos_stmt_init
(
taos
);
size_t
rows
=
taosArrayGetSize
(
rowsBind
);
for
(
int32_t
i
=
0
;
i
<
rows
;
++
i
)
{
TAOS_BIND
*
colsBinds
=
taosArrayGetP
(
rowsBind
,
i
);
code
=
taos_stmt_bind_param
(
stmt
,
colsBinds
);
code
=
taos_stmt_prepare
(
stmt
,
sql
,
strlen
(
sql
));
if
(
code
!=
0
)
{
printf
(
"%s"
,
taos_stmt_errstr
(
stmt
));
return
code
;
}
code
=
taos_stmt_add_batch
(
stmt
);
code
=
taos_stmt_set_tbname
(
stmt
,
cTableName
);
if
(
code
!=
0
)
{
printf
(
"%s"
,
taos_stmt_errstr
(
stmt
));
return
code
;
}
}
code
=
taos_stmt_execute
(
stmt
);
if
(
code
!=
0
)
{
printf
(
"%s"
,
taos_stmt_errstr
(
stmt
));
return
code
;
}
size_t
rows
=
taosArrayGetSize
(
rowsBind
);
for
(
int32_t
i
=
0
;
i
<
rows
;
++
i
)
{
TAOS_BIND
*
colsBinds
=
taosArrayGetP
(
rowsBind
,
i
);
code
=
taos_stmt_bind_param
(
stmt
,
colsBinds
);
if
(
code
!=
0
)
{
printf
(
"%s"
,
taos_stmt_errstr
(
stmt
));
return
code
;
}
code
=
taos_stmt_add_batch
(
stmt
);
if
(
code
!=
0
)
{
printf
(
"%s"
,
taos_stmt_errstr
(
stmt
));
return
code
;
}
}
code
=
taos_stmt_execute
(
stmt
);
if
(
code
!=
0
)
{
printf
(
"%s"
,
taos_stmt_errstr
(
stmt
));
taos_stmt_close
(
stmt
);
}
else
{
taos_stmt_close
(
stmt
);
}
}
while
(
code
==
TSDB_CODE_TDB_TABLE_RECONFIGURE
&&
try
++
<
TSDB_MAX_REPLICA
);
taos_stmt_close
(
stmt
);
return
code
;
}
...
...
tests/examples/c/apitest.c
浏览文件 @
bcba45e3
...
...
@@ -6,7 +6,6 @@
#include <string.h>
#include <taos.h>
#include <unistd.h>
#include <tconfig.h>
static
void
prepare_data
(
TAOS
*
taos
)
{
TAOS_RES
*
result
;
...
...
@@ -972,9 +971,9 @@ int32_t verify_schema_less(TAOS* taos) {
"ste,t2=5,t3=L
\"
ste2
\"
c3=
\"
iamszhou
\"
,c4=false 1626056811843316532"
};
int
code
=
taos_insert_by_lines
(
taos
,
lines
,
5
);
//
int code = taos_insert_by_lines(taos, &lines[0], 1);
//
code = taos_insert_by_lines(taos, &lines[1], 1);
//
int code = taos_insert_by_lines(taos, lines , 5);
int
code
=
taos_insert_by_lines
(
taos
,
&
lines
[
0
],
1
);
code
=
taos_insert_by_lines
(
taos
,
&
lines
[
1
],
1
);
return
code
;
}
...
...
@@ -985,7 +984,6 @@ int main(int argc, char *argv[]) {
const
char
*
passwd
=
"taosdata"
;
taos_options
(
TSDB_OPTION_TIMEZONE
,
"GMT-8"
);
taosDumpGlobalCfg
();
TAOS
*
taos
=
taos_connect
(
host
,
user
,
passwd
,
""
,
0
);
if
(
taos
==
NULL
)
{
printf
(
"
\033
[31mfailed to connect to db, reason:%s
\033
[0m
\n
"
,
taos_errstr
(
taos
));
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录