1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

Merge moonbone.local:/mnt/gentoo64/work/bk-trees/mysql-5.0-opt

into  moonbone.local:/mnt/gentoo64/work/bk-trees/mysql-5.1-opt


mysql-test/r/func_gconcat.result:
  Auto merged
mysql-test/r/insert_update.result:
  Auto merged
mysql-test/r/subselect3.result:
  Auto merged
mysql-test/t/func_gconcat.test:
  Auto merged
mysql-test/t/insert_update.test:
  Auto merged
sql/field_conv.cc:
  Auto merged
sql/item.cc:
  Auto merged
sql/sql_base.cc:
  Auto merged
sql/sql_load.cc:
  Auto merged
sql/sql_select.cc:
  Auto merged
sql/table.h:
  Auto merged
mysql-test/r/gis.result:
  Manual merge
mysql-test/t/gis.test:
  Manual merge
sql/handler.cc:
  Manual merge
sql/item_sum.cc:
  Manual merge
sql/sql_insert.cc:
  Manual merge
sql/sql_table.cc:
  Manual merge
This commit is contained in:
unknown
2007-03-31 02:42:40 +04:00
18 changed files with 261 additions and 29 deletions

View File

@ -2338,6 +2338,9 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
table->insert_values= 0;
table->fulltext_searched= 0;
table->file->ft_handler= 0;
/* Catch wrong handling of the auto_increment_field_not_null. */
DBUG_ASSERT(!table->auto_increment_field_not_null);
table->auto_increment_field_not_null= FALSE;
if (table->timestamp_field)
table->timestamp_field_type= table->timestamp_field->get_auto_set_type();
table->pos_in_table_list= table_list;
@ -6238,6 +6241,11 @@ err_no_arena:
values values to fill with
ignore_errors TRUE if we should ignore errors
NOTE
fill_record() may set table->auto_increment_field_not_null and a
caller should make sure that it is reset after their last call to this
function.
RETURN
FALSE OK
TRUE error occured
@ -6250,27 +6258,52 @@ fill_record(THD * thd, List<Item> &fields, List<Item> &values,
List_iterator_fast<Item> f(fields),v(values);
Item *value, *fld;
Item_field *field;
TABLE *table= 0;
DBUG_ENTER("fill_record");
/*
Reset the table->auto_increment_field_not_null as it is valid for
only one row.
*/
if (fields.elements)
{
/*
On INSERT or UPDATE fields are checked to be from the same table,
thus we safely can take table from the first field.
*/
fld= (Item_field*)f++;
if (!(field= fld->filed_for_view_update()))
{
my_error(ER_NONUPDATEABLE_COLUMN, MYF(0), fld->name);
goto err;
}
table= field->field->table;
table->auto_increment_field_not_null= FALSE;
f.rewind();
}
while ((fld= f++))
{
if (!(field= fld->filed_for_view_update()))
{
my_error(ER_NONUPDATEABLE_COLUMN, MYF(0), fld->name);
DBUG_RETURN(TRUE);
goto err;
}
value=v++;
Field *rfield= field->field;
TABLE *table= rfield->table;
table= rfield->table;
if (rfield == table->next_number_field)
table->auto_increment_field_not_null= TRUE;
if ((value->save_in_field(rfield, 0) < 0) && !ignore_errors)
{
my_message(ER_UNKNOWN_ERROR, ER(ER_UNKNOWN_ERROR), MYF(0));
DBUG_RETURN(TRUE);
goto err;
}
}
DBUG_RETURN(thd->net.report_error);
err:
if (table)
table->auto_increment_field_not_null= FALSE;
DBUG_RETURN(TRUE);
}
@ -6319,6 +6352,11 @@ fill_record_n_invoke_before_triggers(THD *thd, List<Item> &fields,
values list of fields
ignore_errors TRUE if we should ignore errors
NOTE
fill_record() may set table->auto_increment_field_not_null and a
caller should make sure that it is reset after their last call to this
function.
RETURN
FALSE OK
TRUE error occured
@ -6329,19 +6367,38 @@ fill_record(THD *thd, Field **ptr, List<Item> &values, bool ignore_errors)
{
List_iterator_fast<Item> v(values);
Item *value;
TABLE *table= 0;
DBUG_ENTER("fill_record");
Field *field;
/*
Reset the table->auto_increment_field_not_null as it is valid for
only one row.
*/
if (*ptr)
{
/*
On INSERT or UPDATE fields are checked to be from the same table,
thus we safely can take table from the first field.
*/
table= (*ptr)->table;
table->auto_increment_field_not_null= FALSE;
}
while ((field = *ptr++))
{
value=v++;
TABLE *table= field->table;
table= field->table;
if (field == table->next_number_field)
table->auto_increment_field_not_null= TRUE;
if (value->save_in_field(field, 0) == -1)
DBUG_RETURN(TRUE);
goto err;
}
DBUG_RETURN(thd->net.report_error);
err:
if (table)
table->auto_increment_field_not_null= FALSE;
DBUG_RETURN(TRUE);
}