Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
fa295969
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
fa295969
编写于
3月 23, 2022
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
差异文件
[td-13039] merge 3.0.
上级
47d32551
1ad4440b
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
459 addition
and
40 deletion
+459
-40
source/common/src/tdataformat.c
source/common/src/tdataformat.c
+1
-0
source/libs/parser/inc/parAst.h
source/libs/parser/inc/parAst.h
+11
-11
source/libs/parser/src/parAstCreater.c
source/libs/parser/src/parAstCreater.c
+38
-20
source/util/src/tutil.c
source/util/src/tutil.c
+1
-1
tests/script/tsim/insert/backquote.sim
tests/script/tsim/insert/backquote.sim
+343
-0
tests/script/tsim/insert/basic0.sim
tests/script/tsim/insert/basic0.sim
+8
-1
tests/script/tsim/insert/basic1.sim
tests/script/tsim/insert/basic1.sim
+39
-7
tests/script/tsim/testCaseSuite.sim
tests/script/tsim/testCaseSuite.sim
+18
-0
未找到文件。
source/common/src/tdataformat.c
浏览文件 @
fa295969
...
...
@@ -431,6 +431,7 @@ SDataCols *tdDupDataCols(SDataCols *pDataCols, bool keepData) {
for
(
int
i
=
0
;
i
<
pDataCols
->
numOfCols
;
i
++
)
{
pRet
->
cols
[
i
].
type
=
pDataCols
->
cols
[
i
].
type
;
pRet
->
cols
[
i
].
bitmap
=
pDataCols
->
cols
[
i
].
bitmap
;
pRet
->
cols
[
i
].
colId
=
pDataCols
->
cols
[
i
].
colId
;
pRet
->
cols
[
i
].
bytes
=
pDataCols
->
cols
[
i
].
bytes
;
pRet
->
cols
[
i
].
offset
=
pDataCols
->
cols
[
i
].
offset
;
...
...
source/libs/parser/inc/parAst.h
浏览文件 @
fa295969
...
...
@@ -84,7 +84,7 @@ SToken getTokenFromRawExprNode(SAstCreateContext* pCxt, SNode* pNode);
SNodeList
*
createNodeList
(
SAstCreateContext
*
pCxt
,
SNode
*
pNode
);
SNodeList
*
addNodeToList
(
SAstCreateContext
*
pCxt
,
SNodeList
*
pList
,
SNode
*
pNode
);
SNode
*
createColumnNode
(
SAstCreateContext
*
pCxt
,
const
SToken
*
pTableAlias
,
const
SToken
*
pColumnName
);
SNode
*
createColumnNode
(
SAstCreateContext
*
pCxt
,
SToken
*
pTableAlias
,
SToken
*
pColumnName
);
SNode
*
createValueNode
(
SAstCreateContext
*
pCxt
,
int32_t
dataType
,
const
SToken
*
pLiteral
);
SNode
*
createDurationValueNode
(
SAstCreateContext
*
pCxt
,
const
SToken
*
pLiteral
);
SNode
*
createDefaultDatabaseCondValue
(
SAstCreateContext
*
pCxt
);
...
...
@@ -95,7 +95,7 @@ SNode* createBetweenAnd(SAstCreateContext* pCxt, SNode* pExpr, SNode* pLeft, SNo
SNode
*
createNotBetweenAnd
(
SAstCreateContext
*
pCxt
,
SNode
*
pExpr
,
SNode
*
pLeft
,
SNode
*
pRight
);
SNode
*
createFunctionNode
(
SAstCreateContext
*
pCxt
,
const
SToken
*
pFuncName
,
SNodeList
*
pParameterList
);
SNode
*
createNodeListNode
(
SAstCreateContext
*
pCxt
,
SNodeList
*
pList
);
SNode
*
createRealTableNode
(
SAstCreateContext
*
pCxt
,
const
SToken
*
pDbName
,
const
SToken
*
pTableName
,
const
SToken
*
pTableAlias
);
SNode
*
createRealTableNode
(
SAstCreateContext
*
pCxt
,
SToken
*
pDbName
,
SToken
*
pTableName
,
SToken
*
pTableAlias
);
SNode
*
createTempTableNode
(
SAstCreateContext
*
pCxt
,
SNode
*
pSubquery
,
const
SToken
*
pTableAlias
);
SNode
*
createJoinTableNode
(
SAstCreateContext
*
pCxt
,
EJoinType
type
,
SNode
*
pLeft
,
SNode
*
pRight
,
SNode
*
pJoinCond
);
SNode
*
createLimitNode
(
SAstCreateContext
*
pCxt
,
const
SToken
*
pLimit
,
const
SToken
*
pOffset
);
...
...
@@ -120,9 +120,9 @@ SNode* createSetOperator(SAstCreateContext* pCxt, ESetOperatorType type, SNode*
SNode
*
createDefaultDatabaseOptions
(
SAstCreateContext
*
pCxt
);
SNode
*
createDefaultAlterDatabaseOptions
(
SAstCreateContext
*
pCxt
);
SNode
*
setDatabaseOption
(
SAstCreateContext
*
pCxt
,
SNode
*
pOptions
,
EDatabaseOptionType
type
,
const
SToken
*
pVal
);
SNode
*
createCreateDatabaseStmt
(
SAstCreateContext
*
pCxt
,
bool
ignoreExists
,
const
SToken
*
pDbName
,
SNode
*
pOptions
);
SNode
*
createDropDatabaseStmt
(
SAstCreateContext
*
pCxt
,
bool
ignoreNotExists
,
const
SToken
*
pDbName
);
SNode
*
createAlterDatabaseStmt
(
SAstCreateContext
*
pCxt
,
const
SToken
*
pDbName
,
SNode
*
pOptions
);
SNode
*
createCreateDatabaseStmt
(
SAstCreateContext
*
pCxt
,
bool
ignoreExists
,
SToken
*
pDbName
,
SNode
*
pOptions
);
SNode
*
createDropDatabaseStmt
(
SAstCreateContext
*
pCxt
,
bool
ignoreNotExists
,
SToken
*
pDbName
);
SNode
*
createAlterDatabaseStmt
(
SAstCreateContext
*
pCxt
,
SToken
*
pDbName
,
SNode
*
pOptions
);
SNode
*
createDefaultTableOptions
(
SAstCreateContext
*
pCxt
);
SNode
*
createDefaultAlterTableOptions
(
SAstCreateContext
*
pCxt
);
SNode
*
setTableOption
(
SAstCreateContext
*
pCxt
,
SNode
*
pOptions
,
ETableOptionType
type
,
const
SToken
*
pVal
);
...
...
@@ -142,17 +142,17 @@ SNode* createAlterTableAddModifyCol(SAstCreateContext* pCxt, SNode* pRealTable,
SNode
*
createAlterTableDropCol
(
SAstCreateContext
*
pCxt
,
SNode
*
pRealTable
,
int8_t
alterType
,
const
SToken
*
pColName
);
SNode
*
createAlterTableRenameCol
(
SAstCreateContext
*
pCxt
,
SNode
*
pRealTable
,
int8_t
alterType
,
const
SToken
*
pOldColName
,
const
SToken
*
pNewColName
);
SNode
*
createAlterTableSetTag
(
SAstCreateContext
*
pCxt
,
SNode
*
pRealTable
,
const
SToken
*
pTagName
,
SNode
*
pVal
);
SNode
*
createUseDatabaseStmt
(
SAstCreateContext
*
pCxt
,
const
SToken
*
pDbName
);
SNode
*
createUseDatabaseStmt
(
SAstCreateContext
*
pCxt
,
SToken
*
pDbName
);
SNode
*
createShowStmt
(
SAstCreateContext
*
pCxt
,
ENodeType
type
,
SNode
*
pDbName
,
SNode
*
pTbNamePattern
);
SNode
*
createCreateUserStmt
(
SAstCreateContext
*
pCxt
,
const
SToken
*
pUserName
,
const
SToken
*
pPassword
);
SNode
*
createAlterUserStmt
(
SAstCreateContext
*
pCxt
,
const
SToken
*
pUserName
,
int8_t
alterType
,
const
SToken
*
pVal
);
SNode
*
createDropUserStmt
(
SAstCreateContext
*
pCxt
,
const
SToken
*
pUserName
);
SNode
*
createCreateUserStmt
(
SAstCreateContext
*
pCxt
,
SToken
*
pUserName
,
const
SToken
*
pPassword
);
SNode
*
createAlterUserStmt
(
SAstCreateContext
*
pCxt
,
SToken
*
pUserName
,
int8_t
alterType
,
const
SToken
*
pVal
);
SNode
*
createDropUserStmt
(
SAstCreateContext
*
pCxt
,
SToken
*
pUserName
);
SNode
*
createCreateDnodeStmt
(
SAstCreateContext
*
pCxt
,
const
SToken
*
pFqdn
,
const
SToken
*
pPort
);
SNode
*
createDropDnodeStmt
(
SAstCreateContext
*
pCxt
,
const
SToken
*
pDnode
);
SNode
*
createAlterDnodeStmt
(
SAstCreateContext
*
pCxt
,
const
SToken
*
pDnode
,
const
SToken
*
pConfig
,
const
SToken
*
pValue
);
SNode
*
createCreateIndexStmt
(
SAstCreateContext
*
pCxt
,
EIndexType
type
,
const
SToken
*
pIndexName
,
const
SToken
*
pTableName
,
SNodeList
*
pCols
,
SNode
*
pOptions
);
SNode
*
createCreateIndexStmt
(
SAstCreateContext
*
pCxt
,
EIndexType
type
,
SToken
*
pIndexName
,
SToken
*
pTableName
,
SNodeList
*
pCols
,
SNode
*
pOptions
);
SNode
*
createIndexOption
(
SAstCreateContext
*
pCxt
,
SNodeList
*
pFuncs
,
SNode
*
pInterval
,
SNode
*
pOffset
,
SNode
*
pSliding
);
SNode
*
createDropIndexStmt
(
SAstCreateContext
*
pCxt
,
const
SToken
*
pIndexName
,
const
SToken
*
pTableName
);
SNode
*
createDropIndexStmt
(
SAstCreateContext
*
pCxt
,
SToken
*
pIndexName
,
SToken
*
pTableName
);
SNode
*
createCreateQnodeStmt
(
SAstCreateContext
*
pCxt
,
const
SToken
*
pDnodeId
);
SNode
*
createDropQnodeStmt
(
SAstCreateContext
*
pCxt
,
const
SToken
*
pDnodeId
);
SNode
*
createCreateTopicStmt
(
SAstCreateContext
*
pCxt
,
bool
ignoreExists
,
const
SToken
*
pTopicName
,
SNode
*
pQuery
,
const
SToken
*
pSubscribeDbName
);
...
...
source/libs/parser/src/parAstCreater.c
浏览文件 @
fa295969
...
...
@@ -331,7 +331,14 @@ void initAstCreateContext(SParseContext* pParseCxt, SAstCreateContext* pCxt) {
initSetTableOptionFp
();
}
static
bool
checkUserName
(
SAstCreateContext
*
pCxt
,
const
SToken
*
pUserName
)
{
static
void
trimEscape
(
SToken
*
pName
)
{
if
(
NULL
!=
pName
&&
pName
->
n
>
1
&&
'`'
==
pName
->
z
[
0
])
{
pName
->
z
+=
1
;
pName
->
n
-=
2
;
}
}
static
bool
checkUserName
(
SAstCreateContext
*
pCxt
,
SToken
*
pUserName
)
{
if
(
NULL
==
pUserName
)
{
pCxt
->
valid
=
false
;
}
else
{
...
...
@@ -340,6 +347,7 @@ static bool checkUserName(SAstCreateContext* pCxt, const SToken* pUserName) {
pCxt
->
valid
=
false
;
}
}
trimEscape
(
pUserName
);
return
pCxt
->
valid
;
}
...
...
@@ -412,38 +420,43 @@ static bool checkPort(SAstCreateContext* pCxt, const SToken* pPortToken, int32_t
return
pCxt
->
valid
;
}
static
bool
checkDbName
(
SAstCreateContext
*
pCxt
,
const
SToken
*
pDbName
,
bool
query
)
{
static
bool
checkDbName
(
SAstCreateContext
*
pCxt
,
SToken
*
pDbName
,
bool
query
)
{
if
(
NULL
==
pDbName
)
{
pCxt
->
valid
=
(
query
?
NULL
!=
pCxt
->
pQueryCxt
->
db
:
true
);
}
else
{
pCxt
->
valid
=
pDbName
->
n
<
TSDB_DB_NAME_LEN
?
true
:
false
;
}
trimEscape
(
pDbName
);
return
pCxt
->
valid
;
}
static
bool
checkTableName
(
SAstCreateContext
*
pCxt
,
const
SToken
*
pTableName
)
{
static
bool
checkTableName
(
SAstCreateContext
*
pCxt
,
SToken
*
pTableName
)
{
if
(
NULL
==
pTableName
)
{
pCxt
->
valid
=
true
;
}
else
{
pCxt
->
valid
=
pTableName
->
n
<
TSDB_TABLE_NAME_LEN
?
true
:
false
;
}
trimEscape
(
pTableName
);
return
pCxt
->
valid
;
}
static
bool
checkColumnName
(
SAstCreateContext
*
pCxt
,
const
SToken
*
pColumnName
)
{
static
bool
checkColumnName
(
SAstCreateContext
*
pCxt
,
SToken
*
pColumnName
)
{
if
(
NULL
==
pColumnName
)
{
pCxt
->
valid
=
true
;
}
else
{
pCxt
->
valid
=
pColumnName
->
n
<
TSDB_COL_NAME_LEN
?
true
:
false
;
}
trimEscape
(
pColumnName
);
return
pCxt
->
valid
;
}
static
bool
checkIndexName
(
SAstCreateContext
*
pCxt
,
const
SToken
*
pIndexName
)
{
static
bool
checkIndexName
(
SAstCreateContext
*
pCxt
,
SToken
*
pIndexName
)
{
if
(
NULL
==
pIndexName
)
{
return
false
;
pCxt
->
valid
=
false
;
}
else
{
pCxt
->
valid
=
pIndexName
->
n
<
TSDB_INDEX_NAME_LEN
?
true
:
false
;
}
pCxt
->
valid
=
pIndexName
->
n
<
TSDB_INDEX_NAME_LEN
?
true
:
false
;
trimEscape
(
pIndexName
)
;
return
pCxt
->
valid
;
}
...
...
@@ -498,7 +511,7 @@ SNodeList* addNodeToList(SAstCreateContext* pCxt, SNodeList* pList, SNode* pNode
return
pList
;
}
SNode
*
createColumnNode
(
SAstCreateContext
*
pCxt
,
const
SToken
*
pTableAlias
,
const
SToken
*
pColumnName
)
{
SNode
*
createColumnNode
(
SAstCreateContext
*
pCxt
,
SToken
*
pTableAlias
,
SToken
*
pColumnName
)
{
if
(
!
checkTableName
(
pCxt
,
pTableAlias
)
||
!
checkColumnName
(
pCxt
,
pColumnName
))
{
return
NULL
;
}
...
...
@@ -603,8 +616,8 @@ SNode* createNodeListNode(SAstCreateContext* pCxt, SNodeList* pList) {
return
(
SNode
*
)
list
;
}
SNode
*
createRealTableNode
(
SAstCreateContext
*
pCxt
,
const
SToken
*
pDbName
,
const
SToken
*
pTableName
,
const
SToken
*
pTableAlias
)
{
if
(
!
checkDbName
(
pCxt
,
pDbName
,
true
)
||
!
checkTableName
(
pCxt
,
pTableName
))
{
SNode
*
createRealTableNode
(
SAstCreateContext
*
pCxt
,
SToken
*
pDbName
,
SToken
*
pTableName
,
SToken
*
pTableAlias
)
{
if
(
!
checkDbName
(
pCxt
,
pDbName
,
true
)
||
!
checkTableName
(
pCxt
,
pTableName
)
||
!
checkTableName
(
pCxt
,
pTableAlias
)
)
{
return
NULL
;
}
SRealTableNode
*
realTable
=
(
SRealTableNode
*
)
nodesMakeNode
(
QUERY_NODE_REAL_TABLE
);
...
...
@@ -620,7 +633,9 @@ SNode* createRealTableNode(SAstCreateContext* pCxt, const SToken* pDbName, const
strncpy
(
realTable
->
table
.
tableAlias
,
pTableName
->
z
,
pTableName
->
n
);
}
strncpy
(
realTable
->
table
.
tableName
,
pTableName
->
z
,
pTableName
->
n
);
strcpy
(
realTable
->
useDbName
,
pCxt
->
pQueryCxt
->
db
);
if
(
NULL
!=
pCxt
->
pQueryCxt
->
db
)
{
strcpy
(
realTable
->
useDbName
,
pCxt
->
pQueryCxt
->
db
);
}
return
(
SNode
*
)
realTable
;
}
...
...
@@ -839,7 +854,7 @@ SNode* setDatabaseOption(SAstCreateContext* pCxt, SNode* pOptions, EDatabaseOpti
return
(
SNode
*
)
setDbOptionFuncs
[
type
](
pCxt
,
(
SDatabaseOptions
*
)
pOptions
,
pVal
);
}
SNode
*
createCreateDatabaseStmt
(
SAstCreateContext
*
pCxt
,
bool
ignoreExists
,
const
SToken
*
pDbName
,
SNode
*
pOptions
)
{
SNode
*
createCreateDatabaseStmt
(
SAstCreateContext
*
pCxt
,
bool
ignoreExists
,
SToken
*
pDbName
,
SNode
*
pOptions
)
{
if
(
!
checkDbName
(
pCxt
,
pDbName
,
false
))
{
return
NULL
;
}
...
...
@@ -851,7 +866,7 @@ SNode* createCreateDatabaseStmt(SAstCreateContext* pCxt, bool ignoreExists, cons
return
(
SNode
*
)
pStmt
;
}
SNode
*
createDropDatabaseStmt
(
SAstCreateContext
*
pCxt
,
bool
ignoreNotExists
,
const
SToken
*
pDbName
)
{
SNode
*
createDropDatabaseStmt
(
SAstCreateContext
*
pCxt
,
bool
ignoreNotExists
,
SToken
*
pDbName
)
{
if
(
!
checkDbName
(
pCxt
,
pDbName
,
false
))
{
return
NULL
;
}
...
...
@@ -862,7 +877,7 @@ SNode* createDropDatabaseStmt(SAstCreateContext* pCxt, bool ignoreNotExists, con
return
(
SNode
*
)
pStmt
;
}
SNode
*
createAlterDatabaseStmt
(
SAstCreateContext
*
pCxt
,
const
SToken
*
pDbName
,
SNode
*
pOptions
)
{
SNode
*
createAlterDatabaseStmt
(
SAstCreateContext
*
pCxt
,
SToken
*
pDbName
,
SNode
*
pOptions
)
{
if
(
!
checkDbName
(
pCxt
,
pDbName
,
false
))
{
return
NULL
;
}
...
...
@@ -1031,7 +1046,10 @@ SNode* createAlterTableSetTag(SAstCreateContext* pCxt, SNode* pRealTable, const
return
(
SNode
*
)
pStmt
;
}
SNode
*
createUseDatabaseStmt
(
SAstCreateContext
*
pCxt
,
const
SToken
*
pDbName
)
{
SNode
*
createUseDatabaseStmt
(
SAstCreateContext
*
pCxt
,
SToken
*
pDbName
)
{
if
(
!
checkDbName
(
pCxt
,
pDbName
,
false
))
{
return
NULL
;
}
SUseDatabaseStmt
*
pStmt
=
(
SUseDatabaseStmt
*
)
nodesMakeNode
(
QUERY_NODE_USE_DATABASE_STMT
);
CHECK_OUT_OF_MEM
(
pStmt
);
strncpy
(
pStmt
->
dbName
,
pDbName
->
z
,
pDbName
->
n
);
...
...
@@ -1055,7 +1073,7 @@ SNode* createShowStmt(SAstCreateContext* pCxt, ENodeType type, SNode* pDbName, S
return
(
SNode
*
)
pStmt
;
}
SNode
*
createCreateUserStmt
(
SAstCreateContext
*
pCxt
,
const
SToken
*
pUserName
,
const
SToken
*
pPassword
)
{
SNode
*
createCreateUserStmt
(
SAstCreateContext
*
pCxt
,
SToken
*
pUserName
,
const
SToken
*
pPassword
)
{
char
password
[
TSDB_USET_PASSWORD_LEN
]
=
{
0
};
if
(
!
checkUserName
(
pCxt
,
pUserName
)
||
!
checkPassword
(
pCxt
,
pPassword
,
password
))
{
return
NULL
;
...
...
@@ -1067,7 +1085,7 @@ SNode* createCreateUserStmt(SAstCreateContext* pCxt, const SToken* pUserName, co
return
(
SNode
*
)
pStmt
;
}
SNode
*
createAlterUserStmt
(
SAstCreateContext
*
pCxt
,
const
SToken
*
pUserName
,
int8_t
alterType
,
const
SToken
*
pVal
)
{
SNode
*
createAlterUserStmt
(
SAstCreateContext
*
pCxt
,
SToken
*
pUserName
,
int8_t
alterType
,
const
SToken
*
pVal
)
{
if
(
!
checkUserName
(
pCxt
,
pUserName
))
{
return
NULL
;
}
...
...
@@ -1086,7 +1104,7 @@ SNode* createAlterUserStmt(SAstCreateContext* pCxt, const SToken* pUserName, int
return
(
SNode
*
)
pStmt
;
}
SNode
*
createDropUserStmt
(
SAstCreateContext
*
pCxt
,
const
SToken
*
pUserName
)
{
SNode
*
createDropUserStmt
(
SAstCreateContext
*
pCxt
,
SToken
*
pUserName
)
{
if
(
!
checkUserName
(
pCxt
,
pUserName
))
{
return
NULL
;
}
...
...
@@ -1142,7 +1160,7 @@ SNode* createAlterDnodeStmt(SAstCreateContext* pCxt, const SToken* pDnode, const
return
(
SNode
*
)
pStmt
;
}
SNode
*
createCreateIndexStmt
(
SAstCreateContext
*
pCxt
,
EIndexType
type
,
const
SToken
*
pIndexName
,
const
SToken
*
pTableName
,
SNodeList
*
pCols
,
SNode
*
pOptions
)
{
SNode
*
createCreateIndexStmt
(
SAstCreateContext
*
pCxt
,
EIndexType
type
,
SToken
*
pIndexName
,
SToken
*
pTableName
,
SNodeList
*
pCols
,
SNode
*
pOptions
)
{
if
(
!
checkIndexName
(
pCxt
,
pIndexName
)
||
!
checkTableName
(
pCxt
,
pTableName
))
{
return
NULL
;
}
...
...
@@ -1166,7 +1184,7 @@ SNode* createIndexOption(SAstCreateContext* pCxt, SNodeList* pFuncs, SNode* pInt
return
(
SNode
*
)
pOptions
;
}
SNode
*
createDropIndexStmt
(
SAstCreateContext
*
pCxt
,
const
SToken
*
pIndexName
,
const
SToken
*
pTableName
)
{
SNode
*
createDropIndexStmt
(
SAstCreateContext
*
pCxt
,
SToken
*
pIndexName
,
SToken
*
pTableName
)
{
if
(
!
checkIndexName
(
pCxt
,
pIndexName
)
||
!
checkTableName
(
pCxt
,
pTableName
))
{
return
NULL
;
}
...
...
source/util/src/tutil.c
浏览文件 @
fa295969
...
...
@@ -233,7 +233,7 @@ char *strntolower(char *dst, const char *src, int32_t n) {
}
}
else
if
(
c
>=
'A'
&&
c
<=
'Z'
)
{
c
-=
'A'
-
'a'
;
}
else
if
(
c
==
'\''
||
c
==
'"'
)
{
}
else
if
(
c
==
'\''
||
c
==
'"'
||
c
==
'`'
)
{
quote
=
c
;
}
*
p
++
=
c
;
...
...
tests/script/tsim/insert/backquote.sim
0 → 100644
浏览文件 @
fa295969
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/exec.sh -n dnode1 -s start
sleep 50
sql connect
print =============== create database
sql create database `database`
sql create database `DataBase`
sql show databases
print rows: $rows
print $data00 $data01
print $data10 $data11
print $data20 $data21
if $rows != 3 then
return -1
endi
if $data00 != database then
return -1
endi
if $data10 != DataBase then
return -1
endi
if $data20 != information_schema then
return -1
endi
$dbCnt = 0
while $dbCnt < 2
if $dbCnt == 0 then
sql use `database`
else
sql use `DataBase`
endi
$dbCnt = $dbCnt + 1
print =============== create super table, include all type
sql create table `stable` (`timestamp` timestamp, `int` int, `binary` binary(16), `nchar` nchar(16)) tags (`float` float, `Binary` binary(16), `Nchar` nchar(16))
sql create table `Stable` (`timestamp` timestamp, `int` int, `Binary` binary(32), `Nchar` nchar(32)) tags (`float` float, `binary` binary(16), `nchar` nchar(16))
sql show stables
print rows: $rows
print $data00 $data01
print $data10 $data11
if $rows != 2 then
return -1
endi
if $data00 != Stable then
return -1
endi
if $data10 != stable then
return -1
endi
print =============== create child table
sql create table `table` using `stable` tags(100.0, 'stable+table', 'stable+table')
sql create table `Table` using `stable` tags(100.1, 'stable+Table', 'stable+Table')
sql create table `TAble` using `Stable` tags(100.0, 'Stable+TAble', 'Stable+TAble')
sql create table `TABle` using `Stable` tags(100.1, 'Stable+TABle', 'Stable+TABle')
sql show tables
print rows: $rows
print $data00 $data01
print $data10 $data11
print $data20 $data21
print $data30 $data31
if $rows != 4 then
return -1
endi
print =============== insert data
sql insert into `table` values(now+0s, 10, 'table', 'table')(now+1s, 11, 'table', 'table')
sql insert into `Table` values(now+0s, 20, 'Table', 'Table')(now+1s, 21, 'Table', 'Table')
sql insert into `TAble` values(now+0s, 30, 'TAble', 'TAble')(now+1s, 31, 'TAble', 'TAble')
sql insert into `TABle` values(now+0s, 40, 'TABle', 'TABle')(now+4s, 41, 'TABle', 'TABle')
print =============== query data
sql select * from `table`
print rows: $rows
print $data00 $data01 $data02 $data03
print $data10 $data11 $data12 $data13
if $rows != 2 then
return -1
endi
if $data01 != 10 then
return -1
endi
if $data02 != table then
return -1
endi
if $data03 != table then
return -1
endi
sql select * from `Table`
print rows: $rows
print $data00 $data01 $data02 $data03
print $data10 $data11 $data12 $data13
if $rows != 2 then
return -1
endi
if $data01 != 20 then
return -1
endi
if $data02 != Table then
return -1
endi
if $data03 != Table then
return -1
endi
sql select * from `TAble`
print rows: $rows
print $data00 $data01 $data02 $data03
print $data10 $data11 $data12 $data13
if $rows != 2 then
return -1
endi
if $data01 != 30 then
return -1
endi
if $data02 != TAble then
return -1
endi
if $data03 != TAble then
return -1
endi
sql select * from `TABle`
print rows: $rows
print $data00 $data01 $data02 $data03
print $data10 $data11 $data12 $data13
if $rows != 2 then
return -1
endi
if $data01 != 40 then
return -1
endi
if $data02 != TABle then
return -1
endi
if $data03 != TABle then
return -1
endi
print =============== query data from st, but not support select * from super table, waiting fix
sql select count(*) from `stable`
print rows: $rows
print $data00 $data01 $data02 $data03
if $rows != 1 then
return -1
endi
if $data00 != 4 then
return -1
endi
sql select count(*) from `Stable`
print rows: $rows
print $data00 $data01 $data02 $data03
if $rows != 1 then
return -1
endi
if $data00 != 4 then
return -1
endi
#sql select * from st
#if $rows != 4 then
# return -1
#endi
endw
print =============== stop and restart taosd
system sh/exec.sh -n dnode1 -s stop -x SIGINT
system sh/exec.sh -n dnode1 -s start
$loop_cnt = 0
check_dnode_ready:
$loop_cnt = $loop_cnt + 1
sleep 100
if $loop_cnt == 10 then
print ====> dnode not ready!
return -1
endi
sql show dnodes
print ===> $rows $data00 $data01 $data02 $data03 $data04 $data05
if $data00 != 1 then
return -1
endi
if $data04 != ready then
goto check_dnode_ready
endi
sql show databases
print rows: $rows
print $data00 $data01
print $data10 $data11
print $data20 $data21
if $rows != 3 then
return -1
endi
if $data00 != database then
return -1
endi
if $data10 != DataBase then
return -1
endi
if $data20 != information_schema then
return -1
endi
$dbCnt = 0
while $dbCnt < 2
if $dbCnt == 0 then
sql use `database`
else
sql use `DataBase`
endi
$dbCnt = $dbCnt + 1
sql show stables
print rows: $rows
print $data00 $data01
print $data10 $data11
if $rows != 2 then
return -1
endi
if $data00 != Stable then
return -1
endi
if $data10 != stable then
return -1
endi
sql show tables
print rows: $rows
print $data00 $data01
print $data10 $data11
print $data20 $data21
print $data30 $data31
if $rows != 4 then
return -1
endi
print =============== query data
sql select * from `table`
print rows: $rows
print $data00 $data01 $data02 $data03
print $data10 $data11 $data12 $data13
if $rows != 2 then
return -1
endi
if $data01 != 10 then
return -1
endi
if $data02 != table then
return -1
endi
if $data03 != table then
return -1
endi
sql select * from `Table`
print rows: $rows
print $data00 $data01 $data02 $data03
print $data10 $data11 $data12 $data13
if $rows != 2 then
return -1
endi
if $data01 != 20 then
return -1
endi
if $data02 != Table then
return -1
endi
if $data03 != Table then
return -1
endi
sql select * from `TAble`
print rows: $rows
print $data00 $data01 $data02 $data03
print $data10 $data11 $data12 $data13
if $rows != 2 then
return -1
endi
if $data01 != 30 then
return -1
endi
if $data02 != TAble then
return -1
endi
if $data03 != TAble then
return -1
endi
sql select * from `TABle`
print rows: $rows
print $data00 $data01 $data02 $data03
print $data10 $data11 $data12 $data13
if $rows != 2 then
return -1
endi
if $data01 != 40 then
return -1
endi
if $data02 != TABle then
return -1
endi
if $data03 != TABle then
return -1
endi
print =============== query data from st, but not support select * from super table, waiting fix
sql select count(*) from `stable`
print rows: $rows
print $data00 $data01 $data02 $data03
if $rows != 1 then
return -1
endi
if $data00 != 4 then
return -1
endi
sql select count(*) from `Stable`
print rows: $rows
print $data00 $data01 $data02 $data03
if $rows != 1 then
return -1
endi
if $data00 != 4 then
return -1
endi
#sql select * from st
#if $rows != 4 then
# return -1
#endi
endw
#system sh/exec.sh -n dnode1 -s stop -x SIGINT
tests/script/tsim/insert/basic0.sim
浏览文件 @
fa295969
...
...
@@ -51,7 +51,14 @@ sql insert into ct3 values('2021-01-01 00:00:00.000', 10, 2.0, 3.0)
#===================================================================
print =============== query data from child table
sql select * from ct1
print rows: $rows
print $data00 $data01
print $data10 $data11
print $data20 $data21
print $data30 $data31
print $data40 $data41
print $data50 $data51
print $data60 $data61
if $rows != 7 then
return -1
endi
...
...
tests/script/tsim/insert/basic1.sim
浏览文件 @
fa295969
...
...
@@ -7,7 +7,7 @@ sql connect
print =============== create database
sql create database d1
sql show databases
if $rows !=
1
then
if $rows !=
2
then
return -1
endi
...
...
@@ -46,6 +46,11 @@ sql insert into c1 values(now+0s, true, -1, -2, -3, -4, -6.0, -7.0, 'child tbl 1
print =============== query data
sql select * from c1
print rows: $rows
print $data00 $data01
print $data10 $data11
print $data20 $data21
print $data30 $data31
if $rows != 4 then
return -1
endi
...
...
@@ -62,19 +67,40 @@ if $data03 != -2 then
return -1
endi
print =============== query data from st
sql select * from st
if $rows != 4 then
return -1
endi
print =============== query data from st
, but not support select * from super table, waiting fix
#
sql select * from st
#
if $rows != 4 then
#
return -1
#
endi
print =============== stop and restart taosd
system sh/exec.sh -n dnode1 -s stop -x SIGINT
system sh/exec.sh -n dnode1 -s start
sleep 2000
$loop_cnt = 0
check_dnode_ready:
$loop_cnt = $loop_cnt + 1
sleep 100
if $loop_cnt == 10 then
print ====> dnode not ready!
return -1
endi
sql show dnodes
print ===> $rows $data00 $data01 $data02 $data03 $data04 $data05
if $data00 != 1 then
return -1
endi
if $data04 != ready then
goto check_dnode_ready
endi
print =============== query data
sql select * from c1
print rows: $rows
print $data00 $data01
print $data10 $data11
print $data20 $data21
print $data30 $data31
if $rows != 4 then
return -1
endi
...
...
@@ -91,4 +117,10 @@ if $data03 != -2 then
return -1
endi
print =============== query data from st, but not support select * from super table, waiting fix
#sql select * from st
#if $rows != 4 then
# return -1
#endi
system sh/exec.sh -n dnode1 -s stop -x SIGINT
tests/script/tsim/testCaseSuite.sim
0 → 100644
浏览文件 @
fa295969
run tsim/db/basic1.sim
run tsim/db/basic6.sim
run tsim/db/basic7.sim
run tsim/db/error1.sim
run tsim/dnode/basic1.sim
run tsim/insert/basic0.sim
run tsim/insert/basic1.sim
run tsim/insert/null.sim
run tsim/query/interval-offset.sim
run tsim/query/interval.sim
run tsim/table/basic1.sim
run tsim/user/basic1.sim
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录