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
07743423
Commit
07743423
authored
Oct 27, 2004
by
ram@gw.mysql.r18.ru
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
A fix (bug #6089: FOUND_ROWS returns wrong values when no table/view is used).
parent
cce8f544
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
45 additions
and
2 deletions
+45
-2
mysql-test/r/ps.result
mysql-test/r/ps.result
+1
-1
mysql-test/r/select_found.result
mysql-test/r/select_found.result
+25
-0
mysql-test/t/select_found.test
mysql-test/t/select_found.test
+15
-0
sql/sql_class.cc
sql/sql_class.cc
+1
-0
sql/sql_select.cc
sql/sql_select.cc
+3
-1
No files found.
mysql-test/r/ps.result
View file @
07743423
...
...
@@ -135,7 +135,7 @@ FOUND_ROWS()
1
execute stmt1;
FOUND_ROWS()
0
1
deallocate prepare stmt1;
drop table t1;
create table t1
...
...
mysql-test/r/select_found.result
View file @
07743423
...
...
@@ -246,3 +246,28 @@ SELECT FOUND_ROWS();
FOUND_ROWS()
0
DROP TABLE t1;
SELECT 'foo';
foo
foo
SELECT FOUND_ROWS();
FOUND_ROWS()
1
SELECT SQL_CALC_FOUND_ROWS 'foo';
foo
foo
SELECT FOUND_ROWS();
FOUND_ROWS()
1
SELECT SQL_CALC_FOUND_ROWS 'foo' limit 0;
foo
SELECT FOUND_ROWS();
FOUND_ROWS()
1
SELECT FOUND_ROWS();
FOUND_ROWS()
1
SELECT SQL_CALC_FOUND_ROWS 'foo' UNION SELECT 'bar' LIMIT 0;
foo
SELECT FOUND_ROWS();
FOUND_ROWS()
2
mysql-test/t/select_found.test
View file @
07743423
...
...
@@ -166,3 +166,18 @@ INSERT INTO t1 VALUES (0), (0), (1), (2);
SELECT
SQL_CALC_FOUND_ROWS
*
FROM
t1
WHERE
a
=
0
GROUP
BY
a
HAVING
a
>
10
;
SELECT
FOUND_ROWS
();
DROP
TABLE
t1
;
#
# Bug #6089: queries which don't use any tables
#
SELECT
'foo'
;
SELECT
FOUND_ROWS
();
SELECT
SQL_CALC_FOUND_ROWS
'foo'
;
SELECT
FOUND_ROWS
();
SELECT
SQL_CALC_FOUND_ROWS
'foo'
limit
0
;
SELECT
FOUND_ROWS
();
SELECT
FOUND_ROWS
();
SELECT
SQL_CALC_FOUND_ROWS
'foo'
UNION
SELECT
'bar'
LIMIT
0
;
SELECT
FOUND_ROWS
();
sql/sql_class.cc
View file @
07743423
...
...
@@ -177,6 +177,7 @@ THD::THD()
lock
=
locked_tables
=
0
;
used_tables
=
0
;
cuted_fields
=
sent_row_count
=
0L
;
limit_found_rows
=
0
;
statement_id_counter
=
0UL
;
// Must be reset to handle error with THD's created for init of mysqld
lex
->
current_select
=
0
;
...
...
sql/sql_select.cc
View file @
07743423
...
...
@@ -1067,7 +1067,9 @@ JOIN::exec()
else
error
=
(
int
)
result
->
send_eof
();
}
thd
->
limit_found_rows
=
thd
->
examined_row_count
=
0
;
/* Single select (without union and limit) always returns 1 row */
thd
->
limit_found_rows
=
1
;
thd
->
examined_row_count
=
0
;
DBUG_VOID_RETURN
;
}
thd
->
limit_found_rows
=
thd
->
examined_row_count
=
0
;
...
...
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