Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
277e31c2
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看板
提交
277e31c2
编写于
1月 10, 2022
作者:
wmmhello
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-12252]<feature>(connector,query,insert,other,tools,taosAdapter):deal with escape character
上级
e6399aae
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
115 addition
and
0 deletion
+115
-0
tests/develop-test/2-query/escape.py
tests/develop-test/2-query/escape.py
+115
-0
未找到文件。
tests/develop-test/2-query/escape.py
0 → 100644
浏览文件 @
277e31c2
###################################################################
# Copyright (c) 2021 by TAOS Technologies, Inc.
# All rights reserved.
#
# This file is proprietary and confidential to TAOS Technologies.
# No part of this file may be reproduced, stored, transmitted,
# disclosed or used in any form or by any means other than as
# expressly provided by the written permission from Jianhui Tao
#
###################################################################
# -*- coding: utf-8 -*-
import
sys
from
util.log
import
*
from
util.cases
import
*
from
util.sql
import
*
class
TDTestCase
:
def
caseDescription
(
self
):
'''
case1: [TD-12251] json type containing single quotes cannot be inserted
case2: [TD-12334] '
\'
escape unknown
case3: [TD-11071] escape table creation problem
case4: [TD-6232] fix abnormal escaping results about '
\'
'''
return
def
init
(
self
,
conn
,
logSql
):
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
tdSql
.
init
(
conn
.
cursor
(),
logSql
)
self
.
_conn
=
conn
def
run
(
self
):
print
(
"running {}"
.
format
(
__file__
))
tdSql
.
execute
(
"drop database if exists escape"
)
tdSql
.
execute
(
"create database if not exists escape"
)
tdSql
.
execute
(
'use escape'
)
# [TD-12251]
tdSql
.
execute
(
'create stable st (ts timestamp,t int) tags(metrics json)'
)
tdSql
.
execute
(
r
"insert into t1 using st tags('{\"a\":\"a\",\"b\":\"\'a\'=b\"}') values(now,1)"
)
tdSql
.
query
(
'select * from st'
)
tdSql
.
checkData
(
0
,
2
,
'''{"a":"a","b":"'a'=b"}'''
)
# [TD-12334]
tdSql
.
execute
(
'create table car (ts timestamp, s int) tags(j int)'
)
tdSql
.
execute
(
r
'create table `zz\ ` using car tags(11)'
)
tdSql
.
execute
(
r
'create table `zz\\ ` using car tags(11)'
)
tdSql
.
execute
(
r
'create table `zz\\\ ` using car tags(11)'
)
tdSql
.
query
(
r
'select tbname from car where tbname like "zz\\\\ "'
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkData
(
0
,
0
,
r
"zz\\ "
)
tdSql
.
query
(
r
'show tables like "zz\\\\ "'
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkData
(
0
,
0
,
r
"zz\\ "
)
tdSql
.
query
(
r
'show tables like "zz\\ "'
)
tdSql
.
checkRows
(
1
)
# [TD-11071]
tdSql
.
execute
(
'create table es (ts timestamp, s int) tags(j int)'
)
tdSql
.
execute
(
r
'create table `zz\t` using es tags(11)'
)
tdSql
.
execute
(
r
'create table `zz\\n` using es tags(11)'
)
tdSql
.
execute
(
r
'create table `zz\r\ ` using es tags(11)'
)
tdSql
.
execute
(
r
'create table ` ` using es tags(11)'
)
tdSql
.
query
(
r
'select tbname from es'
)
tdSql
.
checkData
(
0
,
0
,
r
'zz\t'
)
tdSql
.
checkData
(
1
,
0
,
r
'zz\\n'
)
tdSql
.
checkData
(
2
,
0
,
r
'zz\r\ '
)
tdSql
.
checkData
(
3
,
0
,
r
' '
)
# [TD-6232]
tdSql
.
execute
(
'create table tt(ts timestamp, i nchar(128))'
)
tdSql
.
execute
(
r
"insert into tt values(1591060628000, '\t')"
)
tdSql
.
execute
(
r
"insert into tt values(1591060638000, '\n')"
)
tdSql
.
execute
(
r
"insert into tt values(1591060648000, '\r')"
)
tdSql
.
execute
(
r
"insert into tt values(1591060658000, '\\')"
)
tdSql
.
execute
(
r
"insert into tt values(1591060668000, '\"')"
)
tdSql
.
execute
(
r
"insert into tt values(1591060678000, '\'')"
)
tdSql
.
execute
(
r
"insert into tt values(1591060688000, '\%')"
)
tdSql
.
execute
(
r
"insert into tt values(1591060698000, '\_')"
)
tdSql
.
execute
(
r
"insert into tt values(1591060708000, '\9')"
)
tdSql
.
query
(
r
"select * from tt where i='\t'"
)
tdSql
.
checkRows
(
1
)
tdSql
.
query
(
r
"select * from tt where i='\n'"
)
tdSql
.
checkRows
(
1
)
tdSql
.
query
(
r
"select * from tt where i='\r'"
)
tdSql
.
checkRows
(
1
)
tdSql
.
query
(
r
"select * from tt where i='\\'"
)
tdSql
.
checkRows
(
1
)
tdSql
.
query
(
r
"select * from tt where i='\"'"
)
tdSql
.
checkRows
(
1
)
tdSql
.
query
(
r
"select * from tt where i='\''"
)
tdSql
.
checkRows
(
1
)
tdSql
.
query
(
r
"select * from tt where i='\%'"
)
tdSql
.
checkRows
(
1
)
tdSql
.
query
(
r
"select * from tt where i='\_'"
)
tdSql
.
checkRows
(
1
)
tdSql
.
query
(
r
"select * from tt where i='\9'"
)
tdSql
.
checkRows
(
1
)
tdSql
.
query
(
r
"select * from tt where i='9'"
)
tdSql
.
checkRows
(
1
)
def
stop
(
self
):
tdSql
.
close
()
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
tdCases
.
addWindows
(
__file__
,
TDTestCase
())
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录