Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
9e280acb
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看板
提交
9e280acb
编写于
5月 02, 2020
作者:
H
hjxilinx
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[td-168]
上级
a32ee46d
变更
11
展开全部
显示空白变更内容
内联
并排
Showing
11 changed file
with
164 addition
and
141 deletion
+164
-141
src/client/inc/tsclient.h
src/client/inc/tsclient.h
+1
-1
src/client/src/tscAsync.c
src/client/src/tscAsync.c
+1
-1
src/client/src/tscSQLParser.c
src/client/src/tscSQLParser.c
+0
-9
src/client/src/tscSql.c
src/client/src/tscSql.c
+2
-1
src/client/src/tscSubquery.c
src/client/src/tscSubquery.c
+1
-1
src/client/src/tscUtil.c
src/client/src/tscUtil.c
+10
-5
src/query/inc/sql.y
src/query/inc/sql.y
+3
-3
src/query/src/queryExecutor.c
src/query/src/queryExecutor.c
+15
-4
src/query/src/sql.c
src/query/src/sql.c
+112
-113
src/tsdb/src/tsdbMeta.c
src/tsdb/src/tsdbMeta.c
+9
-1
src/tsdb/src/tsdbRead.c
src/tsdb/src/tsdbRead.c
+10
-2
未找到文件。
src/client/inc/tsclient.h
浏览文件 @
9e280acb
...
...
@@ -423,7 +423,7 @@ int32_t tscInvalidSQLErrMsg(char *msg, const char *additionalInfo, const char *s
void
tscQueueAsyncFreeResult
(
SSqlObj
*
pSql
);
int32_t
tscToSQLCmd
(
SSqlObj
*
pSql
,
struct
SSqlInfo
*
pInfo
);
char
*
tscGetResultColumnChr
(
SSqlRes
*
pRes
,
SQueryInfo
*
pQueryInfo
,
int32_t
column
);
char
*
tscGetResultColumnChr
(
SSqlRes
*
pRes
,
SQueryInfo
*
pQueryInfo
,
int32_t
column
,
int16_t
bytes
);
extern
void
*
pVnodeConn
;
extern
void
*
tscCacheHandle
;
...
...
src/client/src/tscAsync.c
浏览文件 @
9e280acb
...
...
@@ -317,7 +317,7 @@ void tscProcessFetchRow(SSchedMsg *pMsg) {
SFieldSupInfo
*
pSup
=
taosArrayGet
(
pQueryInfo
->
fieldsInfo
.
pSupportInfo
,
i
);
if
(
pSup
->
pSqlExpr
!=
NULL
)
{
pRes
->
tsrow
[
i
]
=
tscGetResultColumnChr
(
pRes
,
pQueryInfo
,
i
);
pRes
->
tsrow
[
i
]
=
tscGetResultColumnChr
(
pRes
,
pQueryInfo
,
i
,
pSup
->
pSqlExpr
->
resBytes
);
}
else
{
// todo add
}
...
...
src/client/src/tscSQLParser.c
浏览文件 @
9e280acb
...
...
@@ -206,7 +206,6 @@ int32_t tscToSQLCmd(SSqlObj* pSql, struct SSqlInfo* pInfo) {
case
TSDB_SQL_DROP_ACCT
:
case
TSDB_SQL_DROP_DNODE
:
case
TSDB_SQL_DROP_DB
:
{
const
char
*
msg1
=
"invalid ip address"
;
const
char
*
msg2
=
"invalid name"
;
const
char
*
msg3
=
"param name too long"
;
...
...
@@ -230,10 +229,6 @@ int32_t tscToSQLCmd(SSqlObj* pSql, struct SSqlInfo* pInfo) {
return
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg3
);
}
}
else
if
(
pInfo
->
type
==
TSDB_SQL_DROP_DNODE
)
{
if
(
!
validateIpAddress
(
pzName
->
z
,
pzName
->
n
))
{
return
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg1
);
}
strncpy
(
pTableMetaInfo
->
name
,
pzName
->
z
,
pzName
->
n
);
}
else
{
// drop user
if
(
pzName
->
n
>
TSDB_USER_LEN
)
{
...
...
@@ -364,14 +359,10 @@ int32_t tscToSQLCmd(SSqlObj* pSql, struct SSqlInfo* pInfo) {
}
case
TSDB_SQL_CFG_DNODE
:
{
const
char
*
msg1
=
"invalid ip address"
;
const
char
*
msg2
=
"invalid configure options or values"
;
/* validate the ip address */
tDCLSQL
*
pDCL
=
pInfo
->
pDCLInfo
;
if
(
!
validateIpAddress
(
pDCL
->
a
[
0
].
z
,
pDCL
->
a
[
0
].
n
))
{
return
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg1
);
}
/* validate the parameter names and options */
if
(
validateDNodeConfig
(
pDCL
)
!=
TSDB_CODE_SUCCESS
)
{
...
...
src/client/src/tscSql.c
浏览文件 @
9e280acb
...
...
@@ -422,8 +422,9 @@ int taos_fetch_block_impl(TAOS_RES *res, TAOS_ROW *rows) {
if
(
pQueryInfo
==
NULL
)
return
0
;
assert
(
0
);
for
(
int
i
=
0
;
i
<
pQueryInfo
->
fieldsInfo
.
numOfOutput
;
++
i
)
{
pRes
->
tsrow
[
i
]
=
tscGetResultColumnChr
(
pRes
,
pQueryInfo
,
i
);
pRes
->
tsrow
[
i
]
=
tscGetResultColumnChr
(
pRes
,
pQueryInfo
,
i
,
0
);
}
*
rows
=
pRes
->
tsrow
;
...
...
src/client/src/tscSubquery.c
浏览文件 @
9e280acb
...
...
@@ -1967,7 +1967,7 @@ void **doSetResultRowData(SSqlObj *pSql, bool finalResult) {
for
(
int
i
=
0
;
i
<
tscNumOfFields
(
pQueryInfo
);
++
i
)
{
SFieldSupInfo
*
pSup
=
tscFieldInfoGetSupp
(
&
pQueryInfo
->
fieldsInfo
,
i
);
if
(
pSup
->
pSqlExpr
!=
NULL
)
{
pRes
->
tsrow
[
i
]
=
tscGetResultColumnChr
(
pRes
,
pQueryInfo
,
i
)
+
pSup
->
pSqlExpr
->
resBytes
*
pRes
->
row
;
pRes
->
tsrow
[
i
]
=
tscGetResultColumnChr
(
pRes
,
pQueryInfo
,
i
,
pSup
->
pSqlExpr
->
resBytes
)
;
}
// primary key column cannot be null in interval query, no need to check
...
...
src/client/src/tscUtil.c
浏览文件 @
9e280acb
...
...
@@ -2122,17 +2122,22 @@ void tscTryQueryNextClause(SSqlObj* pSql, void (*queryFp)()) {
}
}
char
*
tscGetResultColumnChr
(
SSqlRes
*
pRes
,
SQueryInfo
*
pQueryInfo
,
int32_t
column
)
{
char
*
tscGetResultColumnChr
(
SSqlRes
*
pRes
,
SQueryInfo
*
pQueryInfo
,
int32_t
column
,
int16_t
bytes
)
{
SFieldInfo
*
pFieldInfo
=
&
pQueryInfo
->
fieldsInfo
;
SFieldSupInfo
*
pInfo
=
tscFieldInfoGetSupp
(
pFieldInfo
,
column
);
int32_t
type
=
pInfo
->
pSqlExpr
->
resType
;
char
*
pData
=
((
char
*
)
pRes
->
data
)
+
pInfo
->
pSqlExpr
->
offset
*
pRes
->
numOfRows
;
char
*
pData
=
((
char
*
)
pRes
->
data
)
+
pInfo
->
pSqlExpr
->
offset
*
pRes
->
numOfRows
+
bytes
*
pRes
->
row
;
if
(
type
==
TSDB_DATA_TYPE_NCHAR
||
type
==
TSDB_DATA_TYPE_BINARY
)
{
int32_t
realLen
=
*
(
int16_t
*
)
pData
;
if
(
realLen
<
pInfo
->
pSqlExpr
->
resBytes
-
sizeof
(
int16_t
))
{
// todo refactor
*
(
char
*
)
(
pData
+
realLen
+
sizeof
(
int16_t
))
=
0
;
}
if
(
type
!=
TSDB_DATA_TYPE_NCHAR
&&
type
!=
TSDB_DATA_TYPE_BINARY
)
{
return
pData
;
}
else
{
return
pData
+
sizeof
(
int16_t
);
// head is the length of binary/nchar data
}
else
{
return
pData
;
}
}
src/query/inc/sql.y
浏览文件 @
9e280acb
...
...
@@ -120,7 +120,7 @@ cmd ::= DROP TABLE ifexists(Y) ids(X) cpxName(Z). {
}
cmd ::= DROP DATABASE ifexists(Y) ids(X). { setDropDBTableInfo(pInfo, TSDB_SQL_DROP_DB, &X, &Y); }
cmd ::= DROP DNODE
IPTOKEN(X).
{ setDCLSQLElems(pInfo, TSDB_SQL_DROP_DNODE, 1, &X); }
cmd ::= DROP DNODE
ids(X).
{ setDCLSQLElems(pInfo, TSDB_SQL_DROP_DNODE, 1, &X); }
cmd ::= DROP USER ids(X). { setDCLSQLElems(pInfo, TSDB_SQL_DROP_USER, 1, &X); }
cmd ::= DROP ACCOUNT ids(X). { setDCLSQLElems(pInfo, TSDB_SQL_DROP_ACCT, 1, &X); }
...
...
@@ -136,8 +136,8 @@ cmd ::= DESCRIBE ids(X) cpxName(Y). {
/////////////////////////////////THE ALTER STATEMENT////////////////////////////////////////
cmd ::= ALTER USER ids(X) PASS ids(Y). { setAlterUserSQL(pInfo, TSDB_ALTER_USER_PASSWD, &X, &Y, NULL); }
cmd ::= ALTER USER ids(X) PRIVILEGE ids(Y). { setAlterUserSQL(pInfo, TSDB_ALTER_USER_PRIVILEGES, &X, NULL, &Y);}
cmd ::= ALTER DNODE
IPTOKEN(X) ids(Y).
{ setDCLSQLElems(pInfo, TSDB_SQL_CFG_DNODE, 2, &X, &Y); }
cmd ::= ALTER DNODE
IPTOKEN(X) ids(Y) ids(Z).
{ setDCLSQLElems(pInfo, TSDB_SQL_CFG_DNODE, 3, &X, &Y, &Z); }
cmd ::= ALTER DNODE
ids(X) ids(Y).
{ setDCLSQLElems(pInfo, TSDB_SQL_CFG_DNODE, 2, &X, &Y); }
cmd ::= ALTER DNODE
ids(X) ids(Y) ids(Z).
{ setDCLSQLElems(pInfo, TSDB_SQL_CFG_DNODE, 3, &X, &Y, &Z); }
cmd ::= ALTER LOCAL ids(X). { setDCLSQLElems(pInfo, TSDB_SQL_CFG_LOCAL, 1, &X); }
cmd ::= ALTER LOCAL ids(X) ids(Y). { setDCLSQLElems(pInfo, TSDB_SQL_CFG_LOCAL, 2, &X, &Y); }
cmd ::= ALTER DATABASE ids(X) alter_db_optr(Y). { SSQLToken t = {0}; setCreateDBSQL(pInfo, TSDB_SQL_ALTER_DB, &X, &Y, &t);}
...
...
src/query/src/queryExecutor.c
浏览文件 @
9e280acb
...
...
@@ -6315,16 +6315,27 @@ static void buildTagQueryResult(SQInfo* pQInfo) {
char
*
data
=
NULL
;
for
(
int32_t
j
=
0
;
j
<
pQuery
->
numOfOutput
;
++
j
)
{
// todo check the return value
// todo check the return value
, refactor codes
if
(
pExprInfo
[
j
].
base
.
colInfo
.
colId
==
TSDB_TBNAME_COLUMN_INDEX
)
{
tsdbGetTableName
(
pQInfo
->
tsdb
,
&
item
->
id
,
&
data
);
strncpy
(
pQuery
->
sdata
[
j
]
->
data
+
i
*
TSDB_TABLE_NAME_LEN
,
data
,
TSDB_TABLE_NAME_LEN
);
char
*
dst
=
pQuery
->
sdata
[
j
]
->
data
+
i
*
(
TSDB_TABLE_NAME_LEN
+
sizeof
(
int16_t
));
*
(
int16_t
*
)
dst
=
strnlen
(
data
,
TSDB_TABLE_NAME_LEN
);
dst
+=
sizeof
(
int16_t
);
strncpy
(
dst
,
data
,
TSDB_TABLE_NAME_LEN
);
tfree
(
data
);
}
else
{
}
else
{
// todo refactor, return the true length of binary|nchar data
tsdbGetTableTagVal
(
pQInfo
->
tsdb
,
&
item
->
id
,
pExprInfo
[
j
].
base
.
colInfo
.
colId
,
&
type
,
&
bytes
,
&
data
);
assert
(
bytes
==
pExprInfo
[
j
].
bytes
&&
type
==
pExprInfo
[
j
].
type
);
memcpy
(
pQuery
->
sdata
[
j
]
->
data
+
i
*
bytes
,
data
,
bytes
);
char
*
dst
=
pQuery
->
sdata
[
j
]
->
data
+
i
*
bytes
;
if
(
type
==
TSDB_DATA_TYPE_BINARY
||
type
==
TSDB_DATA_TYPE_NCHAR
)
{
memcpy
(
dst
,
data
,
varDataTLen
(
data
));
}
else
{
memcpy
(
dst
,
data
,
bytes
);
}
}
}
...
...
src/query/src/sql.c
浏览文件 @
9e280acb
此差异已折叠。
点击以展开。
src/tsdb/src/tsdbMeta.c
浏览文件 @
9e280acb
...
...
@@ -232,10 +232,18 @@ int32_t tsdbGetTableTagVal(TsdbRepoT* repo, STableId* id, int32_t colId, int16_t
STSchema
*
pSchema
=
tsdbGetTableTagSchema
(
pMeta
,
pTable
);
STColumn
*
pCol
=
NULL
;
int32_t
offset
=
0
;
for
(
int32_t
col
=
0
;
col
<
schemaNCols
(
pSchema
);
++
col
)
{
STColumn
*
p
=
schemaColAt
(
pSchema
,
col
);
if
(
p
->
colId
==
colId
)
{
pCol
=
p
;
break
;
}
if
(
p
->
type
==
TSDB_DATA_TYPE_BINARY
||
p
->
type
==
TSDB_DATA_TYPE_NCHAR
)
{
offset
+=
sizeof
(
int16_t
);
}
else
{
offset
+=
p
->
bytes
;
}
}
...
...
@@ -246,7 +254,7 @@ int32_t tsdbGetTableTagVal(TsdbRepoT* repo, STableId* id, int32_t colId, int16_t
assert
(
pCol
!=
NULL
);
SDataRow
row
=
(
SDataRow
)
pTable
->
tagVal
;
char
*
d
=
dataRowTuple
(
row
);
char
*
d
=
tdGetRowDataOfCol
(
row
,
pCol
->
type
,
TD_DATA_ROW_HEAD_SIZE
+
offset
);
*
val
=
d
;
*
type
=
pCol
->
type
;
...
...
src/tsdb/src/tsdbRead.c
浏览文件 @
9e280acb
...
...
@@ -1052,10 +1052,18 @@ static int tsdbReadRowsFromCache(SSkipListIterator* pIter, TSKEY maxKey, int max
pData
=
pColInfo
->
pData
+
(
maxRowsToRead
-
numOfRows
-
1
)
*
pColInfo
->
info
.
bytes
;
}
if
(
pColInfo
->
info
.
type
==
TSDB_DATA_TYPE_BINARY
||
pColInfo
->
info
.
type
==
TSDB_DATA_TYPE_NCHAR
)
{
void
*
value
=
tdGetRowDataOfCol
(
row
,
pColInfo
->
info
.
type
,
TD_DATA_ROW_HEAD_SIZE
+
offset
);
memcpy
(
pData
,
value
,
varDataTLen
(
value
));
offset
+=
sizeof
(
int16_t
);
}
else
{
memcpy
(
pData
,
dataRowTuple
(
row
)
+
offset
,
pColInfo
->
info
.
bytes
);
offset
+=
pColInfo
->
info
.
bytes
;
}
}
numOfRows
++
;
if
(
numOfRows
>=
maxRowsToRead
)
{
break
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录