summaryrefslogtreecommitdiff
path: root/sql/ha_partition.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/ha_partition.cc')
-rw-r--r--sql/ha_partition.cc15
1 files changed, 7 insertions, 8 deletions
diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc
index 7298dcd15c6..4df4a4c7c01 100644
--- a/sql/ha_partition.cc
+++ b/sql/ha_partition.cc
@@ -9980,8 +9980,7 @@ uint8 ha_partition::table_cache_type()
uint32 ha_partition::calculate_key_hash_value(Field **field_array)
{
- ulong nr1= 1;
- ulong nr2= 4;
+ Hasher hasher;
bool use_51_hash;
use_51_hash= MY_TEST((*field_array)->table->part_info->key_algorithm ==
partition_info::KEY_ALGORITHM_51);
@@ -10008,12 +10007,12 @@ uint32 ha_partition::calculate_key_hash_value(Field **field_array)
{
if (field->is_null())
{
- nr1^= (nr1 << 1) | 1;
+ hasher.add_null();
continue;
}
/* Force this to my_hash_sort_bin, which was used in 5.1! */
uint len= field->pack_length();
- my_charset_bin.hash_sort(field->ptr, len, &nr1, &nr2);
+ hasher.add(&my_charset_bin, field->ptr, len);
/* Done with this field, continue with next one. */
continue;
}
@@ -10031,12 +10030,12 @@ uint32 ha_partition::calculate_key_hash_value(Field **field_array)
{
if (field->is_null())
{
- nr1^= (nr1 << 1) | 1;
+ hasher.add_null();
continue;
}
/* Force this to my_hash_sort_bin, which was used in 5.1! */
uint len= field->pack_length();
- my_charset_latin1.hash_sort(field->ptr, len, &nr1, &nr2);
+ hasher.add(&my_charset_latin1, field->ptr, len);
continue;
}
/* New types in mysql-5.6. */
@@ -10063,9 +10062,9 @@ uint32 ha_partition::calculate_key_hash_value(Field **field_array)
}
/* fall through, use collation based hashing. */
}
- field->hash(&nr1, &nr2);
+ field->hash(&hasher);
} while (*(++field_array));
- return (uint32) nr1;
+ return (uint32) hasher.finalize();
}