forked from stoneatom/stonedb
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(tianmu): When executing SELECT..WHERE NAME LIKE %_, it failed(sto…
…neatom#1157) 1. Handle the result set error caused by character transfer(stoneatom#1157)(stoneatom#1162) 2. Handle the result set problem caused by ESCAPE keyword(stoneatom#1162)
- Loading branch information
Showing
3 changed files
with
87 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
DROP DATABASE IF EXISTS issue1157_test; | ||
CREATE DATABASE issue1157_test; | ||
USE issue1157_test; | ||
CREATE TABLE st( | ||
`id` BIGINT(20) NOT NULL AUTO_INCREMENT, | ||
`name` VARCHAR(255) DEFAULT NULL, | ||
`uid` VARCHAR(11) DEFAULT NULL, | ||
PRIMARY KEY (`id`) | ||
)engine=tianmu; | ||
INSERT INTO st (NAME,uid) VALUES('%a','world'); | ||
INSERT INTO st (NAME,uid) VALUES('%_','world'); | ||
SELECT * FROM st WHERE NAME LIKE "a%a_" ESCAPE 'a'; | ||
id name uid | ||
SELECT * FROM st WHERE NAME LIKE "\%\_"; | ||
id name uid | ||
SELECT * FROM st WHERE NAME LIKE "\%_"; | ||
id name uid | ||
1 %a world | ||
2 %_ world | ||
SELECT * FROM st WHERE NAME LIKE "a%_" ESCAPE 'a'; | ||
id name uid | ||
1 %a world | ||
2 %_ world | ||
drop table st; | ||
create table st2(id int ,column_2 varchar(10),column_3 varchar(10))engine=tianmu; | ||
insert into st2 values(1,'_a\\\\','111111'); | ||
insert into st2 values(2,'12%','%12%'); | ||
insert into st2 values(3,'a_a','a%'); | ||
insert into st2 values(4,'_a\\','_12%'); | ||
insert into st2 values(5,'\\a','\\\\_a%12%'); | ||
select * from st2 where column_2 like '%_a\\\%'; | ||
id column_2 column_3 | ||
1 _a\\ 111111 | ||
select * from st2 where column_2 like '%?_a?\%' escape '?'; | ||
id column_2 column_3 | ||
drop table st2; | ||
DROP DATABASE issue1157_test; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
--source include/have_tianmu.inc | ||
|
||
--disable_warnings | ||
DROP DATABASE IF EXISTS issue1157_test; | ||
--enable_warnings | ||
|
||
CREATE DATABASE issue1157_test; | ||
USE issue1157_test; | ||
|
||
|
||
CREATE TABLE st( | ||
`id` BIGINT(20) NOT NULL AUTO_INCREMENT, | ||
`name` VARCHAR(255) DEFAULT NULL, | ||
`uid` VARCHAR(11) DEFAULT NULL, | ||
PRIMARY KEY (`id`) | ||
)engine=tianmu; | ||
|
||
INSERT INTO st (NAME,uid) VALUES('%a','world'); | ||
INSERT INTO st (NAME,uid) VALUES('%_','world'); | ||
|
||
SELECT * FROM st WHERE NAME LIKE "a%a_" ESCAPE 'a'; | ||
|
||
SELECT * FROM st WHERE NAME LIKE "\%\_"; | ||
|
||
SELECT * FROM st WHERE NAME LIKE "\%_"; | ||
|
||
SELECT * FROM st WHERE NAME LIKE "a%_" ESCAPE 'a'; | ||
|
||
drop table st; | ||
|
||
|
||
create table st2(id int ,column_2 varchar(10),column_3 varchar(10))engine=tianmu; | ||
insert into st2 values(1,'_a\\\\','111111'); | ||
insert into st2 values(2,'12%','%12%'); | ||
insert into st2 values(3,'a_a','a%'); | ||
insert into st2 values(4,'_a\\','_12%'); | ||
insert into st2 values(5,'\\a','\\\\_a%12%'); | ||
|
||
select * from st2 where column_2 like '%_a\\\%'; | ||
|
||
select * from st2 where column_2 like '%?_a?\%' escape '?'; | ||
|
||
drop table st2; | ||
|
||
DROP DATABASE issue1157_test; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters