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
f9087550
Commit
f9087550
authored
Mar 03, 2005
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge rkalimullin@bk-internal.mysql.com:/home/bk/mysql-5.0
into mysql.com:/usr/home/ram/work/5.0
parents
ba01c418
7836110e
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
34 additions
and
23 deletions
+34
-23
mysql-test/r/ps.result
mysql-test/r/ps.result
+12
-0
mysql-test/t/ps.test
mysql-test/t/ps.test
+10
-0
sql/sql_lex.cc
sql/sql_lex.cc
+0
-2
sql/sql_union.cc
sql/sql_union.cc
+12
-21
No files found.
mysql-test/r/ps.result
View file @
f9087550
...
@@ -487,3 +487,15 @@ insert into t1 values ('foo');
...
@@ -487,3 +487,15 @@ insert into t1 values ('foo');
prepare stmt FROM 'SELECT char_length (a) FROM t1';
prepare stmt FROM 'SELECT char_length (a) FROM t1';
ERROR 42000: FUNCTION test.char_length does not exist
ERROR 42000: FUNCTION test.char_length does not exist
drop table t1;
drop table t1;
prepare stmt from "SELECT SQL_CALC_FOUND_ROWS 'foo' UNION SELECT 'bar' LIMIT 0";
execute stmt;
foo
SELECT FOUND_ROWS();
FOUND_ROWS()
2
execute stmt;
foo
SELECT FOUND_ROWS();
FOUND_ROWS()
2
deallocate prepare stmt;
mysql-test/t/ps.test
View file @
f9087550
...
@@ -497,3 +497,13 @@ insert into t1 values ('foo');
...
@@ -497,3 +497,13 @@ insert into t1 values ('foo');
prepare
stmt
FROM
'SELECT char_length (a) FROM t1'
;
prepare
stmt
FROM
'SELECT char_length (a) FROM t1'
;
drop
table
t1
;
drop
table
t1
;
#
# Bug #6089: FOUND_ROWS returns wrong values when no table/view is used
#
prepare
stmt
from
"SELECT SQL_CALC_FOUND_ROWS 'foo' UNION SELECT 'bar' LIMIT 0"
;
execute
stmt
;
SELECT
FOUND_ROWS
();
execute
stmt
;
SELECT
FOUND_ROWS
();
deallocate
prepare
stmt
;
sql/sql_lex.cc
View file @
f9087550
...
@@ -1837,8 +1837,6 @@ void st_select_lex_unit::set_limit(SELECT_LEX *values,
...
@@ -1837,8 +1837,6 @@ void st_select_lex_unit::set_limit(SELECT_LEX *values,
select_limit_cnt
=
values
->
select_limit
+
values
->
offset_limit
;
select_limit_cnt
=
values
->
select_limit
+
values
->
offset_limit
;
if
(
select_limit_cnt
<
values
->
select_limit
)
if
(
select_limit_cnt
<
values
->
select_limit
)
select_limit_cnt
=
HA_POS_ERROR
;
// no limit
select_limit_cnt
=
HA_POS_ERROR
;
// no limit
if
(
select_limit_cnt
==
HA_POS_ERROR
)
sl
->
options
&=
~
OPTION_FOUND_ROWS
;
}
}
...
...
sql/sql_union.cc
View file @
f9087550
...
@@ -217,8 +217,6 @@ bool st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result,
...
@@ -217,8 +217,6 @@ bool st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result,
thd_arg
->
lex
->
current_select
=
sl
;
thd_arg
->
lex
->
current_select
=
sl
;
set_limit
(
sl
,
sl
);
set_limit
(
sl
,
sl
);
if
(
sl
->
braces
)
sl
->
options
&=
~
OPTION_FOUND_ROWS
;
can_skip_order_by
=
is_union
&&
can_skip_order_by
=
is_union
&&
(
!
sl
->
braces
||
select_limit_cnt
==
HA_POS_ERROR
);
(
!
sl
->
braces
||
select_limit_cnt
==
HA_POS_ERROR
);
...
@@ -342,10 +340,9 @@ bool st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result,
...
@@ -342,10 +340,9 @@ bool st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result,
if
(
arena
->
is_stmt_prepare
())
if
(
arena
->
is_stmt_prepare
())
{
{
/* prepare fake select to initialize it correctly */
/* prepare fake select to initialize it correctly */
ulong
options_tmp
=
init_prepare_fake_select_lex
(
thd
);
(
void
)
init_prepare_fake_select_lex
(
thd
);
/*
/*
it should be done only once (because item_list builds only onece
Should be done only once (the only item_list per statement).
per statement)
*/
*/
DBUG_ASSERT
(
fake_select_lex
->
join
==
0
);
DBUG_ASSERT
(
fake_select_lex
->
join
==
0
);
if
(
!
(
fake_select_lex
->
join
=
new
JOIN
(
thd
,
item_list
,
thd
->
options
,
if
(
!
(
fake_select_lex
->
join
=
new
JOIN
(
thd
,
item_list
,
thd
->
options
,
...
@@ -453,20 +450,13 @@ bool st_select_lex_unit::exec()
...
@@ -453,20 +450,13 @@ bool st_select_lex_unit::exec()
select_limit_cnt
=
HA_POS_ERROR
;
// no limit
select_limit_cnt
=
HA_POS_ERROR
;
// no limit
/*
/*
When using braces, SQL_CALC_FOUND_ROWS affects the whole query.
When using braces, SQL_CALC_FOUND_ROWS affects the whole query:
We don't calculate found_rows() per union part
we don't calculate found_rows() per union part.
*/
Otherwise, SQL_CALC_FOUND_ROWS should be done on all sub parts.
if
(
select_limit_cnt
==
HA_POS_ERROR
||
sl
->
braces
)
sl
->
options
&=
~
OPTION_FOUND_ROWS
;
else
{
/*
We are doing an union without braces. In this case
SQL_CALC_FOUND_ROWS should be done on all sub parts
*/
*/
sl
->
options
|=
found_rows_for_union
;
sl
->
join
->
select_options
=
}
(
select_limit_cnt
==
HA_POS_ERROR
||
sl
->
braces
)
?
sl
->
join
->
select_options
=
sl
->
options
;
sl
->
options
&
~
OPTION_FOUND_ROWS
:
sl
->
options
|
found_rows_for_union
;
res
=
sl
->
join
->
optimize
();
res
=
sl
->
join
->
optimize
();
}
}
if
(
!
res
)
if
(
!
res
)
...
@@ -498,7 +488,8 @@ bool st_select_lex_unit::exec()
...
@@ -498,7 +488,8 @@ bool st_select_lex_unit::exec()
}
}
/* Needed for the following test and for records_at_start in next loop */
/* Needed for the following test and for records_at_start in next loop */
table
->
file
->
info
(
HA_STATUS_VARIABLE
);
table
->
file
->
info
(
HA_STATUS_VARIABLE
);
if
(
found_rows_for_union
&
sl
->
options
)
if
(
found_rows_for_union
&&
!
sl
->
braces
&&
select_limit_cnt
!=
HA_POS_ERROR
)
{
{
/*
/*
This is a union without braces. Remember the number of rows that
This is a union without braces. Remember the number of rows that
...
...
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