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
0848d8c3
Commit
0848d8c3
authored
Aug 30, 2005
by
osku@127.(none)
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug #11946: Review fixes.
parent
312b1614
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
21 additions
and
17 deletions
+21
-17
sql/ha_innodb.cc
sql/ha_innodb.cc
+2
-2
sql/ha_innodb.h
sql/ha_innodb.h
+1
-1
sql/handler.h
sql/handler.h
+7
-6
sql/mysql_priv.h
sql/mysql_priv.h
+3
-2
sql/sql_delete.cc
sql/sql_delete.cc
+6
-5
sql/sql_parse.cc
sql/sql_parse.cc
+2
-1
No files found.
sql/ha_innodb.cc
View file @
0848d8c3
...
...
@@ -6890,7 +6890,7 @@ ha_innobase::get_auto_increment()
/* See comment in handler.h */
int
ha_innobase
::
reset_auto_increment
()
ha_innobase
::
reset_auto_increment
(
ulonglong
value
)
{
DBUG_ENTER
(
"ha_innobase::reset_auto_increment"
);
...
...
@@ -6905,7 +6905,7 @@ ha_innobase::reset_auto_increment()
DBUG_RETURN
(
error
);
}
dict_table_autoinc_initialize
(
prebuilt
->
table
,
0
);
dict_table_autoinc_initialize
(
prebuilt
->
table
,
value
);
DBUG_RETURN
(
0
);
}
...
...
sql/ha_innodb.h
View file @
0848d8c3
...
...
@@ -173,7 +173,7 @@ class ha_innobase: public handler
enum
thr_lock_type
lock_type
);
void
init_table_handle_for_HANDLER
();
ulonglong
get_auto_increment
();
int
reset_auto_increment
();
int
reset_auto_increment
(
ulonglong
value
);
uint8
table_cache_type
()
{
return
HA_CACHE_TBL_ASKTRANSACT
;
}
/*
...
...
sql/handler.h
View file @
0848d8c3
...
...
@@ -651,12 +651,13 @@ class handler :public Sql_alloc
virtual
ulonglong
get_auto_increment
();
virtual
void
restore_auto_increment
();
/* This is called after TRUNCATE is emulated by doing a 'DELETE FROM t',
in which case we need a separate operation for resetting the table's
auto-increment counter. HA_ERR_WRONG_COMMAND is returned by storage
engines that have no need for this, i.e. those that can always do a
fast TRUNCATE. */
virtual
int
reset_auto_increment
()
/*
Reset the auto-increment counter to the given value, i.e. the next row
inserted will get the given value. This is called e.g. after TRUNCATE
is emulated by doing a 'DELETE FROM t'. HA_ERR_WRONG_COMMAND is
returned by storage engines that don't support this operation.
*/
virtual
int
reset_auto_increment
(
ulonglong
value
)
{
return
HA_ERR_WRONG_COMMAND
;
}
virtual
void
update_create_info
(
HA_CREATE_INFO
*
create_info
)
{}
...
...
sql/mysql_priv.h
View file @
0848d8c3
...
...
@@ -740,8 +740,9 @@ bool mysql_insert(THD *thd,TABLE_LIST *table,List<Item> &fields,
int
check_that_all_fields_are_given_values
(
THD
*
thd
,
TABLE
*
entry
,
TABLE_LIST
*
table_list
);
bool
mysql_prepare_delete
(
THD
*
thd
,
TABLE_LIST
*
table_list
,
Item
**
conds
);
bool
mysql_delete
(
THD
*
thd
,
TABLE_LIST
*
table
,
COND
*
conds
,
SQL_LIST
*
order
,
ha_rows
rows
,
ulonglong
options
);
bool
mysql_delete
(
THD
*
thd
,
TABLE_LIST
*
table_list
,
COND
*
conds
,
SQL_LIST
*
order
,
ha_rows
rows
,
ulonglong
options
,
bool
reset_auto_increment
);
bool
mysql_truncate
(
THD
*
thd
,
TABLE_LIST
*
table_list
,
bool
dont_send_ok
);
bool
mysql_create_or_drop_trigger
(
THD
*
thd
,
TABLE_LIST
*
tables
,
bool
create
);
TABLE
*
open_ltable
(
THD
*
thd
,
TABLE_LIST
*
table_list
,
thr_lock_type
update
);
...
...
sql/sql_delete.cc
View file @
0848d8c3
...
...
@@ -27,7 +27,8 @@
#include "sql_trigger.h"
bool
mysql_delete
(
THD
*
thd
,
TABLE_LIST
*
table_list
,
COND
*
conds
,
SQL_LIST
*
order
,
ha_rows
limit
,
ulonglong
options
)
SQL_LIST
*
order
,
ha_rows
limit
,
ulonglong
options
,
bool
reset_auto_increment
)
{
int
error
;
TABLE
*
table
;
...
...
@@ -230,18 +231,18 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
if
(
options
&
OPTION_QUICK
)
(
void
)
table
->
file
->
extra
(
HA_EXTRA_NORMAL
);
if
(
(
error
<
0
)
&&
(
thd
->
lex
->
sql_command
==
SQLCOM_TRUNCATE
))
if
(
reset_auto_increment
&&
(
error
<
0
))
{
/*
We're really doing a truncate and need to reset the table's
auto-increment counter.
*/
int
error2
=
table
->
file
->
reset_auto_increment
(
);
int
error2
=
table
->
file
->
reset_auto_increment
(
0
);
if
(
error2
&&
(
error2
!=
HA_ERR_WRONG_COMMAND
))
{
table
->
file
->
print_error
(
error2
,
MYF
(
0
));
error
=
1
;
error
=
1
;
}
}
...
...
@@ -828,7 +829,7 @@ bool mysql_truncate(THD *thd, TABLE_LIST *table_list, bool dont_send_ok)
ha_enable_transaction
(
thd
,
FALSE
);
mysql_init_select
(
thd
->
lex
);
error
=
mysql_delete
(
thd
,
table_list
,
(
COND
*
)
0
,
(
SQL_LIST
*
)
0
,
HA_POS_ERROR
,
LL
(
0
)
);
HA_POS_ERROR
,
LL
(
0
),
TRUE
);
ha_enable_transaction
(
thd
,
TRUE
);
thd
->
options
=
save_options
;
DBUG_RETURN
(
error
);
...
...
sql/sql_parse.cc
View file @
0848d8c3
...
...
@@ -3321,7 +3321,8 @@ mysql_execute_command(THD *thd)
unit
->
set_limit
(
select_lex
);
res
=
mysql_delete
(
thd
,
all_tables
,
select_lex
->
where
,
&
select_lex
->
order_list
,
unit
->
select_limit_cnt
,
select_lex
->
options
);
unit
->
select_limit_cnt
,
select_lex
->
options
,
FALSE
);
break
;
}
case
SQLCOM_DELETE_MULTI
:
...
...
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