Commit 07a02b10 authored by Zardosht Kasheff's avatar Zardosht Kasheff Committed by Yoni Fogel

addresses #1619

add support for binary and fixed sized strings

git-svn-id: file:///svn/mysql/tokudb-engine/src@10816 c7de825b-a66e-492c-adef-691d508d4ae1
parent c2e97743
......@@ -37,6 +37,14 @@ inline TOKU_TYPE mysql_to_toku_type (Field* field) {
case MYSQL_TYPE_BIT:
ret_val = toku_type_bitstream;
goto exit;
case MYSQL_TYPE_STRING:
if (field->binary()) {
ret_val = toku_type_fixbinary;
}
else {
ret_val = toku_type_fixstring;
}
goto exit;
//
// I believe these are old types that are no longer
// in any 5.1 tables, so tokudb does not need
......@@ -300,6 +308,28 @@ inline int cmp_toku_binary(
}
inline int cmp_toku_string(
uchar* a_buf,
u_int32_t a_num_bytes,
uchar* b_buf,
u_int32_t b_num_bytes,
u_int32_t charset_number
)
{
int ret_val = 0;
CHARSET_INFO* charset = NULL;
charset = get_charset(charset_number, MYF(MY_WME));
ret_val = charset->coll->strnncollsp(
charset,
a_buf,
a_num_bytes,
b_buf,
b_num_bytes,
0
);
return ret_val;
}
int compare_field(
uchar* a_buf,
uchar* b_buf,
......@@ -331,12 +361,20 @@ int compare_field(
goto exit;
case (toku_type_decimal):
case (toku_type_bitstream):
case (toku_type_fixbinary):
num_bytes = field->pack_length();
set_if_smaller(num_bytes, key_part_length);
ret_val = cmp_toku_binary(a_buf, num_bytes, b_buf,num_bytes);
*a_bytes_read = num_bytes;
*b_bytes_read = num_bytes;
goto exit;
case (toku_type_fixstring):
num_bytes = field->pack_length();
set_if_smaller(num_bytes, key_part_length);
ret_val = cmp_toku_string(a_buf, num_bytes, b_buf,num_bytes, field->charset()->number);
*a_bytes_read = num_bytes;
*b_bytes_read = num_bytes;
goto exit;
default:
*a_bytes_read = field->packed_col_length(a_buf, key_part_length);
*b_bytes_read = field->packed_col_length(b_buf, key_part_length);
......@@ -386,6 +424,8 @@ uchar* pack_field(
goto exit;
case (toku_type_decimal):
case (toku_type_bitstream):
case (toku_type_fixbinary):
case (toku_type_fixstring):
num_bytes = field->pack_length();
set_if_smaller(num_bytes, key_part_length);
new_pos = pack_toku_binary(
......@@ -424,6 +464,8 @@ uchar* pack_key_field(
case (toku_type_float):
case (toku_type_decimal):
case (toku_type_bitstream):
case (toku_type_fixbinary):
case (toku_type_fixstring):
new_pos = pack_field(to_tokudb, from_mysql, field, key_part_length);
goto exit;
default:
......@@ -473,6 +515,8 @@ uchar* unpack_field(
goto exit;
case (toku_type_decimal):
case (toku_type_bitstream):
case (toku_type_fixbinary):
case (toku_type_fixstring):
num_bytes = field->pack_length();
set_if_smaller(num_bytes, key_part_length);
new_pos = unpack_toku_binary(
......
......@@ -19,6 +19,8 @@ typedef enum {
toku_type_float,
toku_type_decimal,
toku_type_bitstream,
toku_type_fixbinary,
toku_type_fixstring,
toku_type_unknown
} TOKU_TYPE;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment