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
0c82c7f6
Commit
0c82c7f6
authored
Nov 15, 2002
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
A fix for safe updates
parent
3071b63b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
9 deletions
+7
-9
sql/sql_delete.cc
sql/sql_delete.cc
+4
-4
sql/sql_update.cc
sql/sql_update.cc
+3
-5
No files found.
sql/sql_delete.cc
View file @
0c82c7f6
...
...
@@ -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
transactional_table
,
log_delayed
;
bool
transactional_table
,
log_delayed
,
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
->
net
,
ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE
);
DBUG_RETURN
(
1
);
...
...
@@ -57,7 +57,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
()))
...
...
@@ -91,7 +91,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
&&
!
using_limit
)
{
delete
select
;
send_error
(
&
thd
->
net
,
ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE
);
...
...
sql/sql_update.cc
View file @
0c82c7f6
...
...
@@ -53,7 +53,7 @@ int mysql_update(THD *thd,
enum
enum_duplicates
handle_duplicates
,
thr_lock_type
lock_type
)
{
bool
using_limit
=
limit
!=
HA_POS_ERROR
;
bool
using_limit
=
limit
!=
HA_POS_ERROR
,
safe_update
=
thd
->
options
&
OPTION_SAFE_UPDATES
;
bool
used_key_is_modified
,
transactional_table
,
log_delayed
;
int
error
=
0
;
uint
save_time_stamp
,
used_index
,
want_privilege
;
...
...
@@ -117,9 +117,7 @@ int mysql_update(THD *thd,
table
->
used_keys
=
0
;
select
=
make_select
(
table
,
0
,
0
,
conds
,
&
error
);
if
(
error
||
(
select
&&
select
->
check_quick
(
test
(
thd
->
options
&
OPTION_SAFE_UPDATES
),
limit
))
||
!
limit
)
(
select
&&
select
->
check_quick
(
safe_update
,
limit
))
||
!
limit
)
{
delete
select
;
table
->
time_stamp
=
save_time_stamp
;
// Restore timestamp pointer
...
...
@@ -134,7 +132,7 @@ int mysql_update(THD *thd,
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
&&
!
using_limit
)
{
delete
select
;
table
->
time_stamp
=
save_time_stamp
;
...
...
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