Proper fix for bug with BLOB in MIN/MAX

sql/key.cc:
  Change constant to define
This commit is contained in:
unknown 2004-01-19 23:44:39 +01:00
parent 0153488a02
commit fe9647968d
2 changed files with 9 additions and 7 deletions

View File

@ -182,9 +182,9 @@ int key_cmp(TABLE *table,const byte *key,uint idx,uint key_length)
}
if (key_part->key_part_flag & (HA_BLOB_PART | HA_VAR_LENGTH))
{
if (key_part->field->key_cmp(key, key_part->length+2))
if (key_part->field->key_cmp(key, key_part->length+ HA_KEY_BLOB_LENGTH))
return 1;
length=key_part->length+2;
length=key_part->length+HA_KEY_BLOB_LENGTH;
}
else
{

View File

@ -440,14 +440,16 @@ static bool find_range_key(TABLE_REF *ref, Field* field, COND *cond)
left_length < part->store_length ||
(table->file->index_flags(idx) & HA_WRONG_ASCII_ORDER))
break;
uint store_length= part->store_length;
// Save found constant
if (part->null_bit)
{
*key_ptr++= (byte) test(part->field->is_null());
part->field->get_key_image((char*) key_ptr,
(part->field->type() == FIELD_TYPE_BLOB) ?
part->length + HA_KEY_BLOB_LENGTH : part->length);
key_ptr+=part->store_length - test(part->null_bit);
left_length-=part->store_length;
store_length--;
}
part->field->get_key_image((char*) key_ptr, store_length);
key_ptr+= store_length;
left_length-= part->store_length;
}
if (part == part_end && part->field == field)
{