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

Merge sanja.is.com.ua:/home/bell/mysql/bk/mysql-5.0

into  sanja.is.com.ua:/home/bell/mysql/bk/work-owner7-5.0
This commit is contained in:
bell@sanja.is.com.ua
2005-10-28 10:12:36 +03:00
76 changed files with 895 additions and 926 deletions

View File

@ -245,7 +245,7 @@ int mysql_update(THD *thd,
}
if (!select && limit != HA_POS_ERROR)
{
if (MAX_KEY != (used_index= get_index_for_order(table, order, limit)))
if ((used_index= get_index_for_order(table, order, limit)) != MAX_KEY)
need_sort= FALSE;
}
/* If running in safe sql mode, don't allow updates without keys */
@ -268,14 +268,14 @@ int mysql_update(THD *thd,
used_key_is_modified= (!select->quick->unique_key_range() &&
select->quick->check_if_keys_used(&fields));
}
else if (used_index != MAX_KEY)
{
used_key_is_modified= check_if_key_used(table, used_index, fields);
}
else if ((used_index=table->file->key_used_on_scan) < MAX_KEY)
used_key_is_modified=check_if_key_used(table, used_index, fields);
else
used_key_is_modified=0;
{
used_key_is_modified= 0;
if (used_index == MAX_KEY) // no index for sort order
used_index= table->file->key_used_on_scan;
if (used_index != MAX_KEY)
used_key_is_modified= check_if_key_used(table, used_index, fields);
}
if (used_key_is_modified || order)
{
@ -287,11 +287,11 @@ int mysql_update(THD *thd,
if (used_index < MAX_KEY && old_used_keys.is_set(used_index))
{
table->key_read=1;
table->file->extra(HA_EXTRA_KEYREAD); //todo: psergey: check
table->file->extra(HA_EXTRA_KEYREAD);
}
/* note: can actually avoid sorting below.. */
if (order && need_sort)
if (order && (need_sort || used_key_is_modified))
{
/*
Doing an ORDER BY; Let filesort find and sort the rows we are going
@ -301,6 +301,7 @@ int mysql_update(THD *thd,
SORT_FIELD *sortorder;
ha_rows examined_rows;
used_index= MAX_KEY; // For call to init_read_record()
table->sort.io_cache = (IO_CACHE *) my_malloc(sizeof(IO_CACHE),
MYF(MY_FAE | MY_ZEROFILL));
if (!(sortorder=make_unireg_sortorder(order, &length)) ||
@ -367,10 +368,7 @@ int mysql_update(THD *thd,
error= 1; // Aborted
limit= tmp_limit;
end_read_record(&info);
/* if we got here we must not use index in the main update loop below */
used_index= MAX_KEY;
/* Change select to use tempfile */
if (select)
{