Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
4806e7bf
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看板
提交
4806e7bf
编写于
9月 24, 2020
作者:
B
Bomin Zhang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix td-1488
上级
db565630
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
15 addition
and
29 deletion
+15
-29
src/client/inc/tsclient.h
src/client/inc/tsclient.h
+3
-2
src/client/src/tscParseInsert.c
src/client/src/tscParseInsert.c
+1
-2
src/client/src/tscServer.c
src/client/src/tscServer.c
+10
-25
src/client/src/tscUtil.c
src/client/src/tscUtil.c
+1
-0
未找到文件。
src/client/inc/tsclient.h
浏览文件 @
4806e7bf
...
...
@@ -261,7 +261,7 @@ typedef struct {
};
int32_t
insertType
;
int32_t
clauseIndex
;
// index of multiple subclause query
int32_t
clauseIndex
;
// index of multiple subclause query
char
*
curSql
;
// current sql, resume position of sql after parsing paused
int8_t
parseFinished
;
...
...
@@ -276,7 +276,8 @@ typedef struct {
int32_t
numOfParams
;
int8_t
dataSourceType
;
// load data from file or not
int8_t
submitSchema
;
// submit block is built with table schema
int8_t
submitSchema
;
// submit block is built with table schema
STagData
tagData
;
SHashObj
*
pTableList
;
// referred table involved in sql
SArray
*
pDataBlocks
;
// SArray<STableDataBlocks*> submit data blocks after parsing sql
}
SSqlCmd
;
...
...
src/client/src/tscParseInsert.c
浏览文件 @
4806e7bf
...
...
@@ -791,7 +791,7 @@ static int32_t tscCheckIfCreateTable(char **sqlstr, SSqlObj *pSql) {
sql
+=
index
;
tscAllocPayload
(
pCmd
,
sizeof
(
STagData
));
STagData
*
pTag
=
(
STagData
*
)
pCmd
->
payload
;
STagData
*
pTag
=
&
pCmd
->
tagData
;
memset
(
pTag
,
0
,
sizeof
(
STagData
));
...
...
@@ -946,7 +946,6 @@ static int32_t tscCheckIfCreateTable(char **sqlstr, SSqlObj *pSql) {
return
tscSQLSyntaxErrMsg
(
pCmd
->
payload
,
") expected"
,
sToken
.
z
);
}
pCmd
->
payloadLen
=
sizeof
(
pTag
->
name
)
+
sizeof
(
pTag
->
dataLen
)
+
pTag
->
dataLen
;
pTag
->
dataLen
=
htonl
(
pTag
->
dataLen
);
if
(
tscValidateName
(
&
tableToken
)
!=
TSDB_CODE_SUCCESS
)
{
...
...
src/client/src/tscServer.c
浏览文件 @
4806e7bf
...
...
@@ -1495,43 +1495,29 @@ int tscBuildConnectMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
}
int
tscBuildTableMetaMsg
(
SSqlObj
*
pSql
,
SSqlInfo
*
pInfo
)
{
SCMTableInfoMsg
*
pInfoMsg
;
char
*
pMsg
;
int
msgLen
=
0
;
char
*
tmpData
=
NULL
;
uint32_t
len
=
pSql
->
cmd
.
payloadLen
;
if
(
len
>
0
)
{
if
((
tmpData
=
calloc
(
1
,
len
))
==
NULL
)
{
return
TSDB_CODE_TSC_OUT_OF_MEMORY
;
}
// STagData is in binary format, strncpy is not available
memcpy
(
tmpData
,
pSql
->
cmd
.
payload
,
len
);
}
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
&
pSql
->
cmd
,
0
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetMetaInfo
(
pQueryInfo
,
0
);
pInfoMsg
=
(
SCMTableInfoMsg
*
)
pCmd
->
payload
;
SCMTableInfoMsg
*
pInfoMsg
=
(
SCMTableInfoMsg
*
)
pCmd
->
payload
;
strcpy
(
pInfoMsg
->
tableId
,
pTableMetaInfo
->
name
);
pInfoMsg
->
createFlag
=
htons
(
pSql
->
cmd
.
autoCreated
?
1
:
0
);
pMsg
=
(
char
*
)
pInfoMsg
+
sizeof
(
SCMTableInfoMsg
);
char
*
pMsg
=
(
char
*
)
pInfoMsg
+
sizeof
(
SCMTableInfoMsg
);
if
(
pSql
->
cmd
.
autoCreated
&&
len
>
0
)
{
memcpy
(
pInfoMsg
->
tags
,
tmpData
,
len
);
pMsg
+=
len
;
size_t
len
=
htonl
(
pCmd
->
tagData
.
dataLen
);
if
(
pSql
->
cmd
.
autoCreated
)
{
if
(
len
>
0
)
{
len
+=
sizeof
(
pCmd
->
tagData
.
name
)
+
sizeof
(
pCmd
->
tagData
.
dataLen
);
memcpy
(
pInfoMsg
->
tags
,
&
pCmd
->
tagData
,
len
);
pMsg
+=
len
;
}
}
pCmd
->
payloadLen
=
(
int32_t
)(
pMsg
-
(
char
*
)
pInfoMsg
);
pCmd
->
msgType
=
TSDB_MSG_TYPE_CM_TABLE_META
;
taosTFree
(
tmpData
);
assert
(
msgLen
+
minMsgSize
()
<=
(
int32_t
)
pCmd
->
allocSize
);
return
TSDB_CODE_SUCCESS
;
}
...
...
@@ -2192,8 +2178,7 @@ static int32_t getTableMetaFromMgmt(SSqlObj *pSql, STableMetaInfo *pTableMetaInf
assert
(
pNew
->
cmd
.
numOfClause
==
1
&&
pNewQueryInfo
->
numOfTables
==
1
);
tstrncpy
(
pNewMeterMetaInfo
->
name
,
pTableMetaInfo
->
name
,
sizeof
(
pNewMeterMetaInfo
->
name
));
memcpy
(
pNew
->
cmd
.
payload
,
pSql
->
cmd
.
payload
,
pSql
->
cmd
.
payloadLen
);
// tag information if table does not exists.
pNew
->
cmd
.
payloadLen
=
pSql
->
cmd
.
payloadLen
;
memcpy
(
&
pNew
->
cmd
.
tagData
,
&
pSql
->
cmd
.
tagData
,
sizeof
(
pSql
->
cmd
.
tagData
));
tscDebug
(
"%p new pSqlObj:%p to get tableMeta, auto create:%d"
,
pSql
,
pNew
,
pNew
->
cmd
.
autoCreated
);
pNew
->
fp
=
tscTableMetaCallBack
;
...
...
src/client/src/tscUtil.c
浏览文件 @
4806e7bf
...
...
@@ -1794,6 +1794,7 @@ SSqlObj* createSimpleSubObj(SSqlObj* pSql, void (*fp)(), void* param, int32_t cm
pCmd
->
command
=
cmd
;
pCmd
->
parseFinished
=
1
;
pCmd
->
autoCreated
=
pSql
->
cmd
.
autoCreated
;
memcpy
(
&
pCmd
->
tagData
,
&
pSql
->
cmd
.
tagData
,
sizeof
(
pCmd
->
tagData
));
if
(
tscAddSubqueryInfo
(
pCmd
)
!=
TSDB_CODE_SUCCESS
)
{
tscFreeSqlObj
(
pNew
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录