diff options
author | Sergei Golubchik <sergii@pisem.net> | 2014-06-09 20:18:53 +0200 |
---|---|---|
committer | Sergei Golubchik <sergii@pisem.net> | 2014-06-09 20:18:53 +0200 |
commit | 2510f9c6066f8702fad6865330bf99031f9b4b60 (patch) | |
tree | 69062a5c22cab8230db8424fe4475b41c1ccbf03 /sql/field.cc | |
parent | dc9b2a95bff1fbcd5cb9f91a0ed3ba9caef17c49 (diff) | |
download | mariadb-git-2510f9c6066f8702fad6865330bf99031f9b4b60.tar.gz |
cleanup: remove special case from store_key::store_key(), add Field_blob::new_key_field
(prep for MDEV-6065)
Diffstat (limited to 'sql/field.cc')
-rw-r--r-- | sql/field.cc | 44 |
1 files changed, 25 insertions, 19 deletions
diff --git a/sql/field.cc b/sql/field.cc index 32ea2a536ef..13cad813b82 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -1965,8 +1965,8 @@ Field *Field::new_field(MEM_ROOT *root, TABLE *new_table, Field *Field::new_key_field(MEM_ROOT *root, TABLE *new_table, - uchar *new_ptr, uchar *new_null_ptr, - uint new_null_bit) + uchar *new_ptr, uint32 length, + uchar *new_null_ptr, uint new_null_bit) { Field *tmp; if ((tmp= new_field(root, new_table, table == new_table))) @@ -7204,17 +7204,14 @@ Field *Field_varstring::new_field(MEM_ROOT *root, TABLE *new_table, } -Field *Field_varstring::new_key_field(MEM_ROOT *root, - TABLE *new_table, - uchar *new_ptr, uchar *new_null_ptr, - uint new_null_bit) +Field *Field_varstring::new_key_field(MEM_ROOT *root, TABLE *new_table, + uchar *new_ptr, uint32 length, + uchar *new_null_ptr, uint new_null_bit) { Field_varstring *res; - if ((res= (Field_varstring*) Field::new_key_field(root, - new_table, - new_ptr, - new_null_ptr, - new_null_bit))) + if ((res= (Field_varstring*) Field::new_key_field(root, new_table, + new_ptr, length, + new_null_ptr, new_null_bit))) { /* Keys length prefixes are always packed with 2 bytes */ res->length_bytes= 2; @@ -7222,7 +7219,6 @@ Field *Field_varstring::new_key_field(MEM_ROOT *root, return res; } - uint Field_varstring::is_equal(Create_field *new_field) { if (new_field->sql_type == real_type() && @@ -7579,6 +7575,18 @@ int Field_blob::key_cmp(const uchar *a,const uchar *b) } +Field *Field_blob::new_key_field(MEM_ROOT *root, TABLE *new_table, + uchar *new_ptr, uint32 length, + uchar *new_null_ptr, uint new_null_bit) +{ + Field_varstring *res= new (root) Field_varstring(new_ptr, length, 2, + new_null_ptr, new_null_bit, Field::NONE, + field_name, table->s, charset()); + res->init(new_table); + return res; +} + + /** Save the field metadata for blob fields. @@ -8426,15 +8434,13 @@ Field_bit::do_last_null_byte() const } -Field *Field_bit::new_key_field(MEM_ROOT *root, - TABLE *new_table, - uchar *new_ptr, uchar *new_null_ptr, - uint new_null_bit) +Field *Field_bit::new_key_field(MEM_ROOT *root, TABLE *new_table, + uchar *new_ptr, uint32 length, + uchar *new_null_ptr, uint new_null_bit) { Field_bit *res; - if ((res= (Field_bit*) Field::new_key_field(root, new_table, - new_ptr, new_null_ptr, - new_null_bit))) + if ((res= (Field_bit*) Field::new_key_field(root, new_table, new_ptr, length, + new_null_ptr, new_null_bit))) { /* Move bits normally stored in null_pointer to new_ptr */ res->bit_ptr= new_ptr; |