diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2019-10-11 08:41:36 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2019-10-11 08:41:36 +0300 |
commit | d04f2de80a96b3ff9290ee27507195bfb01fc77f (patch) | |
tree | 49da698fbe99c5888f41238b0cda4e1eedebf2e2 /sql/handler.h | |
parent | 5e17b1f7cbfc256850ed139a0a4898040e16ff60 (diff) | |
parent | b05be3ef8c8668ddbcbe8e1c08dcd4fcc88eb4cf (diff) | |
download | mariadb-git-d04f2de80a96b3ff9290ee27507195bfb01fc77f.tar.gz |
Merge 10.4 into 10.5
Diffstat (limited to 'sql/handler.h')
-rw-r--r-- | sql/handler.h | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/sql/handler.h b/sql/handler.h index b20ecdd8d37..c751817f5f1 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -3119,6 +3119,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), @@ -3143,7 +3147,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", @@ -3806,7 +3810,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 @@ -3822,6 +3826,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) |