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
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
Show 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 @@ public:
...
@@ -532,7 +532,7 @@ public:
*/
*/
ulonglong
current_insert_id
;
ulonglong
current_insert_id
;
ulonglong
limit_found_rows
;
ulonglong
limit_found_rows
;
ha_rows
select_limit
,
offset_limit
,
cuted_fields
,
ha_rows
cuted_fields
,
sent_row_count
,
examined_row_count
;
sent_row_count
,
examined_row_count
;
table_map
used_tables
;
table_map
used_tables
;
USER_CONN
*
user_connect
;
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,
...
@@ -123,7 +123,8 @@ int st_select_lex_unit::prepare(THD *thd, select_result *sel_result,
DBUG_RETURN
(
0
);
DBUG_RETURN
(
0
);
prepared
=
1
;
prepared
=
1
;
res
=
0
;
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
;
TMP_TABLE_PARAM
tmp_table_param
;
result
=
sel_result
;
result
=
sel_result
;
t_and_f
=
tables_and_fields_initied
;
t_and_f
=
tables_and_fields_initied
;
...
@@ -238,7 +239,7 @@ int st_select_lex_unit::exec()
...
@@ -238,7 +239,7 @@ int st_select_lex_unit::exec()
{
{
SELECT_LEX
*
lex_select_save
=
thd
->
lex
.
current_select
;
SELECT_LEX
*
lex_select_save
=
thd
->
lex
.
current_select
;
SELECT_LEX
*
select_cursor
=
first_select_in_union
();
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"
);
DBUG_ENTER
(
"st_select_lex_unit::exec"
);
if
(
executed
&&
!
(
dependent
||
uncacheable
))
if
(
executed
&&
!
(
dependent
||
uncacheable
))
...
@@ -255,7 +256,7 @@ int st_select_lex_unit::exec()
...
@@ -255,7 +256,7 @@ int st_select_lex_unit::exec()
}
}
for
(
SELECT_LEX
*
sl
=
select_cursor
;
sl
;
sl
=
sl
->
next_select
())
for
(
SELECT_LEX
*
sl
=
select_cursor
;
sl
;
sl
=
sl
->
next_select
())
{
{
unsigned
int
rows
;
ha_rows
rows
=
0
;
thd
->
lex
.
current_select
=
sl
;
thd
->
lex
.
current_select
=
sl
;
if
(
optimized
)
if
(
optimized
)
...
@@ -270,7 +271,7 @@ int st_select_lex_unit::exec()
...
@@ -270,7 +271,7 @@ int st_select_lex_unit::exec()
sl
->
options
&=
~
OPTION_FOUND_ROWS
;
sl
->
options
&=
~
OPTION_FOUND_ROWS
;
else
if
(
found_rows_for_union
)
else
if
(
found_rows_for_union
)
{
{
rows
=
thd
->
select_limit
;
rows
=
sl
->
select_limit
;
sl
->
options
|=
OPTION_FOUND_ROWS
;
sl
->
options
|=
OPTION_FOUND_ROWS
;
}
}
...
@@ -313,8 +314,10 @@ int st_select_lex_unit::exec()
...
@@ -313,8 +314,10 @@ int st_select_lex_unit::exec()
thd
->
lex
.
current_select
=
lex_select_save
;
thd
->
lex
.
current_select
=
lex_select_save
;
DBUG_RETURN
(
res
);
DBUG_RETURN
(
res
);
}
}
if
(
found_rows_for_union
&&
!
sl
->
braces
&&
sl
->
options
&
OPTION_FOUND_ROWS
)
if
(
found_rows_for_union
&&
!
sl
->
braces
&&
add_rows
+=
(
thd
->
limit_found_rows
>
rows
)
?
thd
->
limit_found_rows
-
rows
:
0
;
(
sl
->
options
&
OPTION_FOUND_ROWS
))
add_rows
+=
(
sl
->
join
->
send_records
>
rows
)
?
sl
->
join
->
send_records
-
rows
:
0
;
}
}
}
}
optimized
=
1
;
optimized
=
1
;
...
@@ -329,18 +332,20 @@ int st_select_lex_unit::exec()
...
@@ -329,18 +332,20 @@ int st_select_lex_unit::exec()
if
(
!
thd
->
is_fatal_error
)
// Check if EOM
if
(
!
thd
->
is_fatal_error
)
// Check if EOM
{
{
ulong
options
=
thd
->
options
;
thd
->
lex
.
current_select
=
fake_select_lex
;
thd
->
lex
.
current_select
=
fake_select_lex
;
if
(
select_cursor
->
braces
)
if
(
select_cursor
->
braces
)
{
{
offset_limit_cnt
=
global_parameters
->
offset_limit
;
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
)
if
(
select_limit_cnt
<
global_parameters
->
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
)
if
(
select_limit_cnt
==
HA_POS_ERROR
)
thd
->
options
&=
~
OPTION_FOUND_ROWS
;
options
&=
~
OPTION_FOUND_ROWS
;
else
if
(
found_rows_for_union
&&
!
describe
)
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
->
ftfunc_list
=
&
empty_list
;
fake_select_lex
->
table_list
.
link_in_list
((
byte
*
)
&
result_table_list
,
fake_select_lex
->
table_list
.
link_in_list
((
byte
*
)
&
result_table_list
,
(
byte
**
)
(
byte
**
)
...
@@ -375,7 +380,7 @@ int st_select_lex_unit::exec()
...
@@ -375,7 +380,7 @@ int st_select_lex_unit::exec()
global_parameters
->
order_list
.
elements
,
global_parameters
->
order_list
.
elements
,
(
ORDER
*
)
global_parameters
->
order_list
.
first
,
(
ORDER
*
)
global_parameters
->
order_list
.
first
,
(
ORDER
*
)
NULL
,
NULL
,
(
ORDER
*
)
NULL
,
(
ORDER
*
)
NULL
,
NULL
,
(
ORDER
*
)
NULL
,
thd
->
options
|
SELECT_NO_UNLOCK
,
options
|
SELECT_NO_UNLOCK
,
result
,
this
,
fake_select_lex
,
0
);
result
,
this
,
fake_select_lex
,
0
);
if
(
found_rows_for_union
&&
!
res
)
if
(
found_rows_for_union
&&
!
res
)
{
{
...
...
sql/sql_update.cc
View file @
811ed77e
...
@@ -423,7 +423,7 @@ int mysql_multi_update(THD *thd,
...
@@ -423,7 +423,7 @@ int mysql_multi_update(THD *thd,
DBUG_RETURN
(
res
);
DBUG_RETURN
(
res
);
fix_tables_pointers
(
thd
->
lex
.
all_selects_list
);
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
))
if
(
setup_fields
(
thd
,
0
,
table_list
,
*
fields
,
1
,
0
,
0
))
DBUG_RETURN
(
-
1
);
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