Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
2d1848b7
T
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1192
Star
22018
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看板
提交
2d1848b7
编写于
10月 24, 2021
作者:
G
Ganlin Zhao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-10700]<enhance>: The escape char backstick can be used for both tag name and column name
上级
572d2fbe
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
13 addition
and
11 deletion
+13
-11
src/client/src/tscParseLineProtocol.c
src/client/src/tscParseLineProtocol.c
+13
-11
未找到文件。
src/client/src/tscParseLineProtocol.c
浏览文件 @
2d1848b7
...
@@ -1175,13 +1175,15 @@ static void escapeSpecialCharacter(uint8_t field, const char **pos) {
...
@@ -1175,13 +1175,15 @@ static void escapeSpecialCharacter(uint8_t field, const char **pos) {
*
pos
=
cur
;
*
pos
=
cur
;
}
}
void
addEscapeChartoString
(
char
*
str
,
int
32_t
l
en
)
{
void
addEscapeChartoString
(
char
*
str
,
int
16_t
*
bufL
en
)
{
if
(
str
==
NULL
)
{
if
(
str
==
NULL
)
{
return
;
return
;
}
}
int16_t
len
=
*
bufLen
;
memmove
(
str
+
1
,
str
,
len
);
memmove
(
str
+
1
,
str
,
len
);
str
[
0
]
=
str
[
len
]
=
TS_ESCAPE_CHAR
;
str
[
0
]
=
str
[
len
+
1
]
=
TS_ESCAPE_CHAR
;
str
[
len
+
1
]
=
'\0'
;
str
[
len
+
2
]
=
'\0'
;
*
bufLen
+=
SML_ESCAPE_CHAR_SIZE
;
}
}
bool
isValidInteger
(
char
*
str
)
{
bool
isValidInteger
(
char
*
str
)
{
...
@@ -1893,7 +1895,7 @@ bool checkDuplicateKey(char *key, SHashObj *pHash, SSmlLinesInfo* info) {
...
@@ -1893,7 +1895,7 @@ bool checkDuplicateKey(char *key, SHashObj *pHash, SSmlLinesInfo* info) {
static
int32_t
parseSmlKey
(
TAOS_SML_KV
*
pKV
,
const
char
**
index
,
SHashObj
*
pHash
,
SSmlLinesInfo
*
info
)
{
static
int32_t
parseSmlKey
(
TAOS_SML_KV
*
pKV
,
const
char
**
index
,
SHashObj
*
pHash
,
SSmlLinesInfo
*
info
)
{
const
char
*
cur
=
*
index
;
const
char
*
cur
=
*
index
;
char
key
[
TSDB_COL_NAME_LEN
+
1
];
// +1 to avoid key[len] over write
char
key
[
TSDB_COL_NAME_LEN
+
1
];
// +1 to avoid key[len] over write
u
int16_t
len
=
0
;
int16_t
len
=
0
;
while
(
*
cur
!=
'\0'
)
{
while
(
*
cur
!=
'\0'
)
{
if
(
len
>
TSDB_COL_NAME_LEN
-
1
)
{
if
(
len
>
TSDB_COL_NAME_LEN
-
1
)
{
...
@@ -1923,10 +1925,10 @@ static int32_t parseSmlKey(TAOS_SML_KV *pKV, const char **index, SHashObj *pHash
...
@@ -1923,10 +1925,10 @@ static int32_t parseSmlKey(TAOS_SML_KV *pKV, const char **index, SHashObj *pHash
return
TSDB_CODE_TSC_LINE_SYNTAX_ERROR
;
return
TSDB_CODE_TSC_LINE_SYNTAX_ERROR
;
}
}
pKV
->
key
=
calloc
(
len
+
TS_ESCAPE_CHAR
+
1
,
1
);
pKV
->
key
=
calloc
(
len
+
SML_ESCAPE_CHAR_SIZE
+
1
,
1
);
memcpy
(
pKV
->
key
,
key
,
len
+
1
);
memcpy
(
pKV
->
key
,
key
,
len
+
1
);
addEscapeChartoString
(
pKV
->
key
,
len
);
addEscapeChartoString
(
pKV
->
key
,
&
len
);
//
tscDebug("SML:0x%"PRIx64" Key:%s|len:%d", info->id, pKV->key, len);
tscDebug
(
"SML:0x%"
PRIx64
" Key:%s|len:%d"
,
info
->
id
,
pKV
->
key
,
len
);
*
index
=
cur
+
1
;
*
index
=
cur
+
1
;
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
...
@@ -1937,7 +1939,7 @@ static int32_t parseSmlValue(TAOS_SML_KV *pKV, const char **index,
...
@@ -1937,7 +1939,7 @@ static int32_t parseSmlValue(TAOS_SML_KV *pKV, const char **index,
const
char
*
start
,
*
cur
;
const
char
*
start
,
*
cur
;
int32_t
ret
=
TSDB_CODE_SUCCESS
;
int32_t
ret
=
TSDB_CODE_SUCCESS
;
char
*
value
=
NULL
;
char
*
value
=
NULL
;
u
int16_t
len
=
0
;
int16_t
len
=
0
;
bool
searchQuote
=
false
;
bool
searchQuote
=
false
;
start
=
cur
=
*
index
;
start
=
cur
=
*
index
;
...
@@ -2018,7 +2020,7 @@ error:
...
@@ -2018,7 +2020,7 @@ error:
static
int32_t
parseSmlMeasurement
(
TAOS_SML_DATA_POINT
*
pSml
,
const
char
**
index
,
static
int32_t
parseSmlMeasurement
(
TAOS_SML_DATA_POINT
*
pSml
,
const
char
**
index
,
uint8_t
*
has_tags
,
SSmlLinesInfo
*
info
)
{
uint8_t
*
has_tags
,
SSmlLinesInfo
*
info
)
{
const
char
*
cur
=
*
index
;
const
char
*
cur
=
*
index
;
u
int16_t
len
=
0
;
int16_t
len
=
0
;
pSml
->
stableName
=
calloc
(
TSDB_TABLE_NAME_LEN
+
SML_ESCAPE_CHAR_SIZE
,
1
);
pSml
->
stableName
=
calloc
(
TSDB_TABLE_NAME_LEN
+
SML_ESCAPE_CHAR_SIZE
,
1
);
if
(
pSml
->
stableName
==
NULL
){
if
(
pSml
->
stableName
==
NULL
){
...
@@ -2060,7 +2062,7 @@ static int32_t parseSmlMeasurement(TAOS_SML_DATA_POINT *pSml, const char **index
...
@@ -2060,7 +2062,7 @@ static int32_t parseSmlMeasurement(TAOS_SML_DATA_POINT *pSml, const char **index
pSml
->
stableName
=
NULL
;
pSml
->
stableName
=
NULL
;
return
TSDB_CODE_TSC_LINE_SYNTAX_ERROR
;
return
TSDB_CODE_TSC_LINE_SYNTAX_ERROR
;
}
}
addEscapeChartoString
(
pSml
->
stableName
,
len
);
addEscapeChartoString
(
pSml
->
stableName
,
&
len
);
*
index
=
cur
+
1
;
*
index
=
cur
+
1
;
tscDebug
(
"SML:0x%"
PRIx64
" Stable name in measurement:%s|len:%d"
,
info
->
id
,
pSml
->
stableName
,
len
);
tscDebug
(
"SML:0x%"
PRIx64
" Stable name in measurement:%s|len:%d"
,
info
->
id
,
pSml
->
stableName
,
len
);
...
@@ -2120,7 +2122,7 @@ static int32_t parseSmlKvPairs(TAOS_SML_KV **pKVs, int *num_kvs,
...
@@ -2120,7 +2122,7 @@ static int32_t parseSmlKvPairs(TAOS_SML_KV **pKVs, int *num_kvs,
smlData
->
childTableName
=
malloc
(
pkv
->
length
+
SML_ESCAPE_CHAR_SIZE
+
1
);
smlData
->
childTableName
=
malloc
(
pkv
->
length
+
SML_ESCAPE_CHAR_SIZE
+
1
);
memcpy
(
smlData
->
childTableName
,
pkv
->
value
,
pkv
->
length
);
memcpy
(
smlData
->
childTableName
,
pkv
->
value
,
pkv
->
length
);
strntolower_s
(
smlData
->
childTableName
,
smlData
->
childTableName
,
(
int32_t
)
pkv
->
length
);
strntolower_s
(
smlData
->
childTableName
,
smlData
->
childTableName
,
(
int32_t
)
pkv
->
length
);
addEscapeChartoString
(
smlData
->
childTableName
,
(
int32_t
)
pkv
->
length
);
//
addEscapeChartoString(smlData->childTableName, (int32_t)pkv->length);
free
(
pkv
->
key
);
free
(
pkv
->
key
);
free
(
pkv
->
value
);
free
(
pkv
->
value
);
}
else
{
}
else
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录