From f93cb632028d14aae970a98ad0caf734b40009b5 Mon Sep 17 00:00:00 2001 From: "monty@mashka.mysql.fi" <> Date: Tue, 23 Jul 2002 02:08:48 +0300 Subject: Fixed problem with auto_increment key as not first key part --- sql/table.cc | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) (limited to 'sql/table.cc') diff --git a/sql/table.cc b/sql/table.cc index 66cbe7cfa16..4f71dacfa1d 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -346,17 +346,7 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag, } } if (reg_field->unireg_check == Field::NEXT_NUMBER) - { - if ((int) (outparam->next_number_index= (uint) - find_ref_key(outparam,reg_field, - &outparam->next_number_key_offset)) < 0) - reg_field->unireg_check=Field::NONE; /* purecov: inspected */ - else - { - outparam->found_next_number_field=reg_field; - reg_field->flags|=AUTO_INCREMENT_FLAG; - } - } + outparam->found_next_number_field= reg_field; if (outparam->timestamp_field == reg_field) outparam->timestamp_field_offset=i; if (use_hash) @@ -507,6 +497,19 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag, bfill(outparam->null_flags+outparam->rec_buff_length*2,null_length,255); } + if ((reg_field=outparam->found_next_number_field)) + { + if ((int) (outparam->next_number_index= (uint) + find_ref_key(outparam,reg_field, + &outparam->next_number_key_offset)) < 0) + { + reg_field->unireg_check=Field::NONE; /* purecov: inspected */ + outparam->found_next_number_field=0; + } + else + reg_field->flags|=AUTO_INCREMENT_FLAG; + } + if (outparam->blob_fields) { Field **ptr; -- cgit v1.2.1