1
0
mirror of https://github.com/MariaDB/server.git synced 2026-01-06 05:22:24 +03:00

WL#2247 mysqltest: add option for sorting results

- Change from "query_sorted <query>" to "sorted_results"
This commit is contained in:
msvensson@pilot.blaudden
2007-05-16 17:19:36 +02:00
parent 8e9149ea11
commit d5676f2feb
3 changed files with 128 additions and 13 deletions

View File

@@ -1693,15 +1693,72 @@ create table t1( a int, b char(255), c timestamp);
insert into t1 values(1, 'Line 1', '2007-04-05'), (2, "Part 2", '2007-04-05');
insert into t1 values(1, 'Line 1', '2007-04-05'), (2, "Part 3", '2007-04-05');
select * from t1;
query_sorted select * from t1;
--sorted_results
select * from t1;
# Should not be sorted
select * from t1;
disable_result_log;
query_sorted select * from t1;
sorted_results;
select * from t1;
enable_result_log;
query_sorted select '';
query_sorted select "h";
query_sorted select "he";
query_sorted select "hep";
query_sorted select "hepp";
--sorted_results
select '';
sorted_results;
select "h";
--sorted_results
select "he";
--sorted_results
select "hep";
--sorted_results
select "hepp";
drop table t1;
# 1. Assignment of result set sorting
sorted_results;
SELECT 2 as "my_col"
UNION
SELECT 1;
--sorted_results
SELECT 2 as "my_col" UNION SELECT 1;
--sorted_results
SELECT 2 as "my_col"
UNION
SELECT 1;
# 2. Ensure that the table header will be not sorted into the result
--sorted_results
SELECT '2' as "3"
UNION
SELECT '1';
# 3. "sorted_results" changes nothing when applied to a non query statement.
sorted_results;
SET @a = 17;
# 4. Show that "--sorted_results" affects the next statement only
--sorted_results
SELECT 2 as "my_col"
UNION
SELECT 1;
SELECT 2 as "my_col"
UNION
SELECT 1;
# 5. Ensure that "sorted_results" in combination with $variables works
let $my_stmt=SELECT 2 as "my_col"
UNION
SELECT 1;
--sorted_results
eval $my_stmt;
# 6. Ensure that "sorted_results " does not change the semantics of "--error ...."
# or the protocol output after such an expected failure
--sorted_results
--error 1146
SELECT '2' as "my_col1",2 as "my_col2"
UNION
SELECT '1',1 from t2;
--echo End of tests