Commit ae3c263a authored by Zardosht Kasheff's avatar Zardosht Kasheff Committed by Yoni Fogel

addresses #1619

create unpack_field, integrate it into unpack_key

git-svn-id: file:///svn/mysql/tokudb-engine/src@10742 c7de825b-a66e-492c-adef-691d508d4ae1
parent 8104bb75
......@@ -1279,12 +1279,15 @@ u_int32_t ha_tokudb::place_key_into_mysql_buff(KEY* key_info, uchar * record, uc
}
record[key_part->null_offset] &= ~key_part->null_bit;
}
uint unpack_length = key_part->length;
pos = (uchar *) key_part->field->unpack_key(
record + field_offset(key_part->field, table),
//
// HOPEFULLY TEMPORARY
//
assert(table->s->db_low_byte_first);
pos = unpack_field(
record + field_offset(key_part->field, table),
pos,
unpack_length,
table->s->db_low_byte_first
key_part->field,
key_part->length
);
}
return pos-data;
......
......@@ -100,6 +100,39 @@ uchar* pack_field(
return new_pos;
}
uchar* unpack_field(
uchar* to_mysql,
uchar* from_tokudb,
Field* field,
u_int32_t key_part_length
)
{
uchar* new_pos = NULL;
TOKU_TYPE toku_type = mysql_to_toku_type(field->type());
switch(toku_type) {
case (toku_type_int):
assert(key_part_length == field->pack_length());
new_pos = unpack_toku_int(
to_mysql,
from_tokudb,
field->pack_length()
);
goto exit;
default:
new_pos = (uchar *) field->unpack_key(
to_mysql,
from_tokudb,
key_part_length,
TRUE
);
goto exit;
}
assert(false);
exit:
return new_pos;
}
//
// assuming MySQL in little endian, and we are storing in little endian
//
......
......@@ -30,6 +30,12 @@ uchar* pack_field(
u_int32_t key_part_length //I really hope this is temporary as I phase out the pack_cmp stuff
);
uchar* unpack_field(
uchar* to_mysql,
uchar* from_tokudb,
Field* field,
u_int32_t key_part_length
);
uchar* pack_toku_int (uchar* to_tokudb, uchar* from_mysql, u_int32_t num_bytes);
uchar* unpack_toku_int(uchar* to_mysql, uchar* from_tokudb, u_int32_t num_bytes);
......
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