Commit 59aa4ee1 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 9d27a70d
...@@ -37,6 +37,14 @@ inline TOKU_TYPE mysql_to_toku_type (Field* field) { ...@@ -37,6 +37,14 @@ inline TOKU_TYPE mysql_to_toku_type (Field* field) {
case MYSQL_TYPE_BIT: case MYSQL_TYPE_BIT:
ret_val = toku_type_bitstream; ret_val = toku_type_bitstream;
goto exit; 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 // I believe these are old types that are no longer
// in any 5.1 tables, so tokudb does not need // in any 5.1 tables, so tokudb does not need
...@@ -300,6 +308,28 @@ exit: ...@@ -300,6 +308,28 @@ exit:
} }
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( int compare_field(
uchar* a_buf, uchar* a_buf,
uchar* b_buf, uchar* b_buf,
...@@ -331,12 +361,20 @@ int compare_field( ...@@ -331,12 +361,20 @@ int compare_field(
goto exit; goto exit;
case (toku_type_decimal): case (toku_type_decimal):
case (toku_type_bitstream): case (toku_type_bitstream):
case (toku_type_fixbinary):
num_bytes = field->pack_length(); num_bytes = field->pack_length();
set_if_smaller(num_bytes, key_part_length); set_if_smaller(num_bytes, key_part_length);
ret_val = cmp_toku_binary(a_buf, num_bytes, b_buf,num_bytes); ret_val = cmp_toku_binary(a_buf, num_bytes, b_buf,num_bytes);
*a_bytes_read = num_bytes; *a_bytes_read = num_bytes;
*b_bytes_read = num_bytes; *b_bytes_read = num_bytes;
goto exit; 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: default:
*a_bytes_read = field->packed_col_length(a_buf, key_part_length); *a_bytes_read = field->packed_col_length(a_buf, key_part_length);
*b_bytes_read = field->packed_col_length(b_buf, key_part_length); *b_bytes_read = field->packed_col_length(b_buf, key_part_length);
...@@ -386,6 +424,8 @@ uchar* pack_field( ...@@ -386,6 +424,8 @@ uchar* pack_field(
goto exit; goto exit;
case (toku_type_decimal): case (toku_type_decimal):
case (toku_type_bitstream): case (toku_type_bitstream):
case (toku_type_fixbinary):
case (toku_type_fixstring):
num_bytes = field->pack_length(); num_bytes = field->pack_length();
set_if_smaller(num_bytes, key_part_length); set_if_smaller(num_bytes, key_part_length);
new_pos = pack_toku_binary( new_pos = pack_toku_binary(
...@@ -424,6 +464,8 @@ uchar* pack_key_field( ...@@ -424,6 +464,8 @@ uchar* pack_key_field(
case (toku_type_float): case (toku_type_float):
case (toku_type_decimal): case (toku_type_decimal):
case (toku_type_bitstream): case (toku_type_bitstream):
case (toku_type_fixbinary):
case (toku_type_fixstring):
new_pos = pack_field(to_tokudb, from_mysql, field, key_part_length); new_pos = pack_field(to_tokudb, from_mysql, field, key_part_length);
goto exit; goto exit;
default: default:
...@@ -473,6 +515,8 @@ uchar* unpack_field( ...@@ -473,6 +515,8 @@ uchar* unpack_field(
goto exit; goto exit;
case (toku_type_decimal): case (toku_type_decimal):
case (toku_type_bitstream): case (toku_type_bitstream):
case (toku_type_fixbinary):
case (toku_type_fixstring):
num_bytes = field->pack_length(); num_bytes = field->pack_length();
set_if_smaller(num_bytes, key_part_length); set_if_smaller(num_bytes, key_part_length);
new_pos = unpack_toku_binary( new_pos = unpack_toku_binary(
......
...@@ -19,6 +19,8 @@ typedef enum { ...@@ -19,6 +19,8 @@ typedef enum {
toku_type_float, toku_type_float,
toku_type_decimal, toku_type_decimal,
toku_type_bitstream, toku_type_bitstream,
toku_type_fixbinary,
toku_type_fixstring,
toku_type_unknown toku_type_unknown
} TOKU_TYPE; } 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