Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
ca633f5f
Commit
ca633f5f
authored
May 18, 2007
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge bk-internal:/home/bk/mysql-5.0-maint
into pilot.blaudden:/home/msvensson/mysql/mysql-5.0-maint
parents
2018978e
f35dd614
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
221 additions
and
14 deletions
+221
-14
client/mysqltest.c
client/mysqltest.c
+12
-6
mysql-test/r/mysqltest.result
mysql-test/r/mysqltest.result
+94
-0
mysql-test/t/mysqltest.test
mysql-test/t/mysqltest.test
+115
-8
No files found.
client/mysqltest.c
View file @
ca633f5f
...
@@ -271,7 +271,7 @@ enum enum_commands {
...
@@ -271,7 +271,7 @@ enum enum_commands {
Q_EXEC
,
Q_DELIMITER
,
Q_EXEC
,
Q_DELIMITER
,
Q_DISABLE_ABORT_ON_ERROR
,
Q_ENABLE_ABORT_ON_ERROR
,
Q_DISABLE_ABORT_ON_ERROR
,
Q_ENABLE_ABORT_ON_ERROR
,
Q_DISPLAY_VERTICAL_RESULTS
,
Q_DISPLAY_HORIZONTAL_RESULTS
,
Q_DISPLAY_VERTICAL_RESULTS
,
Q_DISPLAY_HORIZONTAL_RESULTS
,
Q_QUERY_VERTICAL
,
Q_QUERY_HORIZONTAL
,
Q_
QUERY_SORTED
,
Q_QUERY_VERTICAL
,
Q_QUERY_HORIZONTAL
,
Q_
SORTED_RESULT
,
Q_START_TIMER
,
Q_END_TIMER
,
Q_START_TIMER
,
Q_END_TIMER
,
Q_CHARACTER_SET
,
Q_DISABLE_PS_PROTOCOL
,
Q_ENABLE_PS_PROTOCOL
,
Q_CHARACTER_SET
,
Q_DISABLE_PS_PROTOCOL
,
Q_ENABLE_PS_PROTOCOL
,
Q_DISABLE_RECONNECT
,
Q_ENABLE_RECONNECT
,
Q_DISABLE_RECONNECT
,
Q_ENABLE_RECONNECT
,
...
@@ -341,7 +341,7 @@ const char *command_names[]=
...
@@ -341,7 +341,7 @@ const char *command_names[]=
"horizontal_results"
,
"horizontal_results"
,
"query_vertical"
,
"query_vertical"
,
"query_horizontal"
,
"query_horizontal"
,
"
query_sorted
"
,
"
sorted_result
"
,
"start_timer"
,
"start_timer"
,
"end_timer"
,
"end_timer"
,
"character_set"
,
"character_set"
,
...
@@ -6181,13 +6181,19 @@ int main(int argc, char **argv)
...
@@ -6181,13 +6181,19 @@ int main(int argc, char **argv)
case
Q_DISPLAY_HORIZONTAL_RESULTS
:
case
Q_DISPLAY_HORIZONTAL_RESULTS
:
display_result_vertically
=
FALSE
;
display_result_vertically
=
FALSE
;
break
;
break
;
case
Q_SORTED_RESULT
:
/*
Turn on sorting of result set, will be reset after next
command
*/
display_result_sorted
=
TRUE
;
break
;
case
Q_LET
:
do_let
(
command
);
break
;
case
Q_LET
:
do_let
(
command
);
break
;
case
Q_EVAL_RESULT
:
case
Q_EVAL_RESULT
:
eval_result
=
1
;
break
;
eval_result
=
1
;
break
;
case
Q_EVAL
:
case
Q_EVAL
:
case
Q_QUERY_VERTICAL
:
case
Q_QUERY_VERTICAL
:
case
Q_QUERY_HORIZONTAL
:
case
Q_QUERY_HORIZONTAL
:
case
Q_QUERY_SORTED
:
if
(
command
->
query
==
command
->
query_buf
)
if
(
command
->
query
==
command
->
query_buf
)
{
{
/* Skip the first part of command, i.e query_xxx */
/* Skip the first part of command, i.e query_xxx */
...
@@ -6199,7 +6205,6 @@ int main(int argc, char **argv)
...
@@ -6199,7 +6205,6 @@ int main(int argc, char **argv)
case
Q_REAP
:
case
Q_REAP
:
{
{
my_bool
old_display_result_vertically
=
display_result_vertically
;
my_bool
old_display_result_vertically
=
display_result_vertically
;
my_bool
old_display_result_sorted
=
display_result_sorted
;
/* Default is full query, both reap and send */
/* Default is full query, both reap and send */
int
flags
=
QUERY_REAP_FLAG
|
QUERY_SEND_FLAG
;
int
flags
=
QUERY_REAP_FLAG
|
QUERY_SEND_FLAG
;
...
@@ -6216,7 +6221,6 @@ int main(int argc, char **argv)
...
@@ -6216,7 +6221,6 @@ int main(int argc, char **argv)
/* Check for special property for this query */
/* Check for special property for this query */
display_result_vertically
|=
(
command
->
type
==
Q_QUERY_VERTICAL
);
display_result_vertically
|=
(
command
->
type
==
Q_QUERY_VERTICAL
);
display_result_sorted
=
(
command
->
type
==
Q_QUERY_SORTED
);
if
(
save_file
[
0
])
if
(
save_file
[
0
])
{
{
...
@@ -6229,7 +6233,6 @@ int main(int argc, char **argv)
...
@@ -6229,7 +6233,6 @@ int main(int argc, char **argv)
/* Restore settings */
/* Restore settings */
display_result_vertically
=
old_display_result_vertically
;
display_result_vertically
=
old_display_result_vertically
;
display_result_sorted
=
old_display_result_sorted
;
break
;
break
;
}
}
...
@@ -6390,6 +6393,9 @@ int main(int argc, char **argv)
...
@@ -6390,6 +6393,9 @@ int main(int argc, char **argv)
the replace structures should be cleared
the replace structures should be cleared
*/
*/
free_all_replace
();
free_all_replace
();
/* Also reset "sorted_result" */
display_result_sorted
=
FALSE
;
}
}
last_command_executed
=
command_executed
;
last_command_executed
=
command_executed
;
...
...
mysql-test/r/mysqltest.result
View file @
ca633f5f
...
@@ -557,6 +557,12 @@ a b c
...
@@ -557,6 +557,12 @@ a b c
2 Part 2 2007-04-05 00:00:00
2 Part 2 2007-04-05 00:00:00
2 Part 3 2007-04-05 00:00:00
2 Part 3 2007-04-05 00:00:00
select * from t1;
select * from t1;
a b c
1 Line 1 2007-04-05 00:00:00
2 Part 2 2007-04-05 00:00:00
1 Line 1 2007-04-05 00:00:00
2 Part 3 2007-04-05 00:00:00
select * from t1;
select '';
select '';
...
@@ -572,4 +578,92 @@ hep
...
@@ -572,4 +578,92 @@ hep
select "hepp";
select "hepp";
hepp
hepp
hepp
hepp
drop table t1;
SELECT 2 as "my_col"
UNION
SELECT 1;
my_col
1
2
SELECT 2 as "my_col" UNION SELECT 1;
my_col
1
2
SELECT 2 as "my_col"
UNION
SELECT 1;
my_col
1
2
SELECT '2' as "3"
UNION
SELECT '1';
3
1
2
CREATE TABLE t1( a CHAR);
SELECT * FROM t1;
a
DROP TABLE t1;
SELECT NULL as "my_col1",2 AS "my_col2"
UNION
SELECT NULL,1;
my_col1 my_col2
NULL 2
NULL 1
SELECT NULL as "my_col1",2 AS "my_col2"
UNION
SELECT NULL,1;
my_col1 my_col2
NULL 1
NULL 2
SELECT 2 as "my_col1",NULL AS "my_col2"
UNION
SELECT 1,NULL;
my_col1 my_col2
2 NULL
1 NULL
SELECT 2 as "my_col1",NULL AS "my_col2"
UNION
SELECT 1,NULL;
my_col1 my_col2
1 NULL
2 NULL
SET @a = 17;
SELECT 2 as "my_col"
UNION
SELECT 1;
my_col
2
1
SELECT 2 as "my_col"
UNION
SELECT 1;
my_col
1
2
SELECT '2' as "my_col1",2 as "my_col2"
UNION
SELECT '1',1 from t2;
ERROR 42S02: Table 'test.t2' doesn't exist
SELECT '1' as "my_col1",2 as "my_col2"
UNION
SELECT '2',1;
my_col1 my_col2
# 1
# 2
CREATE TABLE t1 (f1 INT);
INSERT INTO t1 SET f1 = 1024;
INSERT INTO t1 SELECT f1 - 1 FROM t1;
INSERT INTO t1 SELECT f1 - 2 FROM t1;
INSERT INTO t1 SELECT f1 - 4 FROM t1;
INSERT INTO t1 SELECT f1 - 8 FROM t1;
INSERT INTO t1 SELECT f1 - 16 FROM t1;
INSERT INTO t1 SELECT f1 - 32 FROM t1;
INSERT INTO t1 SELECT f1 - 64 FROM t1;
INSERT INTO t1 SELECT f1 - 128 FROM t1;
INSERT INTO t1 SELECT f1 - 256 FROM t1;
INSERT INTO t1 SELECT f1 - 512 FROM t1;
SELECT * FROM t1;
DROP TABLE t1;
End of tests
End of tests
mysql-test/t/mysqltest.test
View file @
ca633f5f
...
@@ -1740,23 +1740,130 @@ EOF
...
@@ -1740,23 +1740,130 @@ EOF
--
exec
echo
"echo Some output; exit; echo Not this;"
|
$MYSQL_TEST
2
>&
1
--
exec
echo
"echo Some output; exit; echo Not this;"
|
$MYSQL_TEST
2
>&
1
# ----------------------------------------------------------------------------
# ----------------------------------------------------------------------------
# test for
query_sorted
# test for
sorted_result
# ----------------------------------------------------------------------------
# ----------------------------------------------------------------------------
create
table
t1
(
a
int
,
b
char
(
255
),
c
timestamp
);
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 2"
,
'2007-04-05'
);
insert
into
t1
values
(
1
,
'Line 1'
,
'2007-04-05'
),
(
2
,
"Part 3"
,
'2007-04-05'
);
insert
into
t1
values
(
1
,
'Line 1'
,
'2007-04-05'
),
(
2
,
"Part 3"
,
'2007-04-05'
);
select
*
from
t1
;
select
*
from
t1
;
query_sorted
select
*
from
t1
;
--
sorted_result
select
*
from
t1
;
# Should not be sorted
select
*
from
t1
;
disable_result_log
;
disable_result_log
;
query_sorted
select
*
from
t1
;
sorted_result
;
select
*
from
t1
;
enable_result_log
;
enable_result_log
;
query_sorted
select
''
;
--
sorted_result
query_sorted
select
"h"
;
select
''
;
query_sorted
select
"he"
;
sorted_result
;
query_sorted
select
"hep"
;
select
"h"
;
query_sorted
select
"hepp"
;
--
sorted_result
select
"he"
;
--
sorted_result
select
"hep"
;
--
sorted_result
select
"hepp"
;
drop
table
t1
;
# 1. Assignment of result set sorting
sorted_result
;
SELECT
2
as
"my_col"
UNION
SELECT
1
;
#
--
sorted_result
SELECT
2
as
"my_col"
UNION
SELECT
1
;
--
sorted_result
SELECT
2
as
"my_col"
UNION
SELECT
1
;
# 2. Ensure that the table header will be not sorted into the result
--
sorted_result
SELECT
'2'
as
"3"
UNION
SELECT
'1'
;
# 3. Ensure that an empty result set does not cause problems
CREATE
TABLE
t1
(
a
CHAR
);
--
sorted_result
SELECT
*
FROM
t1
;
DROP
TABLE
t1
;
# 4. Ensure that NULL values within the result set do not cause problems
SELECT
NULL
as
"my_col1"
,
2
AS
"my_col2"
UNION
SELECT
NULL
,
1
;
--
sorted_result
SELECT
NULL
as
"my_col1"
,
2
AS
"my_col2"
UNION
SELECT
NULL
,
1
;
#
SELECT
2
as
"my_col1"
,
NULL
AS
"my_col2"
UNION
SELECT
1
,
NULL
;
--
sorted_result
SELECT
2
as
"my_col1"
,
NULL
AS
"my_col2"
UNION
SELECT
1
,
NULL
;
# 5. "sorted_result" changes nothing when applied to a non query statement.
sorted_result
;
SET
@
a
=
17
;
#
# 6. Show that "sorted_result;" before the "SET @a = 17;" above does not affect
# the now following query.
SELECT
2
as
"my_col"
UNION
SELECT
1
;
# 7. Ensure that "sorted_result" in combination with $variables works
let
$my_stmt
=
SELECT
2
as
"my_col"
UNION
SELECT
1
;
--
sorted_result
eval
$my_stmt
;
# 8. Ensure that "sorted_result " does not change the semantics of
# "--error ...." or the protocol output after such an expected failure
--
sorted_result
--
error
1146
SELECT
'2'
as
"my_col1"
,
2
as
"my_col2"
UNION
SELECT
'1'
,
1
from
t2
;
# 9. Ensure that several result formatting options including "sorted_result"
# - have all an effect
# - "--sorted_result" does not need to be direct before the statement
# - Row sorting is applied after modification of the column content
--
sorted_result
--
replace_column
1
#
SELECT
'1'
as
"my_col1"
,
2
as
"my_col2"
UNION
SELECT
'2'
,
1
;
# 10. Ensure that at least 1024 rows within a result set do not cause problems
#
CREATE
TABLE
t1
(
f1
INT
);
INSERT
INTO
t1
SET
f1
=
1024
;
INSERT
INTO
t1
SELECT
f1
-
1
FROM
t1
;
INSERT
INTO
t1
SELECT
f1
-
2
FROM
t1
;
INSERT
INTO
t1
SELECT
f1
-
4
FROM
t1
;
INSERT
INTO
t1
SELECT
f1
-
8
FROM
t1
;
INSERT
INTO
t1
SELECT
f1
-
16
FROM
t1
;
INSERT
INTO
t1
SELECT
f1
-
32
FROM
t1
;
INSERT
INTO
t1
SELECT
f1
-
64
FROM
t1
;
INSERT
INTO
t1
SELECT
f1
-
128
FROM
t1
;
INSERT
INTO
t1
SELECT
f1
-
256
FROM
t1
;
INSERT
INTO
t1
SELECT
f1
-
512
FROM
t1
;
--
disable_result_log
--
sorted_result
SELECT
*
FROM
t1
;
--
enable_result_log
DROP
TABLE
t1
;
# ----------------------------------------------------------------------------
# ----------------------------------------------------------------------------
# Some coverage tests
# Some coverage tests
# ----------------------------------------------------------------------------
# ----------------------------------------------------------------------------
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment