Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
f3de9986
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看板
提交
f3de9986
编写于
6月 16, 2020
作者:
H
Hui Li
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-421]
上级
34308601
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
26 addition
and
27 deletion
+26
-27
src/client/src/tscLocal.c
src/client/src/tscLocal.c
+11
-11
src/common/inc/tdataformat.h
src/common/inc/tdataformat.h
+1
-1
src/mnode/src/mnodeDb.c
src/mnode/src/mnodeDb.c
+1
-1
src/mnode/src/mnodeDnode.c
src/mnode/src/mnodeDnode.c
+1
-1
src/mnode/src/mnodeMnode.c
src/mnode/src/mnodeMnode.c
+3
-3
src/mnode/src/mnodeTable.c
src/mnode/src/mnodeTable.c
+5
-5
src/mnode/src/mnodeUser.c
src/mnode/src/mnodeUser.c
+2
-3
src/mnode/src/mnodeVgroup.c
src/mnode/src/mnodeVgroup.c
+2
-2
未找到文件。
src/client/src/tscLocal.c
浏览文件 @
f3de9986
...
...
@@ -132,14 +132,14 @@ static int32_t tscSetValueToResObj(SSqlObj *pSql, int32_t rowLen) {
for
(
int32_t
i
=
0
;
i
<
numOfRows
;
++
i
)
{
TAOS_FIELD
*
pField
=
tscFieldInfoGetField
(
&
pQueryInfo
->
fieldsInfo
,
0
);
char
*
dst
=
pRes
->
data
+
tscFieldInfoGetOffset
(
pQueryInfo
,
0
)
*
totalNumOfRows
+
pField
->
bytes
*
i
;
STR_WITH_MAXSIZE_TO_VARSTR
(
dst
,
pSchema
[
i
].
name
,
TSDB_COL_NAME_LEN
-
1
);
STR_WITH_MAXSIZE_TO_VARSTR
(
dst
,
pSchema
[
i
].
name
,
pField
->
bytes
);
char
*
type
=
tDataTypeDesc
[
pSchema
[
i
].
type
].
aName
;
pField
=
tscFieldInfoGetField
(
&
pQueryInfo
->
fieldsInfo
,
1
);
dst
=
pRes
->
data
+
tscFieldInfoGetOffset
(
pQueryInfo
,
1
)
*
totalNumOfRows
+
pField
->
bytes
*
i
;
STR_
TO_VARSTR
(
dst
,
type
);
STR_
WITH_MAXSIZE_TO_VARSTR
(
dst
,
type
,
pField
->
bytes
);
int32_t
bytes
=
pSchema
[
i
].
bytes
;
if
(
pSchema
[
i
].
type
==
TSDB_DATA_TYPE_BINARY
||
pSchema
[
i
].
type
==
TSDB_DATA_TYPE_NCHAR
)
{
...
...
@@ -157,7 +157,7 @@ static int32_t tscSetValueToResObj(SSqlObj *pSql, int32_t rowLen) {
if
(
i
>=
tscGetNumOfColumns
(
pMeta
)
&&
tscGetNumOfTags
(
pMeta
)
!=
0
)
{
char
*
output
=
pRes
->
data
+
tscFieldInfoGetOffset
(
pQueryInfo
,
3
)
*
totalNumOfRows
+
pField
->
bytes
*
i
;
const
char
*
src
=
"TAG"
;
STR_WITH_
SIZE_TO_VARSTR
(
output
,
src
,
strlen
(
src
)
);
STR_WITH_
MAXSIZE_TO_VARSTR
(
output
,
src
,
pField
->
bytes
);
}
}
...
...
@@ -171,7 +171,7 @@ static int32_t tscSetValueToResObj(SSqlObj *pSql, int32_t rowLen) {
// field name
TAOS_FIELD
*
pField
=
tscFieldInfoGetField
(
&
pQueryInfo
->
fieldsInfo
,
0
);
char
*
output
=
pRes
->
data
+
tscFieldInfoGetOffset
(
pQueryInfo
,
0
)
*
totalNumOfRows
+
pField
->
bytes
*
i
;
STR_WITH_MAXSIZE_TO_VARSTR
(
output
,
pSchema
[
i
].
name
,
TSDB_COL_NAME_LEN
-
1
);
STR_WITH_MAXSIZE_TO_VARSTR
(
output
,
pSchema
[
i
].
name
,
pField
->
bytes
);
// type name
pField
=
tscFieldInfoGetField
(
&
pQueryInfo
->
fieldsInfo
,
1
);
...
...
@@ -193,7 +193,7 @@ static int32_t tscSetValueToResObj(SSqlObj *pSql, int32_t rowLen) {
pField
=
tscFieldInfoGetField
(
&
pQueryInfo
->
fieldsInfo
,
3
);
char
*
target
=
pRes
->
data
+
tscFieldInfoGetOffset
(
pQueryInfo
,
3
)
*
totalNumOfRows
+
pField
->
bytes
*
i
;
const
char
*
src
=
"TAG"
;
STR_WITH_
SIZE_TO_VARSTR
(
target
,
src
,
strlen
(
src
)
);
STR_WITH_
MAXSIZE_TO_VARSTR
(
target
,
src
,
pField
->
bytes
);
pTagValue
+=
pSchema
[
i
].
bytes
;
}
...
...
@@ -220,15 +220,15 @@ static int32_t tscBuildTableSchemaResultFields(SSqlObj *pSql, int32_t numOfCols,
rowLen
+=
((
TSDB_COL_NAME_LEN
-
1
)
+
VARSTR_HEADER_SIZE
);
f
.
bytes
=
typeColLength
;
f
.
bytes
=
typeColLength
+
VARSTR_HEADER_SIZE
;
f
.
type
=
TSDB_DATA_TYPE_BINARY
;
tstrncpy
(
f
.
name
,
"Type"
,
sizeof
(
f
.
name
));
pInfo
=
tscFieldInfoAppend
(
&
pQueryInfo
->
fieldsInfo
,
&
f
);
pInfo
->
pSqlExpr
=
tscSqlExprAppend
(
pQueryInfo
,
TSDB_FUNC_TS_DUMMY
,
&
index
,
TSDB_DATA_TYPE_BINARY
,
typeColLength
,
pInfo
->
pSqlExpr
=
tscSqlExprAppend
(
pQueryInfo
,
TSDB_FUNC_TS_DUMMY
,
&
index
,
TSDB_DATA_TYPE_BINARY
,
typeColLength
+
VARSTR_HEADER_SIZE
,
typeColLength
,
false
);
rowLen
+=
typeColLength
;
rowLen
+=
typeColLength
+
VARSTR_HEADER_SIZE
;
f
.
bytes
=
sizeof
(
int32_t
);
f
.
type
=
TSDB_DATA_TYPE_INT
;
...
...
@@ -240,15 +240,15 @@ static int32_t tscBuildTableSchemaResultFields(SSqlObj *pSql, int32_t numOfCols,
rowLen
+=
sizeof
(
int32_t
);
f
.
bytes
=
noteColLength
;
f
.
bytes
=
noteColLength
+
VARSTR_HEADER_SIZE
;
f
.
type
=
TSDB_DATA_TYPE_BINARY
;
tstrncpy
(
f
.
name
,
"Note"
,
sizeof
(
f
.
name
));
pInfo
=
tscFieldInfoAppend
(
&
pQueryInfo
->
fieldsInfo
,
&
f
);
pInfo
->
pSqlExpr
=
tscSqlExprAppend
(
pQueryInfo
,
TSDB_FUNC_TS_DUMMY
,
&
index
,
TSDB_DATA_TYPE_BINARY
,
noteColLength
,
pInfo
->
pSqlExpr
=
tscSqlExprAppend
(
pQueryInfo
,
TSDB_FUNC_TS_DUMMY
,
&
index
,
TSDB_DATA_TYPE_BINARY
,
noteColLength
+
VARSTR_HEADER_SIZE
,
noteColLength
,
false
);
rowLen
+=
noteColLength
;
rowLen
+=
noteColLength
+
VARSTR_HEADER_SIZE
;
return
rowLen
;
}
...
...
src/common/inc/tdataformat.h
浏览文件 @
f3de9986
...
...
@@ -36,7 +36,7 @@ extern "C" {
#define STR_WITH_MAXSIZE_TO_VARSTR(x, str, _maxs) \
do { \
char *_e = stpncpy(varDataVal(x), (str), (_maxs)); \
char *_e = stpncpy(varDataVal(x), (str), (_maxs)
-VARSTR_HEADER_SIZE
); \
varDataSetLen(x, (_e - (x)-VARSTR_HEADER_SIZE)); \
} while (0)
...
...
src/mnode/src/mnodeDb.c
浏览文件 @
f3de9986
...
...
@@ -613,7 +613,7 @@ static int32_t mnodeRetrieveDbs(SShowObj *pShow, char *data, int32_t rows, void
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
char
*
name
=
mnodeGetDbStr
(
pDb
->
name
);
STR_WITH_MAXSIZE_TO_VARSTR
(
pWrite
,
name
,
TSDB_DB_NAME_LEN
-
1
);
STR_WITH_MAXSIZE_TO_VARSTR
(
pWrite
,
name
,
pShow
->
bytes
[
cols
]
);
cols
++
;
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
...
...
src/mnode/src/mnodeDnode.c
浏览文件 @
f3de9986
...
...
@@ -593,7 +593,7 @@ static int32_t mnodeRetrieveDnodes(SShowObj *pShow, char *data, int32_t rows, vo
cols
++
;
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
STR_WITH_MAXSIZE_TO_VARSTR
(
pWrite
,
pDnode
->
dnodeEp
,
pShow
->
bytes
[
cols
]
-
VARSTR_HEADER_SIZE
);
STR_WITH_MAXSIZE_TO_VARSTR
(
pWrite
,
pDnode
->
dnodeEp
,
pShow
->
bytes
[
cols
]);
cols
++
;
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
...
...
src/mnode/src/mnodeMnode.c
浏览文件 @
f3de9986
...
...
@@ -401,9 +401,9 @@ static int32_t mnodeRetrieveMnodes(SShowObj *pShow, char *data, int32_t rows, vo
SDnodeObj
*
pDnode
=
mnodeGetDnode
(
pMnode
->
mnodeId
);
if
(
pDnode
!=
NULL
)
{
STR_WITH_MAXSIZE_TO_VARSTR
(
pWrite
,
pDnode
->
dnodeEp
,
pShow
->
bytes
[
cols
]
-
VARSTR_HEADER_SIZE
);
STR_WITH_MAXSIZE_TO_VARSTR
(
pWrite
,
pDnode
->
dnodeEp
,
pShow
->
bytes
[
cols
]);
}
else
{
STR_WITH_MAXSIZE_TO_VARSTR
(
pWrite
,
"invalid ep"
,
pShow
->
bytes
[
cols
]
-
VARSTR_HEADER_SIZE
);
STR_WITH_MAXSIZE_TO_VARSTR
(
pWrite
,
"invalid ep"
,
pShow
->
bytes
[
cols
]);
}
mnodeDecDnodeRef
(
pDnode
);
...
...
@@ -411,7 +411,7 @@ static int32_t mnodeRetrieveMnodes(SShowObj *pShow, char *data, int32_t rows, vo
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
char
*
roles
=
mnodeGetMnodeRoleStr
(
pMnode
->
role
);
STR_
TO_VARSTR
(
pWrite
,
roles
);
STR_
WITH_MAXSIZE_TO_VARSTR
(
pWrite
,
roles
,
pShow
->
bytes
[
cols
]
);
cols
++
;
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
...
...
src/mnode/src/mnodeTable.c
浏览文件 @
f3de9986
...
...
@@ -2103,7 +2103,7 @@ static int32_t mnodeGetShowTableMeta(STableMetaMsg *pMeta, SShowObj *pShow, void
cols
++
;
SSchema
tbCol
=
tGetTableNameColumnSchema
();
pShow
->
bytes
[
cols
]
=
tbCol
.
bytes
;
pShow
->
bytes
[
cols
]
=
tbCol
.
bytes
+
VARSTR_HEADER_SIZE
;
pSchema
[
cols
].
type
=
tbCol
.
type
;
strcpy
(
pSchema
[
cols
].
name
,
"stable_name"
);
pSchema
[
cols
].
bytes
=
htons
(
pShow
->
bytes
[
cols
]);
...
...
@@ -2161,7 +2161,7 @@ static int32_t mnodeRetrieveShowTables(SShowObj *pShow, char *data, int32_t rows
char
*
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
STR_WITH_MAXSIZE_TO_VARSTR
(
pWrite
,
tableName
,
sizeof
(
tableName
)
-
1
);
STR_WITH_MAXSIZE_TO_VARSTR
(
pWrite
,
tableName
,
pShow
->
bytes
[
cols
]
);
cols
++
;
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
...
...
@@ -2182,7 +2182,7 @@ static int32_t mnodeRetrieveShowTables(SShowObj *pShow, char *data, int32_t rows
memset
(
tableName
,
0
,
sizeof
(
tableName
));
if
(
pTable
->
info
.
type
==
TSDB_CHILD_TABLE
)
{
mnodeExtractTableName
(
pTable
->
superTable
->
info
.
tableId
,
tableName
);
STR_WITH_MAXSIZE_TO_VARSTR
(
pWrite
,
tableName
,
sizeof
(
tableName
)
-
1
);
STR_WITH_MAXSIZE_TO_VARSTR
(
pWrite
,
tableName
,
pShow
->
bytes
[
cols
]
);
}
cols
++
;
...
...
@@ -2352,7 +2352,7 @@ static int32_t mnodeRetrieveStreamTables(SShowObj *pShow, char *data, int32_t ro
char
*
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
STR_WITH_MAXSIZE_TO_VARSTR
(
pWrite
,
tableName
,
sizeof
(
tableName
)
-
1
);
STR_WITH_MAXSIZE_TO_VARSTR
(
pWrite
,
tableName
,
pShow
->
bytes
[
cols
]
);
cols
++
;
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
...
...
@@ -2364,7 +2364,7 @@ static int32_t mnodeRetrieveStreamTables(SShowObj *pShow, char *data, int32_t ro
cols
++
;
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
STR_WITH_MAXSIZE_TO_VARSTR
(
pWrite
,
pTable
->
sql
,
TSDB_MAX_SQL_SHOW_LEN
);
STR_WITH_MAXSIZE_TO_VARSTR
(
pWrite
,
pTable
->
sql
,
pShow
->
bytes
[
cols
]
);
cols
++
;
numOfRows
++
;
...
...
src/mnode/src/mnodeUser.c
浏览文件 @
f3de9986
...
...
@@ -315,8 +315,7 @@ static int32_t mnodeRetrieveUsers(SShowObj *pShow, char *data, int32_t rows, voi
cols
=
0
;
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
size_t
size
=
sizeof
(
pUser
->
user
);
STR_WITH_MAXSIZE_TO_VARSTR
(
pWrite
,
pUser
->
user
,
size
);
STR_WITH_MAXSIZE_TO_VARSTR
(
pWrite
,
pUser
->
user
,
pShow
->
bytes
[
cols
]);
cols
++
;
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
...
...
@@ -337,7 +336,7 @@ static int32_t mnodeRetrieveUsers(SShowObj *pShow, char *data, int32_t rows, voi
cols
++
;
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
STR_WITH_MAXSIZE_TO_VARSTR
(
pWrite
,
pUser
->
acct
,
sizeof
(
pUser
->
user
)
);
STR_WITH_MAXSIZE_TO_VARSTR
(
pWrite
,
pUser
->
acct
,
pShow
->
bytes
[
cols
]
);
cols
++
;
numOfRows
++
;
...
...
src/mnode/src/mnodeVgroup.c
浏览文件 @
f3de9986
...
...
@@ -479,12 +479,12 @@ int32_t mnodeRetrieveVgroups(SShowObj *pShow, char *data, int32_t rows, void *pC
if
(
pDnode
!=
NULL
)
{
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
STR_WITH_MAXSIZE_TO_VARSTR
(
pWrite
,
pDnode
->
dnodeEp
,
pShow
->
bytes
[
cols
]
-
VARSTR_HEADER_SIZE
);
STR_WITH_MAXSIZE_TO_VARSTR
(
pWrite
,
pDnode
->
dnodeEp
,
pShow
->
bytes
[
cols
]);
cols
++
;
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
char
*
role
=
mnodeGetMnodeRoleStr
(
pVgroup
->
vnodeGid
[
i
].
role
);
STR_
TO_VARSTR
(
pWrite
,
role
);
STR_
WITH_MAXSIZE_TO_VARSTR
(
pWrite
,
role
,
pShow
->
bytes
[
cols
]
);
cols
++
;
}
else
{
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录