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
4143064e
Commit
4143064e
authored
Nov 14, 2002
by
Sinisa@sinisa.nasamreza.org
Browse files
Options
Browse Files
Download
Plain Diff
Merge sinisa@work.mysql.com:/home/bk/mysql-4.1
into sinisa.nasamreza.org:/mnt/work/mysql-4.1
parents
8827109c
93adaa6d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
10 deletions
+11
-10
sql/sql_delete.cc
sql/sql_delete.cc
+5
-7
sql/sql_select.cc
sql/sql_select.cc
+6
-3
No files found.
sql/sql_delete.cc
View file @
4143064e
...
...
@@ -35,13 +35,13 @@ int mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, ORDER *order,
SQL_SELECT
*
select
=
0
;
READ_RECORD
info
;
bool
using_limit
=
limit
!=
HA_POS_ERROR
;
bool
using_transactions
;
bool
using_transactions
,
safe_update
;
ha_rows
deleted
;
DBUG_ENTER
(
"mysql_delete"
);
if
(
!
table_list
->
db
)
table_list
->
db
=
thd
->
db
;
if
((
thd
->
options
&
OPTION_SAFE_UPDATES
)
&&
!
conds
)
if
((
(
safe_update
=
thd
->
options
&
OPTION_SAFE_UPDATES
)
)
&&
!
conds
)
{
send_error
(
thd
,
ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE
);
DBUG_RETURN
(
1
);
...
...
@@ -58,7 +58,7 @@ int mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, ORDER *order,
/* Test if the user wants to delete all rows */
if
(
!
using_limit
&&
(
!
conds
||
conds
->
const_item
())
&&
!
(
specialflag
&
(
SPECIAL_NO_NEW_FUNC
|
SPECIAL_SAFE_MODE
)))
!
(
specialflag
&
(
SPECIAL_NO_NEW_FUNC
|
SPECIAL_SAFE_MODE
))
&&
!
safe_update
)
{
deleted
=
table
->
file
->
records
;
if
(
!
(
error
=
table
->
file
->
delete_all_rows
()))
...
...
@@ -79,9 +79,7 @@ int mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, ORDER *order,
select
=
make_select
(
table
,
0
,
0
,
conds
,
&
error
);
if
(
error
)
DBUG_RETURN
(
-
1
);
if
((
select
&&
select
->
check_quick
(
test
(
thd
->
options
&
OPTION_SAFE_UPDATES
),
limit
))
||
!
limit
)
if
((
select
&&
select
->
check_quick
(
safe_update
,
limit
))
||
!
limit
)
{
delete
select
;
send_ok
(
thd
,
0L
);
...
...
@@ -92,7 +90,7 @@ int mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, ORDER *order,
if
(
!
table
->
quick_keys
)
{
thd
->
lex
.
select_lex
.
options
|=
QUERY_NO_INDEX_USED
;
if
(
(
thd
->
options
&
OPTION_SAFE_UPDATES
)
&&
limit
==
HA_POS_ERROR
)
if
(
safe_update
&&
use_limit
)
{
delete
select
;
send_error
(
thd
,
ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE
);
...
...
sql/sql_select.cc
View file @
4143064e
...
...
@@ -378,7 +378,7 @@ JOIN::optimize()
error
=
0
;
DBUG_RETURN
(
1
);
}
if
(
cond_value
==
Item
::
COND_FALSE
||
!
unit
->
select_limit_cnt
)
if
(
cond_value
==
Item
::
COND_FALSE
||
(
!
unit
->
select_limit_cnt
&&
!
(
select_options
&
OPTION_FOUND_ROWS
))
)
{
/* Impossible cond */
zero_result_cause
=
"Impossible WHERE"
;
DBUG_RETURN
(
0
);
...
...
@@ -669,10 +669,13 @@ JOIN::exec()
result
->
send_fields
(
fields_list
,
1
);
if
(
!
having
||
having
->
val_int
())
{
if
(
do_send_rows
&&
result
->
send_data
(
fields_list
))
if
(
do_send_rows
&&
unit
->
select_limit_cnt
&&
result
->
send_data
(
fields_list
))
error
=
1
;
else
{
error
=
(
int
)
result
->
send_eof
();
send_records
=
1
;
}
}
else
error
=
(
int
)
result
->
send_eof
();
...
...
@@ -5186,7 +5189,7 @@ end_send(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)),
error
=
0
;
if
(
join
->
procedure
)
error
=
join
->
procedure
->
send_row
(
*
join
->
fields
);
else
if
(
join
->
do_send_rows
)
else
if
(
join
->
do_send_rows
&&
join
->
unit
->
select_limit_cnt
)
error
=
join
->
result
->
send_data
(
*
join
->
fields
);
if
(
error
)
DBUG_RETURN
(
-
1
);
/* purecov: inspected */
...
...
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