Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
90697d04
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看板
提交
90697d04
编写于
6月 15, 2020
作者:
dengyihao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
bugfix TD-690
上级
1886b9c9
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
44 addition
and
12 deletion
+44
-12
src/client/src/tscSQLParser.c
src/client/src/tscSQLParser.c
+8
-0
src/query/inc/sql.y
src/query/inc/sql.y
+11
-3
src/query/src/qparserImpl.c
src/query/src/qparserImpl.c
+10
-2
src/query/src/sql.c
src/query/src/sql.c
+15
-7
未找到文件。
src/client/src/tscSQLParser.c
浏览文件 @
90697d04
...
...
@@ -752,6 +752,10 @@ static bool validateTableColumnInfo(tFieldList* pFieldList, SSqlCmd* pCmd) {
int32_t
nLen
=
0
;
for
(
int32_t
i
=
0
;
i
<
pFieldList
->
nField
;
++
i
)
{
if
(
pFieldList
->
p
[
i
].
bytes
==
0
)
{
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg5
);
return
false
;
}
nLen
+=
pFieldList
->
p
[
i
].
bytes
;
}
...
...
@@ -808,6 +812,10 @@ static bool validateTagParams(tFieldList* pTagsList, tFieldList* pFieldList, SSq
int32_t
nLen
=
0
;
for
(
int32_t
i
=
0
;
i
<
pTagsList
->
nField
;
++
i
)
{
if
(
pTagsList
->
p
[
i
].
bytes
==
0
)
{
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg7
);
return
false
;
}
nLen
+=
pTagsList
->
p
[
i
].
bytes
;
}
...
...
src/query/inc/sql.y
浏览文件 @
90697d04
...
...
@@ -251,12 +251,20 @@ alter_db_optr(Y) ::= alter_db_optr(Z) comp(X). { Y = Z; Y.compressionLeve
alter_db_optr(Y) ::= alter_db_optr(Z) wal(X). { Y = Z; Y.walLevel = strtol(X.z, NULL, 10); }
%type typename {TAOS_FIELD}
typename(A) ::= ids(X). { tSQLSetColumnType (&A, &X); }
typename(A) ::= ids(X). {
X.type = 0;
tSQLSetColumnType (&A, &X);
}
//define binary type, e.g., binary(10), nchar(10)
typename(A) ::= ids(X) LP signed(Y) RP. {
X.type = -Y; // negative value of name length
tSQLSetColumnType(&A, &X);
if (Y <= 0) {
X.type = 0;
tSQLSetColumnType(&A, &X);
} else {
X.type = -Y; // negative value of name length
tSQLSetColumnType(&A, &X);
}
}
%type signed {int64_t}
...
...
src/query/src/qparserImpl.c
浏览文件 @
90697d04
...
...
@@ -497,10 +497,18 @@ void tSQLSetColumnType(TAOS_FIELD *pField, SSQLToken *type) {
* number of bytes in UCS-4 format, which is 4 times larger than the
* number of characters
*/
pField
->
bytes
=
-
(
int32_t
)
type
->
type
*
TSDB_NCHAR_SIZE
+
LENGTH_SIZE_OF_STR
;
if
(
type
->
type
==
0
)
{
pField
->
bytes
=
0
;
}
else
{
pField
->
bytes
=
-
(
int32_t
)
type
->
type
*
TSDB_NCHAR_SIZE
+
LENGTH_SIZE_OF_STR
;
}
}
else
if
(
i
==
TSDB_DATA_TYPE_BINARY
)
{
/* for binary, the TOKENTYPE is the length of binary */
pField
->
bytes
=
-
(
int32_t
)
type
->
type
+
LENGTH_SIZE_OF_STR
;
if
(
type
->
type
==
0
)
{
pField
->
bytes
=
0
;
}
else
{
pField
->
bytes
=
-
(
int32_t
)
type
->
type
+
LENGTH_SIZE_OF_STR
;
}
}
break
;
}
...
...
src/query/src/sql.c
100644 → 100755
浏览文件 @
90697d04
...
...
@@ -25,17 +25,17 @@
#include <stdio.h>
/************ Begin %include sections from the grammar ************************/
#include <assert.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <stdbool.h>
#include "tutil.h"
#include "qsqlparser.h"
#include "tstoken.h"
#include "tutil.h"
#include "tvariant.h"
#include "ttokendef.h"
#include "qsqltype.h"
/**************** End of %include directives **********************************/
/* These constants specify the various numeric values for terminal symbols
** in a format understandable to "makeheaders". This section is blank unless
...
...
@@ -2262,13 +2262,21 @@ static void yy_reduce(
{
setDefaultCreateDbOption
(
&
yymsp
[
1
].
minor
.
yy374
);}
break
;
case
102
:
/* typename ::= ids */
{
tSQLSetColumnType
(
&
yylhsminor
.
yy325
,
&
yymsp
[
0
].
minor
.
yy0
);
}
{
yymsp
[
0
].
minor
.
yy0
.
type
=
0
;
tSQLSetColumnType
(
&
yylhsminor
.
yy325
,
&
yymsp
[
0
].
minor
.
yy0
);
}
yymsp
[
0
].
minor
.
yy325
=
yylhsminor
.
yy325
;
break
;
case
103
:
/* typename ::= ids LP signed RP */
{
yymsp
[
-
3
].
minor
.
yy0
.
type
=
-
yymsp
[
-
1
].
minor
.
yy279
;
// negative value of name length
tSQLSetColumnType
(
&
yylhsminor
.
yy325
,
&
yymsp
[
-
3
].
minor
.
yy0
);
if
(
yymsp
[
-
1
].
minor
.
yy279
<=
0
)
{
yymsp
[
-
3
].
minor
.
yy0
.
type
=
0
;
tSQLSetColumnType
(
&
yylhsminor
.
yy325
,
&
yymsp
[
-
3
].
minor
.
yy0
);
}
else
{
yymsp
[
-
3
].
minor
.
yy0
.
type
=
-
yymsp
[
-
1
].
minor
.
yy279
;
// negative value of name length
tSQLSetColumnType
(
&
yylhsminor
.
yy325
,
&
yymsp
[
-
3
].
minor
.
yy0
);
}
}
yymsp
[
-
3
].
minor
.
yy325
=
yylhsminor
.
yy325
;
break
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录