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
811ed77e
Commit
811ed77e
authored
Aug 20, 2003
by
bell@laptop.sanja.is.com.ua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
quick fix for found row counter
code cleunup
parent
11af1f3c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
12 deletions
+17
-12
sql/sql_class.h
sql/sql_class.h
+1
-1
sql/sql_union.cc
sql/sql_union.cc
+15
-10
sql/sql_update.cc
sql/sql_update.cc
+1
-1
No files found.
sql/sql_class.h
View file @
811ed77e
...
...
@@ -532,7 +532,7 @@ class THD :public ilink
*/
ulonglong
current_insert_id
;
ulonglong
limit_found_rows
;
ha_rows
select_limit
,
offset_limit
,
cuted_fields
,
ha_rows
cuted_fields
,
sent_row_count
,
examined_row_count
;
table_map
used_tables
;
USER_CONN
*
user_connect
;
...
...
sql/sql_union.cc
View file @
811ed77e
...
...
@@ -123,7 +123,8 @@ int st_select_lex_unit::prepare(THD *thd, select_result *sel_result,
DBUG_RETURN
(
0
);
prepared
=
1
;
res
=
0
;
found_rows_for_union
=
first_select_in_union
()
->
options
&
OPTION_FOUND_ROWS
;
found_rows_for_union
=
test
(
first_select_in_union
()
->
options
&
OPTION_FOUND_ROWS
);
TMP_TABLE_PARAM
tmp_table_param
;
result
=
sel_result
;
t_and_f
=
tables_and_fields_initied
;
...
...
@@ -238,7 +239,7 @@ int st_select_lex_unit::exec()
{
SELECT_LEX
*
lex_select_save
=
thd
->
lex
.
current_select
;
SELECT_LEX
*
select_cursor
=
first_select_in_union
();
unsigned
int
add_rows
=
0
;
ha_rows
add_rows
=
0
;
DBUG_ENTER
(
"st_select_lex_unit::exec"
);
if
(
executed
&&
!
(
dependent
||
uncacheable
))
...
...
@@ -255,7 +256,7 @@ int st_select_lex_unit::exec()
}
for
(
SELECT_LEX
*
sl
=
select_cursor
;
sl
;
sl
=
sl
->
next_select
())
{
unsigned
int
rows
;
ha_rows
rows
=
0
;
thd
->
lex
.
current_select
=
sl
;
if
(
optimized
)
...
...
@@ -270,7 +271,7 @@ int st_select_lex_unit::exec()
sl
->
options
&=
~
OPTION_FOUND_ROWS
;
else
if
(
found_rows_for_union
)
{
rows
=
thd
->
select_limit
;
rows
=
sl
->
select_limit
;
sl
->
options
|=
OPTION_FOUND_ROWS
;
}
...
...
@@ -313,8 +314,10 @@ int st_select_lex_unit::exec()
thd
->
lex
.
current_select
=
lex_select_save
;
DBUG_RETURN
(
res
);
}
if
(
found_rows_for_union
&&
!
sl
->
braces
&&
sl
->
options
&
OPTION_FOUND_ROWS
)
add_rows
+=
(
thd
->
limit_found_rows
>
rows
)
?
thd
->
limit_found_rows
-
rows
:
0
;
if
(
found_rows_for_union
&&
!
sl
->
braces
&&
(
sl
->
options
&
OPTION_FOUND_ROWS
))
add_rows
+=
(
sl
->
join
->
send_records
>
rows
)
?
sl
->
join
->
send_records
-
rows
:
0
;
}
}
optimized
=
1
;
...
...
@@ -329,18 +332,20 @@ int st_select_lex_unit::exec()
if
(
!
thd
->
is_fatal_error
)
// Check if EOM
{
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
;
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
)
thd
->
options
&=
~
OPTION_FOUND_ROWS
;
options
&=
~
OPTION_FOUND_ROWS
;
else
if
(
found_rows_for_union
&&
!
describe
)
thd
->
options
|=
OPTION_FOUND_ROWS
;
options
|=
OPTION_FOUND_ROWS
;
fake_select_lex
->
ftfunc_list
=
&
empty_list
;
fake_select_lex
->
table_list
.
link_in_list
((
byte
*
)
&
result_table_list
,
(
byte
**
)
...
...
@@ -375,7 +380,7 @@ int st_select_lex_unit::exec()
global_parameters
->
order_list
.
elements
,
(
ORDER
*
)
global_parameters
->
order_list
.
first
,
(
ORDER
*
)
NULL
,
NULL
,
(
ORDER
*
)
NULL
,
thd
->
options
|
SELECT_NO_UNLOCK
,
options
|
SELECT_NO_UNLOCK
,
result
,
this
,
fake_select_lex
,
0
);
if
(
found_rows_for_union
&&
!
res
)
{
...
...
sql/sql_update.cc
View file @
811ed77e
...
...
@@ -423,7 +423,7 @@ int mysql_multi_update(THD *thd,
DBUG_RETURN
(
res
);
fix_tables_pointers
(
thd
->
lex
.
all_selects_list
);
thd
->
select_limit
=
HA_POS_ERROR
;
select_lex
->
select_limit
=
HA_POS_ERROR
;
if
(
setup_fields
(
thd
,
0
,
table_list
,
*
fields
,
1
,
0
,
0
))
DBUG_RETURN
(
-
1
);
...
...
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