Commit 2ee2ad74 authored by Rich Prohaska's avatar Rich Prohaska Committed by Yoni Fogel

fix the problem with mysql unpack_key implementation. closes #561

git-svn-id: file:///svn/mysql/tokudb-engine/src@3187 c7de825b-a66e-492c-adef-691d508d4ae1
parent 1e2322e7
...@@ -1025,11 +1025,18 @@ void ha_tokudb::unpack_key(uchar * record, DBT * key, uint index) { ...@@ -1025,11 +1025,18 @@ void ha_tokudb::unpack_key(uchar * record, DBT * key, uint index) {
} }
record[key_part->null_offset] &= ~key_part->null_bit; record[key_part->null_offset] &= ~key_part->null_bit;
} }
/* tokutek change to make pack_key and unpack_key work for
decimals */
uint unpack_length = key_part->length;
if (key_part->field->type() == MYSQL_TYPE_NEWDECIMAL) {
Field_new_decimal *field_nd = (Field_new_decimal *) key_part->field;
unpack_length += field_nd->precision << 8;
}
pos = (uchar *) key_part->field->unpack_key(record + field_offset(key_part->field), pos, pos = (uchar *) key_part->field->unpack_key(record + field_offset(key_part->field), pos,
#if MYSQL_VERSION_ID < 50123 #if MYSQL_VERSION_ID < 50123
key_part->length); unpack_length);
#else #else
key_part->length, table->s->db_low_byte_first); unpack_length, table->s->db_low_byte_first);
#endif #endif
} }
} }
...@@ -2242,6 +2249,19 @@ int ha_tokudb::create(const char *name, TABLE * form, HA_CREATE_INFO * create_in ...@@ -2242,6 +2249,19 @@ int ha_tokudb::create(const char *name, TABLE * form, HA_CREATE_INFO * create_in
int error; int error;
char newname[get_name_length(name) + 32]; char newname[get_name_length(name) + 32];
if (tokudb_debug & TOKUDB_DEBUG_OPEN) {
uint i;
for (i=0; i<form->s->keys; i++) {
KEY *key = &form->s->key_info[i];
uint p;
for (p=0; p<key->key_parts; p++) {
KEY_PART_INFO *key_info = &key->key_part[p];
printf("%d:%s:%d:key:%d:%d:type=%d:flags=%x\n", my_tid(), __FILE__, __LINE__,
i, p, key_info->field->type(), key_info->field->flags);
}
}
}
// a table is a directory of dictionaries // a table is a directory of dictionaries
make_name(newname, name, 0); make_name(newname, name, 0);
error = mkdirpath(newname, 0777); error = mkdirpath(newname, 0777);
......
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