summaryrefslogtreecommitdiff
path: root/sql/handler.h
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2019-10-10 21:30:40 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2019-10-10 21:30:40 +0300
commit09afd3da1a80e403b5375845770dde61832afa50 (patch)
treea157942b08fc3d6bf97e2af3ae6e1d2e2ecbfc3e /sql/handler.h
parent0f7732d1d1d898f1a9051858932c18bcc9d6f2b4 (diff)
parent4cdb72f2372b27e1fbbc573812240c1e29128c8f (diff)
downloadmariadb-git-09afd3da1a80e403b5375845770dde61832afa50.tar.gz
Merge 10.3 into 10.4
Diffstat (limited to 'sql/handler.h')
-rw-r--r--sql/handler.h18
1 files changed, 16 insertions, 2 deletions
diff --git a/sql/handler.h b/sql/handler.h
index 46de5e5f017..2d25568488b 100644
--- a/sql/handler.h
+++ b/sql/handler.h
@@ -3122,6 +3122,10 @@ private:
*/
Handler_share **ha_share;
+ /** Stores next_insert_id for handling duplicate key errors. */
+ ulonglong m_prev_insert_id;
+
+
public:
handler(handlerton *ht_arg, TABLE_SHARE *share_arg)
:table_share(share_arg), table(0),
@@ -3146,7 +3150,7 @@ public:
auto_inc_intervals_count(0),
m_psi(NULL), set_top_table_fields(FALSE), top_table(0),
top_table_field(0), top_table_fields(0),
- m_lock_type(F_UNLCK), ha_share(NULL)
+ m_lock_type(F_UNLCK), ha_share(NULL), m_prev_insert_id(0)
{
DBUG_PRINT("info",
("handler created F_UNLCK %d F_RDLCK %d F_WRLCK %d",
@@ -3809,7 +3813,7 @@ public:
DBUG_PRINT("info",("auto_increment: next value %lu", (ulong)id));
next_insert_id= id;
}
- void restore_auto_increment(ulonglong prev_insert_id)
+ virtual void restore_auto_increment(ulonglong prev_insert_id)
{
/*
Insertion of a row failed, re-use the lastly generated auto_increment
@@ -3825,6 +3829,16 @@ public:
insert_id_for_cur_row;
}
+ /** Store and restore next_insert_id over duplicate key errors. */
+ virtual void store_auto_increment()
+ {
+ m_prev_insert_id= next_insert_id;
+ }
+ virtual void restore_auto_increment()
+ {
+ restore_auto_increment(m_prev_insert_id);
+ }
+
virtual void update_create_info(HA_CREATE_INFO *create_info) {}
int check_old_types();
virtual int assign_to_keycache(THD* thd, HA_CHECK_OPT* check_opt)