diff options
author | unknown <heikki@donna.mysql.fi> | 2001-05-21 19:04:46 +0300 |
---|---|---|
committer | unknown <heikki@donna.mysql.fi> | 2001-05-21 19:04:46 +0300 |
commit | 00c7a75380c944fbfdf982989a0b76a6f0057210 (patch) | |
tree | 227b53a6a74235a06057b8f20f57bf38e04cd997 /sql/ha_innobase.cc | |
parent | 9171d4da5966d55e65cd1d81a00ca34c877cbe47 (diff) | |
download | mariadb-git-00c7a75380c944fbfdf982989a0b76a6f0057210.tar.gz |
dict0dict.h InnoDB now tries to provide autoinc column value from a counter table in data dict
dict0mem.h InnoDB now tries to provide autoinc column value from a counter table in data dict
sync0sync.h InnoDB now tries to provide autoinc column value from a counter table in data dict
univ.i InnoDB now tries to provide autoinc column value from a counter table in data dict
dict0dict.c InnoDB now tries to provide autoinc column value from a counter table in data dict
dict0mem.c InnoDB now tries to provide autoinc column value from a counter table in data dict
sync0sync.c InnoDB now tries to provide autoinc column value from a counter table in data dict
ha_innobase.cc InnoDB now tries to provide autoinc column value from a counter table in data dict
sql/ha_innobase.cc:
InnoDB now tries to provide autoinc column value from a counter table in data dict
innobase/sync/sync0sync.c:
InnoDB now tries to provide autoinc column value from a counter table in data dict
innobase/dict/dict0mem.c:
InnoDB now tries to provide autoinc column value from a counter table in data dict
innobase/dict/dict0dict.c:
InnoDB now tries to provide autoinc column value from a counter table in data dict
innobase/include/dict0dict.h:
InnoDB now tries to provide autoinc column value from a counter table in data dict
innobase/include/dict0mem.h:
InnoDB now tries to provide autoinc column value from a counter table in data dict
innobase/include/sync0sync.h:
InnoDB now tries to provide autoinc column value from a counter table in data dict
innobase/include/univ.i:
InnoDB now tries to provide autoinc column value from a counter table in data dict
Diffstat (limited to 'sql/ha_innobase.cc')
-rw-r--r-- | sql/ha_innobase.cc | 38 |
1 files changed, 36 insertions, 2 deletions
diff --git a/sql/ha_innobase.cc b/sql/ha_innobase.cc index 8af9de0eaba..3e86d0da6f1 100644 --- a/sql/ha_innobase.cc +++ b/sql/ha_innobase.cc @@ -1242,7 +1242,8 @@ ha_innobase::write_row( { row_prebuilt_t* prebuilt = (row_prebuilt_t*)innobase_prebuilt; int error; - + longlong auto_inc; + DBUG_ENTER("ha_innobase::write_row"); statistic_increment(ha_write_count, &LOCK_status); @@ -1261,10 +1262,43 @@ ha_innobase::write_row( make sure all columns are fetched in the select done by update_auto_increment */ - prebuilt->in_update_remember_pos = FALSE; + /* Fetch the value the user possibly has set in the + autoincrement field */ + + auto_inc = table->next_number_field->val_int(); + + if (auto_inc != 0) { + /* This call will calculate the max of the + current value and the value supplied by the user, if + the auto_inc counter is already initialized + for the table */ + dict_table_autoinc_update(prebuilt->table, auto_inc); + } else { + auto_inc = dict_table_autoinc_get(prebuilt->table); + /* If auto_inc is now != 0 the autoinc counter + was already initialized for the table: we can give + the new value for MySQL to place in the field */ + + if (auto_inc != 0) { + user_thd->next_insert_id = auto_inc; + } + } + + prebuilt->in_update_remember_pos = FALSE; + update_auto_increment(); + if (auto_inc == 0) { + /* The autoinc counter for our table was not yet + initialized, initialize it now */ + + auto_inc = table->next_number_field->val_int(); + + dict_table_autoinc_initialize(prebuilt->table, + auto_inc); + } + /* We have to set sql_stat_start to TRUE because update_auto_increment has called a select, and has reset that flag; row_insert_for_mysql has to |