Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
88bc367b
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1184
Star
22015
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
88bc367b
编写于
7月 22, 2021
作者:
S
shenglian zhou
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-5449]<fix>:adapt max sql string length for maxium tags/columns in line protocol
上级
ad55c1a7
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
12 addition
and
6 deletion
+12
-6
src/client/src/tscParseLineProtocol.c
src/client/src/tscParseLineProtocol.c
+12
-6
未找到文件。
src/client/src/tscParseLineProtocol.c
浏览文件 @
88bc367b
...
@@ -298,9 +298,9 @@ static int32_t buildColumnDescription(SSchema* field,
...
@@ -298,9 +298,9 @@ static int32_t buildColumnDescription(SSchema* field,
static
int32_t
applySchemaAction
(
TAOS
*
taos
,
SSchemaAction
*
action
)
{
static
int32_t
applySchemaAction
(
TAOS
*
taos
,
SSchemaAction
*
action
)
{
int32_t
code
=
0
;
int32_t
code
=
0
;
int32_t
capacity
=
TSDB_MAX_BINARY_LEN
;
int32_t
outBytes
=
0
;
int32_t
outBytes
=
0
;
char
*
result
=
(
char
*
)
calloc
(
1
,
capacity
);
char
*
result
=
(
char
*
)
calloc
(
1
,
tsMaxSQLStringLen
+
1
);
int32_t
capacity
=
tsMaxSQLStringLen
+
1
;
tscDebug
(
"apply schema action: %d"
,
action
->
action
);
tscDebug
(
"apply schema action: %d"
,
action
->
action
);
switch
(
action
->
action
)
{
switch
(
action
->
action
)
{
...
@@ -572,8 +572,8 @@ static int32_t getSmlMd5ChildTableName(TAOS_SML_DATA_POINT* point, char* tableNa
...
@@ -572,8 +572,8 @@ static int32_t getSmlMd5ChildTableName(TAOS_SML_DATA_POINT* point, char* tableNa
static
int32_t
creatChildTableIfNotExists
(
TAOS
*
taos
,
const
char
*
cTableName
,
const
char
*
sTableName
,
SArray
*
tagsSchema
,
SArray
*
tagsBind
)
{
static
int32_t
creatChildTableIfNotExists
(
TAOS
*
taos
,
const
char
*
cTableName
,
const
char
*
sTableName
,
SArray
*
tagsSchema
,
SArray
*
tagsBind
)
{
size_t
numTags
=
taosArrayGetSize
(
tagsSchema
);
size_t
numTags
=
taosArrayGetSize
(
tagsSchema
);
char
sql
[
TSDB_MAX_BINARY_LEN
]
=
{
0
}
;
char
*
sql
=
malloc
(
tsMaxSQLStringLen
+
1
)
;
int
freeBytes
=
TSDB_MAX_BINARY_LEN
;
int
freeBytes
=
tsMaxSQLStringLen
+
1
;
sprintf
(
sql
,
"create table if not exists %s using %s"
,
cTableName
,
sTableName
);
sprintf
(
sql
,
"create table if not exists %s using %s"
,
cTableName
,
sTableName
);
snprintf
(
sql
+
strlen
(
sql
),
freeBytes
-
strlen
(
sql
),
"("
);
snprintf
(
sql
+
strlen
(
sql
),
freeBytes
-
strlen
(
sql
),
"("
);
...
@@ -589,12 +589,15 @@ static int32_t creatChildTableIfNotExists(TAOS* taos, const char* cTableName, co
...
@@ -589,12 +589,15 @@ static int32_t creatChildTableIfNotExists(TAOS* taos, const char* cTableName, co
snprintf
(
sql
+
strlen
(
sql
),
freeBytes
-
strlen
(
sql
),
"?,"
);
snprintf
(
sql
+
strlen
(
sql
),
freeBytes
-
strlen
(
sql
),
"?,"
);
}
}
snprintf
(
sql
+
strlen
(
sql
)
-
1
,
freeBytes
-
strlen
(
sql
)
+
1
,
")"
);
snprintf
(
sql
+
strlen
(
sql
)
-
1
,
freeBytes
-
strlen
(
sql
)
+
1
,
")"
);
sql
[
strlen
(
sql
)]
=
'\0'
;
tscDebug
(
"create table : %s"
,
sql
);
tscDebug
(
"create table : %s"
,
sql
);
TAOS_STMT
*
stmt
=
taos_stmt_init
(
taos
);
TAOS_STMT
*
stmt
=
taos_stmt_init
(
taos
);
int32_t
code
;
int32_t
code
;
code
=
taos_stmt_prepare
(
stmt
,
sql
,
(
unsigned
long
)
strlen
(
sql
));
code
=
taos_stmt_prepare
(
stmt
,
sql
,
(
unsigned
long
)
strlen
(
sql
));
free
(
sql
);
if
(
code
!=
0
)
{
if
(
code
!=
0
)
{
tscError
(
"%s"
,
taos_stmt_errstr
(
stmt
));
tscError
(
"%s"
,
taos_stmt_errstr
(
stmt
));
return
code
;
return
code
;
...
@@ -622,8 +625,8 @@ static int32_t creatChildTableIfNotExists(TAOS* taos, const char* cTableName, co
...
@@ -622,8 +625,8 @@ static int32_t creatChildTableIfNotExists(TAOS* taos, const char* cTableName, co
static
int32_t
insertChildTableBatch
(
TAOS
*
taos
,
char
*
cTableName
,
SArray
*
colsSchema
,
SArray
*
rowsBind
)
{
static
int32_t
insertChildTableBatch
(
TAOS
*
taos
,
char
*
cTableName
,
SArray
*
colsSchema
,
SArray
*
rowsBind
)
{
size_t
numCols
=
taosArrayGetSize
(
colsSchema
);
size_t
numCols
=
taosArrayGetSize
(
colsSchema
);
char
sql
[
TSDB_MAX_BINARY_LEN
]
;
char
*
sql
=
malloc
(
tsMaxSQLStringLen
+
1
)
;
int32_t
freeBytes
=
TSDB_MAX_BINARY_LEN
;
int32_t
freeBytes
=
tsMaxSQLStringLen
+
1
;
sprintf
(
sql
,
"insert into ? ("
);
sprintf
(
sql
,
"insert into ? ("
);
for
(
int
i
=
0
;
i
<
numCols
;
++
i
)
{
for
(
int
i
=
0
;
i
<
numCols
;
++
i
)
{
...
@@ -636,6 +639,7 @@ static int32_t insertChildTableBatch(TAOS* taos, char* cTableName, SArray* cols
...
@@ -636,6 +639,7 @@ static int32_t insertChildTableBatch(TAOS* taos, char* cTableName, SArray* cols
snprintf
(
sql
+
strlen
(
sql
),
freeBytes
-
strlen
(
sql
),
"?,"
);
snprintf
(
sql
+
strlen
(
sql
),
freeBytes
-
strlen
(
sql
),
"?,"
);
}
}
snprintf
(
sql
+
strlen
(
sql
)
-
1
,
freeBytes
-
strlen
(
sql
)
+
1
,
")"
);
snprintf
(
sql
+
strlen
(
sql
)
-
1
,
freeBytes
-
strlen
(
sql
)
+
1
,
")"
);
sql
[
strlen
(
sql
)]
=
'\0'
;
tscDebug
(
"insert rows %zu into child table %s. "
,
taosArrayGetSize
(
rowsBind
),
cTableName
);
tscDebug
(
"insert rows %zu into child table %s. "
,
taosArrayGetSize
(
rowsBind
),
cTableName
);
...
@@ -645,6 +649,8 @@ static int32_t insertChildTableBatch(TAOS* taos, char* cTableName, SArray* cols
...
@@ -645,6 +649,8 @@ static int32_t insertChildTableBatch(TAOS* taos, char* cTableName, SArray* cols
TAOS_STMT
*
stmt
=
taos_stmt_init
(
taos
);
TAOS_STMT
*
stmt
=
taos_stmt_init
(
taos
);
code
=
taos_stmt_prepare
(
stmt
,
sql
,
(
unsigned
long
)
strlen
(
sql
));
code
=
taos_stmt_prepare
(
stmt
,
sql
,
(
unsigned
long
)
strlen
(
sql
));
free
(
sql
);
if
(
code
!=
0
)
{
if
(
code
!=
0
)
{
tscError
(
"%s"
,
taos_stmt_errstr
(
stmt
));
tscError
(
"%s"
,
taos_stmt_errstr
(
stmt
));
return
code
;
return
code
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录