diff options
author | Alexander Barkov <bar@mariadb.com> | 2020-01-26 20:27:13 +0400 |
---|---|---|
committer | Alexander Barkov <bar@mariadb.com> | 2020-01-28 12:29:23 +0400 |
commit | f1e13fdc8d9e78f4529aa60b6a9b49c6ff063c66 (patch) | |
tree | ce84da1deeea573be5be7db7d739a4c9ba9b40f8 /sql/key.cc | |
parent | dd68ba74f357aca074609cbd77491ed4ba390369 (diff) | |
download | mariadb-git-f1e13fdc8d9e78f4529aa60b6a9b49c6ff063c66.tar.gz |
MDEV-21581 Helper functions and methods for CHARSET_INFO
Diffstat (limited to 'sql/key.cc')
-rw-r--r-- | sql/key.cc | 41 |
1 files changed, 19 insertions, 22 deletions
diff --git a/sql/key.cc b/sql/key.cc index bf50094a9e4..9dbb7a15726 100644 --- a/sql/key.cc +++ b/sql/key.cc @@ -1,5 +1,5 @@ /* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. - Copyright (c) 2018, MariaDB + Copyright (c) 2018, 2020, MariaDB This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -159,7 +159,7 @@ void key_copy(uchar *to_key, const uchar *from_record, KEY *key_info, CHARSET_INFO *cs= field->charset(); uint bytes= field->get_key_image(to_key, length, Field::itRAW); if (bytes < length) - cs->cset->fill(cs, (char*) to_key + bytes, length - bytes, ' '); + cs->fill((char*) to_key + bytes, length - bytes, ' '); } } } @@ -324,12 +324,10 @@ bool key_cmp_if_same(TABLE *table,const uchar *key,uint idx,uint key_length) const uchar *pos= table->record[0] + key_part->offset; if (length > char_length) { - char_length= my_charpos(cs, pos, pos + length, char_length); + char_length= cs->charpos(pos, pos + length, char_length); set_if_smaller(char_length, length); } - if (cs->coll->strnncollsp(cs, - (const uchar*) key, length, - (const uchar*) pos, char_length)) + if (cs->strnncollsp(key, length, pos, char_length)) return 1; continue; } @@ -387,9 +385,9 @@ void field_unpack(String *to, Field *field, const uchar *rec, uint max_length, Align, returning not more than "char_length" characters. */ size_t charpos, char_length= max_length / cs->mbmaxlen; - if ((charpos= my_charpos(cs, tmp.ptr(), - tmp.ptr() + tmp.length(), - char_length)) < tmp.length()) + if ((charpos= cs->charpos(tmp.ptr(), + tmp.ptr() + tmp.length(), + char_length)) < tmp.length()) tmp.length(charpos); } if (max_length < field->pack_length()) @@ -757,12 +755,12 @@ ulong key_hashnr(KEY *key_info, uint used_key_parts, const uchar *key) { if (cs->mbmaxlen > 1) { - size_t char_length= my_charpos(cs, pos + pack_length, - pos + pack_length + length, - length / cs->mbmaxlen); + size_t char_length= cs->charpos(pos + pack_length, + pos + pack_length + length, + length / cs->mbmaxlen); set_if_smaller(length, char_length); } - cs->coll->hash_sort(cs, pos+pack_length, length, &nr, &nr2); + cs->hash_sort(pos+pack_length, length, &nr, &nr2); key+= pack_length; } else @@ -871,19 +869,18 @@ bool key_buf_cmp(KEY *key_info, uint used_key_parts, size_t byte_len1= length1, byte_len2= length2; if (cs->mbmaxlen > 1) { - size_t char_length1= my_charpos(cs, pos1 + pack_length, - pos1 + pack_length + length1, - length1 / cs->mbmaxlen); - size_t char_length2= my_charpos(cs, pos2 + pack_length, - pos2 + pack_length + length2, - length2 / cs->mbmaxlen); + size_t char_length1= cs->charpos(pos1 + pack_length, + pos1 + pack_length + length1, + length1 / cs->mbmaxlen); + size_t char_length2= cs->charpos(pos2 + pack_length, + pos2 + pack_length + length2, + length2 / cs->mbmaxlen); set_if_smaller(length1, char_length1); set_if_smaller(length2, char_length2); } if (length1 != length2 || - cs->coll->strnncollsp(cs, - pos1 + pack_length, byte_len1, - pos2 + pack_length, byte_len2)) + cs->strnncollsp(pos1 + pack_length, byte_len1, + pos2 + pack_length, byte_len2)) return TRUE; key1+= pack_length; key2+= pack_length; } |