Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
559dcff6
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看板
提交
559dcff6
编写于
8月 20, 2021
作者:
S
shenglian zhou
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
schemaless:before retrying loading meta
上级
a687df67
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
55 addition
and
65 deletion
+55
-65
src/client/src/tscSQLParser.c
src/client/src/tscSQLParser.c
+30
-65
src/client/src/tscUtil.c
src/client/src/tscUtil.c
+25
-0
未找到文件。
src/client/src/tscSQLParser.c
浏览文件 @
559dcff6
...
@@ -116,7 +116,7 @@ static int32_t validateColumnName(char* name);
...
@@ -116,7 +116,7 @@ static int32_t validateColumnName(char* name);
static
int32_t
setKillInfo
(
SSqlObj
*
pSql
,
struct
SSqlInfo
*
pInfo
,
int32_t
killType
);
static
int32_t
setKillInfo
(
SSqlObj
*
pSql
,
struct
SSqlInfo
*
pInfo
,
int32_t
killType
);
static
int32_t
setCompactVnodeInfo
(
SSqlObj
*
pSql
,
struct
SSqlInfo
*
pInfo
);
static
int32_t
setCompactVnodeInfo
(
SSqlObj
*
pSql
,
struct
SSqlInfo
*
pInfo
);
static
bool
validateOneTags
(
SSqlCmd
*
pCmd
,
TAOS_FIELD
*
pTagField
);
static
int32_t
validateOneTag
(
SSqlCmd
*
pCmd
,
TAOS_FIELD
*
pTagField
);
static
bool
hasTimestampForPointInterpQuery
(
SQueryInfo
*
pQueryInfo
);
static
bool
hasTimestampForPointInterpQuery
(
SQueryInfo
*
pQueryInfo
);
static
bool
hasNormalColumnFilter
(
SQueryInfo
*
pQueryInfo
);
static
bool
hasNormalColumnFilter
(
SQueryInfo
*
pQueryInfo
);
...
@@ -307,31 +307,6 @@ static int32_t invalidOperationMsg(char* dstBuffer, const char* errMsg) {
...
@@ -307,31 +307,6 @@ static int32_t invalidOperationMsg(char* dstBuffer, const char* errMsg) {
return
tscInvalidOperationMsg
(
dstBuffer
,
errMsg
,
NULL
);
return
tscInvalidOperationMsg
(
dstBuffer
,
errMsg
,
NULL
);
}
}
int32_t
tscErrorMsgWithCode
(
int32_t
code
,
char
*
dstBuffer
,
const
char
*
errMsg
,
const
char
*
sql
)
{
const
char
*
msgFormat1
=
"%s:%s"
;
const
char
*
msgFormat2
=
"%s:
\'
%s
\'
(%s)"
;
const
char
*
msgFormat3
=
"%s:
\'
%s
\'
"
;
const
int32_t
BACKWARD_CHAR_STEP
=
0
;
if
(
sql
==
NULL
)
{
assert
(
errMsg
!=
NULL
);
sprintf
(
dstBuffer
,
msgFormat1
,
tstrerror
(
code
),
errMsg
);
return
code
;
}
char
buf
[
64
]
=
{
0
};
// only extract part of sql string
strncpy
(
buf
,
(
sql
-
BACKWARD_CHAR_STEP
),
tListLen
(
buf
)
-
1
);
if
(
errMsg
!=
NULL
)
{
sprintf
(
dstBuffer
,
msgFormat2
,
tstrerror
(
code
),
buf
,
errMsg
);
}
else
{
sprintf
(
dstBuffer
,
msgFormat3
,
tstrerror
(
code
),
buf
);
// no additional information for invalid sql error
}
return
code
;
}
static
int
convertTimestampStrToInt64
(
tVariant
*
pVar
,
int32_t
precision
)
{
static
int
convertTimestampStrToInt64
(
tVariant
*
pVar
,
int32_t
precision
)
{
int64_t
time
=
0
;
int64_t
time
=
0
;
strdequote
(
pVar
->
pz
);
strdequote
(
pVar
->
pz
);
...
@@ -1418,6 +1393,7 @@ static bool validateTableColumnInfo(SArray* pFieldList, SSqlCmd* pCmd) {
...
@@ -1418,6 +1393,7 @@ static bool validateTableColumnInfo(SArray* pFieldList, SSqlCmd* pCmd) {
const
char
*
msg
=
"illegal number of columns"
;
const
char
*
msg
=
"illegal number of columns"
;
const
char
*
msg1
=
"first column must be timestamp"
;
const
char
*
msg1
=
"first column must be timestamp"
;
const
char
*
msg2
=
"row length exceeds max length"
;
const
char
*
msg2
=
"row length exceeds max length"
;
const
char
*
msg3
=
"duplicated column names"
;
const
char
*
msg4
=
"invalid data type"
;
const
char
*
msg4
=
"invalid data type"
;
const
char
*
msg5
=
"invalid binary/nchar column length"
;
const
char
*
msg5
=
"invalid binary/nchar column length"
;
const
char
*
msg6
=
"invalid column name"
;
const
char
*
msg6
=
"invalid column name"
;
...
@@ -1466,7 +1442,7 @@ static bool validateTableColumnInfo(SArray* pFieldList, SSqlCmd* pCmd) {
...
@@ -1466,7 +1442,7 @@ static bool validateTableColumnInfo(SArray* pFieldList, SSqlCmd* pCmd) {
// field name must be unique
// field name must be unique
if
(
has
(
pFieldList
,
i
+
1
,
pField
->
name
)
==
true
)
{
if
(
has
(
pFieldList
,
i
+
1
,
pField
->
name
)
==
true
)
{
tscErrorMsgWithCode
(
TSDB_CODE_TSC_DUP_COL_NAMES
,
tscGetErrorMsgPayload
(
pCmd
),
pField
->
name
,
NULL
);
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg3
);
return
false
;
return
false
;
}
}
...
@@ -1488,6 +1464,8 @@ static bool validateTagParams(SArray* pTagsList, SArray* pFieldList, SSqlCmd* pC
...
@@ -1488,6 +1464,8 @@ static bool validateTagParams(SArray* pTagsList, SArray* pFieldList, SSqlCmd* pC
const
char
*
msg1
=
"invalid number of tag columns"
;
const
char
*
msg1
=
"invalid number of tag columns"
;
const
char
*
msg2
=
"tag length too long"
;
const
char
*
msg2
=
"tag length too long"
;
const
char
*
msg3
=
"duplicated column names"
;
//const char* msg4 = "timestamp not allowed in tags";
const
char
*
msg5
=
"invalid data type in tags"
;
const
char
*
msg5
=
"invalid data type in tags"
;
const
char
*
msg6
=
"invalid tag name"
;
const
char
*
msg6
=
"invalid tag name"
;
const
char
*
msg7
=
"invalid binary/nchar tag length"
;
const
char
*
msg7
=
"invalid binary/nchar tag length"
;
...
@@ -1518,7 +1496,7 @@ static bool validateTagParams(SArray* pTagsList, SArray* pFieldList, SSqlCmd* pC
...
@@ -1518,7 +1496,7 @@ static bool validateTagParams(SArray* pTagsList, SArray* pFieldList, SSqlCmd* pC
}
}
if
(
has
(
pTagsList
,
i
+
1
,
p
->
name
)
==
true
)
{
if
(
has
(
pTagsList
,
i
+
1
,
p
->
name
)
==
true
)
{
tscErrorMsgWithCode
(
TSDB_CODE_TSC_DUP_COL_NAMES
,
tscGetErrorMsgPayload
(
pCmd
),
p
->
name
,
NULL
);
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg3
);
return
false
;
return
false
;
}
}
}
}
...
@@ -1545,7 +1523,7 @@ static bool validateTagParams(SArray* pTagsList, SArray* pFieldList, SSqlCmd* pC
...
@@ -1545,7 +1523,7 @@ static bool validateTagParams(SArray* pTagsList, SArray* pFieldList, SSqlCmd* pC
TAOS_FIELD
*
p
=
taosArrayGet
(
pTagsList
,
i
);
TAOS_FIELD
*
p
=
taosArrayGet
(
pTagsList
,
i
);
if
(
has
(
pFieldList
,
0
,
p
->
name
)
==
true
)
{
if
(
has
(
pFieldList
,
0
,
p
->
name
)
==
true
)
{
tscErrorMsgWithCode
(
TSDB_CODE_TSC_DUP_COL_NAMES
,
tscGetErrorMsgPayload
(
pCmd
),
p
->
name
,
NULL
);
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg3
);
return
false
;
return
false
;
}
}
}
}
...
@@ -1556,7 +1534,7 @@ static bool validateTagParams(SArray* pTagsList, SArray* pFieldList, SSqlCmd* pC
...
@@ -1556,7 +1534,7 @@ static bool validateTagParams(SArray* pTagsList, SArray* pFieldList, SSqlCmd* pC
/*
/*
* tags name /column name is truncated in sql.y
* tags name /column name is truncated in sql.y
*/
*/
bool
validateOneTags
(
SSqlCmd
*
pCmd
,
TAOS_FIELD
*
pTagField
)
{
int32_t
validateOneTag
(
SSqlCmd
*
pCmd
,
TAOS_FIELD
*
pTagField
)
{
const
char
*
msg3
=
"tag length too long"
;
const
char
*
msg3
=
"tag length too long"
;
const
char
*
msg4
=
"invalid tag name"
;
const
char
*
msg4
=
"invalid tag name"
;
const
char
*
msg5
=
"invalid binary/nchar tag length"
;
const
char
*
msg5
=
"invalid binary/nchar tag length"
;
...
@@ -1571,8 +1549,7 @@ bool validateOneTags(SSqlCmd* pCmd, TAOS_FIELD* pTagField) {
...
@@ -1571,8 +1549,7 @@ bool validateOneTags(SSqlCmd* pCmd, TAOS_FIELD* pTagField) {
// no more max columns
// no more max columns
if
(
numOfTags
+
numOfCols
>=
TSDB_MAX_COLUMNS
)
{
if
(
numOfTags
+
numOfCols
>=
TSDB_MAX_COLUMNS
)
{
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg7
);
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg7
);
return
false
;
}
}
// no more than 6 tags
// no more than 6 tags
...
@@ -1580,8 +1557,7 @@ bool validateOneTags(SSqlCmd* pCmd, TAOS_FIELD* pTagField) {
...
@@ -1580,8 +1557,7 @@ bool validateOneTags(SSqlCmd* pCmd, TAOS_FIELD* pTagField) {
char
msg
[
128
]
=
{
0
};
char
msg
[
128
]
=
{
0
};
sprintf
(
msg
,
"tags no more than %d"
,
TSDB_MAX_TAGS
);
sprintf
(
msg
,
"tags no more than %d"
,
TSDB_MAX_TAGS
);
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg
);
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg
);
return
false
;
}
}
// no timestamp allowable
// no timestamp allowable
...
@@ -1591,8 +1567,7 @@ bool validateOneTags(SSqlCmd* pCmd, TAOS_FIELD* pTagField) {
...
@@ -1591,8 +1567,7 @@ bool validateOneTags(SSqlCmd* pCmd, TAOS_FIELD* pTagField) {
//}
//}
if
((
pTagField
->
type
<
TSDB_DATA_TYPE_BOOL
)
||
(
pTagField
->
type
>
TSDB_DATA_TYPE_UBIGINT
))
{
if
((
pTagField
->
type
<
TSDB_DATA_TYPE_BOOL
)
||
(
pTagField
->
type
>
TSDB_DATA_TYPE_UBIGINT
))
{
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg6
);
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg6
);
return
false
;
}
}
SSchema
*
pTagSchema
=
tscGetTableTagSchema
(
pTableMetaInfo
->
pTableMeta
);
SSchema
*
pTagSchema
=
tscGetTableTagSchema
(
pTableMetaInfo
->
pTableMeta
);
...
@@ -1604,20 +1579,17 @@ bool validateOneTags(SSqlCmd* pCmd, TAOS_FIELD* pTagField) {
...
@@ -1604,20 +1579,17 @@ bool validateOneTags(SSqlCmd* pCmd, TAOS_FIELD* pTagField) {
// length less than TSDB_MAX_TASG_LEN
// length less than TSDB_MAX_TASG_LEN
if
(
nLen
+
pTagField
->
bytes
>
TSDB_MAX_TAGS_LEN
)
{
if
(
nLen
+
pTagField
->
bytes
>
TSDB_MAX_TAGS_LEN
)
{
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg3
);
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg3
);
return
false
;
}
}
// tags name can not be a keyword
// tags name can not be a keyword
if
(
validateColumnName
(
pTagField
->
name
)
!=
TSDB_CODE_SUCCESS
)
{
if
(
validateColumnName
(
pTagField
->
name
)
!=
TSDB_CODE_SUCCESS
)
{
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg4
);
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg4
);
return
false
;
}
}
// binary(val), val can not be equalled to or less than 0
// binary(val), val can not be equalled to or less than 0
if
((
pTagField
->
type
==
TSDB_DATA_TYPE_BINARY
||
pTagField
->
type
==
TSDB_DATA_TYPE_NCHAR
)
&&
pTagField
->
bytes
<=
0
)
{
if
((
pTagField
->
type
==
TSDB_DATA_TYPE_BINARY
||
pTagField
->
type
==
TSDB_DATA_TYPE_NCHAR
)
&&
pTagField
->
bytes
<=
0
)
{
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg5
);
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg5
);
return
false
;
}
}
// field name must be unique
// field name must be unique
...
@@ -1625,15 +1597,14 @@ bool validateOneTags(SSqlCmd* pCmd, TAOS_FIELD* pTagField) {
...
@@ -1625,15 +1597,14 @@ bool validateOneTags(SSqlCmd* pCmd, TAOS_FIELD* pTagField) {
for
(
int32_t
i
=
0
;
i
<
numOfTags
+
numOfCols
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
numOfTags
+
numOfCols
;
++
i
)
{
if
(
strncasecmp
(
pTagField
->
name
,
pSchema
[
i
].
name
,
sizeof
(
pTagField
->
name
)
-
1
)
==
0
)
{
if
(
strncasecmp
(
pTagField
->
name
,
pSchema
[
i
].
name
,
sizeof
(
pTagField
->
name
)
-
1
)
==
0
)
{
tscErrorMsgWithCode
(
TSDB_CODE_TSC_DUP_COL_NAMES
,
tscGetErrorMsgPayload
(
pCmd
),
pTagField
->
name
,
NULL
);
return
tscErrorMsgWithCode
(
TSDB_CODE_TSC_DUP_COL_NAMES
,
tscGetErrorMsgPayload
(
pCmd
),
pTagField
->
name
,
NULL
);
return
false
;
}
}
}
}
return
true
;
return
TSDB_CODE_SUCCESS
;
}
}
bool
validateOneColumn
(
SSqlCmd
*
pCmd
,
TAOS_FIELD
*
pColField
)
{
int32_t
validateOneColumn
(
SSqlCmd
*
pCmd
,
TAOS_FIELD
*
pColField
)
{
const
char
*
msg1
=
"too many columns"
;
const
char
*
msg1
=
"too many columns"
;
const
char
*
msg3
=
"column length too long"
;
const
char
*
msg3
=
"column length too long"
;
const
char
*
msg4
=
"invalid data type"
;
const
char
*
msg4
=
"invalid data type"
;
...
@@ -1649,18 +1620,15 @@ bool validateOneColumn(SSqlCmd* pCmd, TAOS_FIELD* pColField) {
...
@@ -1649,18 +1620,15 @@ bool validateOneColumn(SSqlCmd* pCmd, TAOS_FIELD* pColField) {
// no more max columns
// no more max columns
if
(
numOfCols
>=
TSDB_MAX_COLUMNS
||
numOfTags
+
numOfCols
>=
TSDB_MAX_COLUMNS
)
{
if
(
numOfCols
>=
TSDB_MAX_COLUMNS
||
numOfTags
+
numOfCols
>=
TSDB_MAX_COLUMNS
)
{
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg1
);
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg1
);
return
false
;
}
}
if
(
pColField
->
type
<
TSDB_DATA_TYPE_BOOL
||
pColField
->
type
>
TSDB_DATA_TYPE_UBIGINT
)
{
if
(
pColField
->
type
<
TSDB_DATA_TYPE_BOOL
||
pColField
->
type
>
TSDB_DATA_TYPE_UBIGINT
)
{
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg4
);
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg4
);
return
false
;
}
}
if
(
validateColumnName
(
pColField
->
name
)
!=
TSDB_CODE_SUCCESS
)
{
if
(
validateColumnName
(
pColField
->
name
)
!=
TSDB_CODE_SUCCESS
)
{
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg5
);
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg5
);
return
false
;
}
}
SSchema
*
pSchema
=
tscGetTableSchema
(
pTableMeta
);
SSchema
*
pSchema
=
tscGetTableSchema
(
pTableMeta
);
...
@@ -1671,25 +1639,22 @@ bool validateOneColumn(SSqlCmd* pCmd, TAOS_FIELD* pColField) {
...
@@ -1671,25 +1639,22 @@ bool validateOneColumn(SSqlCmd* pCmd, TAOS_FIELD* pColField) {
}
}
if
(
pColField
->
bytes
<=
0
)
{
if
(
pColField
->
bytes
<=
0
)
{
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg6
);
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg6
);
return
false
;
}
}
// length less than TSDB_MAX_BYTES_PER_ROW
// length less than TSDB_MAX_BYTES_PER_ROW
if
(
nLen
+
pColField
->
bytes
>
TSDB_MAX_BYTES_PER_ROW
)
{
if
(
nLen
+
pColField
->
bytes
>
TSDB_MAX_BYTES_PER_ROW
)
{
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg3
);
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg3
);
return
false
;
}
}
// field name must be unique
// field name must be unique
for
(
int32_t
i
=
0
;
i
<
numOfTags
+
numOfCols
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
numOfTags
+
numOfCols
;
++
i
)
{
if
(
strncasecmp
(
pColField
->
name
,
pSchema
[
i
].
name
,
sizeof
(
pColField
->
name
)
-
1
)
==
0
)
{
if
(
strncasecmp
(
pColField
->
name
,
pSchema
[
i
].
name
,
sizeof
(
pColField
->
name
)
-
1
)
==
0
)
{
tscErrorMsgWithCode
(
TSDB_CODE_TSC_DUP_COL_NAMES
,
tscGetErrorMsgPayload
(
pCmd
),
pColField
->
name
,
NULL
);
return
tscErrorMsgWithCode
(
TSDB_CODE_TSC_DUP_COL_NAMES
,
tscGetErrorMsgPayload
(
pCmd
),
pColField
->
name
,
NULL
);
return
false
;
}
}
}
}
return
true
;
return
TSDB_CODE_SUCCESS
;
}
}
/* is contained in pFieldList or not */
/* is contained in pFieldList or not */
...
@@ -6108,8 +6073,9 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
...
@@ -6108,8 +6073,9 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
}
}
TAOS_FIELD
*
p
=
taosArrayGet
(
pFieldList
,
0
);
TAOS_FIELD
*
p
=
taosArrayGet
(
pFieldList
,
0
);
if
(
!
validateOneTags
(
pCmd
,
p
))
{
int32_t
ret
=
validateOneTag
(
pCmd
,
p
);
return
TSDB_CODE_TSC_INVALID_OPERATION
;
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
return
ret
;
}
}
tscFieldInfoAppend
(
&
pQueryInfo
->
fieldsInfo
,
p
);
tscFieldInfoAppend
(
&
pQueryInfo
->
fieldsInfo
,
p
);
...
@@ -6286,8 +6252,9 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
...
@@ -6286,8 +6252,9 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
}
}
TAOS_FIELD
*
p
=
taosArrayGet
(
pFieldList
,
0
);
TAOS_FIELD
*
p
=
taosArrayGet
(
pFieldList
,
0
);
if
(
!
validateOneColumn
(
pCmd
,
p
))
{
int32_t
ret
=
validateOneColumn
(
pCmd
,
p
);
return
TSDB_CODE_TSC_INVALID_OPERATION
;
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
return
ret
;
}
}
tscFieldInfoAppend
(
&
pQueryInfo
->
fieldsInfo
,
p
);
tscFieldInfoAppend
(
&
pQueryInfo
->
fieldsInfo
,
p
);
...
@@ -8702,8 +8669,6 @@ static STableMeta* extractTempTableMetaFromSubquery(SQueryInfo* pUpstream) {
...
@@ -8702,8 +8669,6 @@ static STableMeta* extractTempTableMetaFromSubquery(SQueryInfo* pUpstream) {
n
+=
1
;
n
+=
1
;
}
}
info
->
numOfColumns
=
n
;
return
meta
;
return
meta
;
}
}
...
...
src/client/src/tscUtil.c
浏览文件 @
559dcff6
...
@@ -4096,6 +4096,31 @@ int32_t tscInvalidOperationMsg(char* msg, const char* additionalInfo, const char
...
@@ -4096,6 +4096,31 @@ int32_t tscInvalidOperationMsg(char* msg, const char* additionalInfo, const char
return
TSDB_CODE_TSC_INVALID_OPERATION
;
return
TSDB_CODE_TSC_INVALID_OPERATION
;
}
}
int32_t
tscErrorMsgWithCode
(
int32_t
code
,
char
*
dstBuffer
,
const
char
*
errMsg
,
const
char
*
sql
)
{
const
char
*
msgFormat1
=
"%s:%s"
;
const
char
*
msgFormat2
=
"%s:
\'
%s
\'
(%s)"
;
const
char
*
msgFormat3
=
"%s:
\'
%s
\'
"
;
const
int32_t
BACKWARD_CHAR_STEP
=
0
;
if
(
sql
==
NULL
)
{
assert
(
errMsg
!=
NULL
);
sprintf
(
dstBuffer
,
msgFormat1
,
tstrerror
(
code
),
errMsg
);
return
code
;
}
char
buf
[
64
]
=
{
0
};
// only extract part of sql string
strncpy
(
buf
,
(
sql
-
BACKWARD_CHAR_STEP
),
tListLen
(
buf
)
-
1
);
if
(
errMsg
!=
NULL
)
{
sprintf
(
dstBuffer
,
msgFormat2
,
tstrerror
(
code
),
buf
,
errMsg
);
}
else
{
sprintf
(
dstBuffer
,
msgFormat3
,
tstrerror
(
code
),
buf
);
// no additional information for invalid sql error
}
return
code
;
}
bool
tscHasReachLimitation
(
SQueryInfo
*
pQueryInfo
,
SSqlRes
*
pRes
)
{
bool
tscHasReachLimitation
(
SQueryInfo
*
pQueryInfo
,
SSqlRes
*
pRes
)
{
assert
(
pQueryInfo
!=
NULL
&&
pQueryInfo
->
clauseLimit
!=
0
);
assert
(
pQueryInfo
!=
NULL
&&
pQueryInfo
->
clauseLimit
!=
0
);
return
(
pQueryInfo
->
clauseLimit
>
0
&&
pRes
->
numOfClauseTotal
>=
pQueryInfo
->
clauseLimit
);
return
(
pQueryInfo
->
clauseLimit
>
0
&&
pRes
->
numOfClauseTotal
>=
pQueryInfo
->
clauseLimit
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录