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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
f354f336
Commit
f354f336
authored
Sep 18, 2003
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge sanja.is.com.ua:/home/bell/mysql/bk/mysql-4.1
into sanja.is.com.ua:/home/bell/mysql/bk/work-union-4.1
parents
4535f689
cf24f5ac
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
32 additions
and
14 deletions
+32
-14
mysql-test/r/subselect.result
mysql-test/r/subselect.result
+3
-2
mysql-test/r/union.result
mysql-test/r/union.result
+2
-2
mysql-test/t/subselect.test
mysql-test/t/subselect.test
+1
-0
sql/sql_parse.cc
sql/sql_parse.cc
+4
-0
sql/sql_union.cc
sql/sql_union.cc
+22
-10
No files found.
mysql-test/r/subselect.result
View file @
f354f336
...
...
@@ -1046,8 +1046,9 @@ t1 CREATE TABLE `t1` (
) TYPE=MyISAM CHARSET=latin1
drop table t1;
CREATE TABLE t1 SELECT (SELECT 1 as a UNION SELECT 1+1 limit 1,1) as a;
Warnings:
Warning 1262 Data truncated, NULL supplied to NOT NULL column 'a' at row 1
select * from t1;
a
2
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
...
...
mysql-test/r/union.result
View file @
f354f336
...
...
@@ -409,7 +409,7 @@ found_rows()
SELECT SQL_CALC_FOUND_ROWS * FROM t1 UNION SELECT * FROM t2 LIMIT 2,2;
a
3
5
4
select found_rows();
found_rows()
6
...
...
@@ -423,7 +423,7 @@ found_rows()
5
SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a desc LIMIT 1;
a
3
5
(SELECT * FROM t1 ORDER by a) UNION ALL (SELECT * FROM t2 ORDER BY a) ORDER BY A desc LIMIT 4;
a
5
...
...
mysql-test/t/subselect.test
View file @
f354f336
...
...
@@ -606,6 +606,7 @@ CREATE TABLE t1 SELECT * FROM (SELECT 1 as a,(SELECT a+0)) a;
SHOW
CREATE
TABLE
t1
;
drop
table
t1
;
CREATE
TABLE
t1
SELECT
(
SELECT
1
as
a
UNION
SELECT
1
+
1
limit
1
,
1
)
as
a
;
select
*
from
t1
;
SHOW
CREATE
TABLE
t1
;
drop
table
t1
;
...
...
sql/sql_parse.cc
View file @
f354f336
...
...
@@ -1723,6 +1723,10 @@ mysql_execute_command(THD *thd)
break
;
// Error message is given
}
/*
In case of single SELECT unit->global_parameters points on first SELECT
TODO: move counters to SELECT_LEX
*/
unit
->
offset_limit_cnt
=
(
ha_rows
)
unit
->
global_parameters
->
offset_limit
;
unit
->
select_limit_cnt
=
(
ha_rows
)
(
unit
->
global_parameters
->
select_limit
+
unit
->
global_parameters
->
offset_limit
);
...
...
sql/sql_union.cc
View file @
f354f336
...
...
@@ -261,9 +261,24 @@ int st_select_lex_unit::exec()
if
(
optimized
)
res
=
sl
->
join
->
reinit
();
else
{
if
(
sl
!=
global_parameters
)
{
offset_limit_cnt
=
sl
->
offset_limit
;
select_limit_cnt
=
sl
->
select_limit
+
sl
->
offset_limit
;
}
else
{
offset_limit_cnt
=
0
;
/*
We can't use LIMIT at this stage if we are using ORDER BY for the
whole query
*/
if
(
sl
->
order_list
.
first
)
select_limit_cnt
=
HA_POS_ERROR
;
else
select_limit_cnt
=
sl
->
select_limit
+
sl
->
offset_limit
;
}
if
(
select_limit_cnt
<
sl
->
select_limit
)
select_limit_cnt
=
HA_POS_ERROR
;
// no limit
...
...
@@ -352,14 +367,11 @@ int st_select_lex_unit::exec()
{
ulong
options
=
thd
->
options
;
thd
->
lex
.
current_select
=
fake_select_lex
;
if
(
select_cursor
->
braces
)
{
offset_limit_cnt
=
global_parameters
->
offset_limit
;
select_limit_cnt
=
global_parameters
->
select_limit
+
global_parameters
->
offset_limit
;
if
(
select_limit_cnt
<
global_parameters
->
select_limit
)
select_limit_cnt
=
HA_POS_ERROR
;
// no limit
}
if
(
select_limit_cnt
==
HA_POS_ERROR
)
options
&=
~
OPTION_FOUND_ROWS
;
else
if
(
found_rows_for_union
&&
!
describe
)
...
...
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