Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
9b0ca45e
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
9b0ca45e
编写于
11月 10, 2021
作者:
G
Ganlin Zhao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-10897]<fix>: SchemaLess : Schemaless will auto convert Convert uppercase letters to lowercase
上级
3a93cbee
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
14 addition
and
27 deletion
+14
-27
src/client/src/tscParseLineProtocol.c
src/client/src/tscParseLineProtocol.c
+13
-26
src/client/src/tscPrepare.c
src/client/src/tscPrepare.c
+1
-1
未找到文件。
src/client/src/tscParseLineProtocol.c
浏览文件 @
9b0ca45e
...
...
@@ -261,10 +261,10 @@ static int32_t buildDataPointSchemas(TAOS_SML_DATA_POINT* points, int numPoint,
static
int32_t
generateSchemaAction
(
SSchema
*
pointColField
,
SHashObj
*
dbAttrHash
,
SArray
*
dbAttrArray
,
bool
isTag
,
char
sTableName
[],
SSchemaAction
*
action
,
bool
*
actionNeeded
,
SSmlLinesInfo
*
info
)
{
char
fieldName
LowerCase
[
TSDB_COL_NAME_LEN
+
TS_ESCAPE_CHAR_SIZE
]
=
{
0
};
str
tolower
(
fieldNameLowerCas
e
,
pointColField
->
name
);
char
fieldName
[
TSDB_COL_NAME_LEN
+
TS_ESCAPE_CHAR_SIZE
]
=
{
0
};
str
cpy
(
fieldNam
e
,
pointColField
->
name
);
size_t
*
pDbIndex
=
taosHashGet
(
dbAttrHash
,
fieldName
LowerCase
,
strlen
(
fieldNameLowerCas
e
));
size_t
*
pDbIndex
=
taosHashGet
(
dbAttrHash
,
fieldName
,
strlen
(
fieldNam
e
));
if
(
pDbIndex
)
{
SSchema
*
dbAttr
=
taosArrayGet
(
dbAttrArray
,
*
pDbIndex
);
assert
(
strcasecmp
(
dbAttr
->
name
,
pointColField
->
name
)
==
0
);
...
...
@@ -297,7 +297,7 @@ static int32_t generateSchemaAction(SSchema* pointColField, SHashObj* dbAttrHash
*
actionNeeded
=
true
;
}
if
(
*
actionNeeded
)
{
tscDebug
(
"SML:0x%"
PRIx64
" generate schema action. column name: %s, action: %d"
,
info
->
id
,
fieldName
LowerCase
,
tscDebug
(
"SML:0x%"
PRIx64
" generate schema action. column name: %s, action: %d"
,
info
->
id
,
fieldName
,
action
->
action
);
}
return
0
;
...
...
@@ -536,11 +536,8 @@ static int32_t retrieveTableMeta(TAOS* taos, char* tableName, STableMeta** pTabl
tscDebug
(
"SML:0x%"
PRIx64
" retrieve table meta. super table name: %s"
,
info
->
id
,
tableName
);
char
tableNameLowerCase
[
TSDB_TABLE_NAME_LEN
+
TS_ESCAPE_CHAR_SIZE
];
strtolower
(
tableNameLowerCase
,
tableName
);
char
sql
[
256
];
snprintf
(
sql
,
256
,
"describe %s"
,
tableName
LowerCase
);
snprintf
(
sql
,
256
,
"describe %s"
,
tableName
);
TAOS_RES
*
res
=
taos_query
(
taos
,
sql
);
code
=
taos_errno
(
res
);
if
(
code
!=
0
)
{
...
...
@@ -561,8 +558,10 @@ static int32_t retrieveTableMeta(TAOS* taos, char* tableName, STableMeta** pTabl
pSql
->
fp
=
NULL
;
registerSqlObj
(
pSql
);
SStrToken
tableToken
=
{.
z
=
tableNameLowerCase
,
.
n
=
(
uint32_t
)
strlen
(
tableNameLowerCase
),
.
type
=
TK_ID
};
tGetToken
(
tableNameLowerCase
,
&
tableToken
.
type
);
char
tableNameBuf
[
TSDB_TABLE_NAME_LEN
+
TS_ESCAPE_CHAR_SIZE
];
memcpy
(
tableNameBuf
,
tableName
,
strlen
(
tableName
));
SStrToken
tableToken
=
{.
z
=
tableNameBuf
,
.
n
=
(
uint32_t
)
strlen
(
tableName
),
.
type
=
TK_ID
};
tGetToken
(
tableNameBuf
,
&
tableToken
.
type
);
bool
dbIncluded
=
false
;
// Check if the table name available or not
if
(
tscValidateName
(
&
tableToken
,
true
,
&
dbIncluded
)
!=
TSDB_CODE_SUCCESS
)
{
...
...
@@ -1870,24 +1869,14 @@ static int32_t parseSmlTimeStamp(TAOS_SML_KV **pTS, const char **index, SSmlLine
bool
checkDuplicateKey
(
char
*
key
,
SHashObj
*
pHash
,
SSmlLinesInfo
*
info
)
{
char
*
val
=
NULL
;
char
*
cur
=
key
;
char
keyLower
[
TSDB_COL_NAME_LEN
];
size_t
keyLen
=
0
;
while
(
*
cur
!=
'\0'
)
{
keyLower
[
keyLen
]
=
tolower
(
*
cur
);
keyLen
++
;
cur
++
;
}
keyLower
[
keyLen
]
=
'\0'
;
val
=
taosHashGet
(
pHash
,
keyLower
,
keyLen
);
val
=
taosHashGet
(
pHash
,
key
,
strlen
(
key
));
if
(
val
)
{
tscError
(
"SML:0x%"
PRIx64
" Duplicate key detected:%s"
,
info
->
id
,
key
Lower
);
tscError
(
"SML:0x%"
PRIx64
" Duplicate key detected:%s"
,
info
->
id
,
key
);
return
true
;
}
uint8_t
dummy_val
=
0
;
taosHashPut
(
pHash
,
key
Lower
,
strlen
(
key
),
&
dummy_val
,
sizeof
(
uint8_t
));
taosHashPut
(
pHash
,
key
,
strlen
(
key
),
&
dummy_val
,
sizeof
(
uint8_t
));
return
false
;
}
...
...
@@ -1925,7 +1914,6 @@ static int32_t parseSmlKey(TAOS_SML_KV *pKV, const char **index, SHashObj *pHash
pKV
->
key
=
calloc
(
len
+
TS_ESCAPE_CHAR_SIZE
+
1
,
1
);
memcpy
(
pKV
->
key
,
key
,
len
+
1
);
strntolower_s
(
pKV
->
key
,
pKV
->
key
,
(
int32_t
)
len
);
addEscapeCharToString
(
pKV
->
key
,
len
);
tscDebug
(
"SML:0x%"
PRIx64
" Key:%s|len:%d"
,
info
->
id
,
pKV
->
key
,
len
);
*
index
=
cur
+
1
;
...
...
@@ -2053,7 +2041,7 @@ static int32_t parseSmlMeasurement(TAOS_SML_DATA_POINT *pSml, const char **index
if
(
*
cur
==
'\\'
)
{
escapeSpecialCharacter
(
1
,
&
cur
);
}
pSml
->
stableName
[
len
]
=
tolower
(
*
cur
)
;
pSml
->
stableName
[
len
]
=
*
cur
;
cur
++
;
len
++
;
}
...
...
@@ -2129,7 +2117,6 @@ static int32_t parseSmlKvPairs(TAOS_SML_KV **pKVs, int *num_kvs,
if
(
!
isField
&&
childTableNameLen
!=
0
&&
strcasecmp
(
pkv
->
key
,
childTableName
)
==
0
)
{
smlData
->
childTableName
=
malloc
(
pkv
->
length
+
TS_ESCAPE_CHAR_SIZE
+
1
);
memcpy
(
smlData
->
childTableName
,
pkv
->
value
,
pkv
->
length
);
strntolower_s
(
smlData
->
childTableName
,
smlData
->
childTableName
,
(
int32_t
)
pkv
->
length
);
addEscapeCharToString
(
smlData
->
childTableName
,
(
int32_t
)
pkv
->
length
);
free
(
pkv
->
key
);
free
(
pkv
->
value
);
...
...
src/client/src/tscPrepare.c
浏览文件 @
9b0ca45e
...
...
@@ -1573,7 +1573,7 @@ int taos_stmt_prepare(TAOS_STMT* stmt, const char* sql, unsigned long length) {
pRes
->
qId
=
0
;
pRes
->
numOfRows
=
0
;
str
tolower
(
pSql
->
sqlstr
,
sql
);
str
cpy
(
pSql
->
sqlstr
,
sql
);
tscDebugL
(
"0x%"
PRIx64
" SQL: %s"
,
pSql
->
self
,
pSql
->
sqlstr
);
if
(
tscIsInsertData
(
pSql
->
sqlstr
))
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录