summaryrefslogtreecommitdiff
path: root/sql/key.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/key.cc')
-rw-r--r--sql/key.cc22
1 files changed, 12 insertions, 10 deletions
diff --git a/sql/key.cc b/sql/key.cc
index 08bd6e8f65d..34196a973c5 100644
--- a/sql/key.cc
+++ b/sql/key.cc
@@ -17,7 +17,7 @@
/* Functions to handle keys and fields in forms */
-#include <my_global.h>
+#include "mariadb.h"
#include "sql_priv.h"
#include "key.h" // key_rec_cmp
#include "field.h" // Field
@@ -112,7 +112,7 @@ int find_ref_key(KEY *key, uint key_count, uchar *record, Field *field,
@param with_zerofill skipped bytes in the key buffer to be filled with 0
*/
-void key_copy(uchar *to_key, uchar *from_record, KEY *key_info,
+void key_copy(uchar *to_key, const uchar *from_record, KEY *key_info,
uint key_length, bool with_zerofill)
{
uint length;
@@ -319,7 +319,7 @@ bool key_cmp_if_same(TABLE *table,const uchar *key,uint idx,uint key_length)
FIELDFLAG_PACK)))
{
CHARSET_INFO *cs= key_part->field->charset();
- uint char_length= key_part->length / cs->mbmaxlen;
+ size_t char_length= key_part->length / cs->mbmaxlen;
const uchar *pos= table->record[0] + key_part->offset;
if (length > char_length)
{
@@ -385,7 +385,7 @@ void field_unpack(String *to, Field *field, const uchar *rec, uint max_length,
which can break a multi-byte characters in the middle.
Align, returning not more than "char_length" characters.
*/
- uint charpos, char_length= max_length / cs->mbmaxlen;
+ size_t charpos, char_length= max_length / cs->mbmaxlen;
if ((charpos= my_charpos(cs, tmp.ptr(),
tmp.ptr() + tmp.length(),
char_length)) < tmp.length())
@@ -427,6 +427,8 @@ void key_unpack(String *to, TABLE *table, KEY *key)
key_part < key_part_end;
key_part++)
{
+ if (key_part->field->invisible > INVISIBLE_USER)
+ continue;
if (to->length())
to->append('-');
if (key_part->null_bit)
@@ -697,7 +699,7 @@ ulong key_hashnr(KEY *key_info, uint used_key_parts, const uchar *key)
{
uchar *pos= (uchar*)key;
CHARSET_INFO *UNINIT_VAR(cs);
- uint UNINIT_VAR(length), UNINIT_VAR(pack_length);
+ size_t UNINIT_VAR(length), UNINIT_VAR(pack_length);
bool is_string= TRUE;
key+= key_part->length;
@@ -754,7 +756,7 @@ ulong key_hashnr(KEY *key_info, uint used_key_parts, const uchar *key)
{
if (cs->mbmaxlen > 1)
{
- uint char_length= my_charpos(cs, pos + pack_length,
+ size_t char_length= my_charpos(cs, pos + pack_length,
pos + pack_length + length,
length / cs->mbmaxlen);
set_if_smaller(length, char_length);
@@ -801,7 +803,7 @@ bool key_buf_cmp(KEY *key_info, uint used_key_parts,
uchar *pos1= (uchar*)key1;
uchar *pos2= (uchar*)key2;
CHARSET_INFO *UNINIT_VAR(cs);
- uint UNINIT_VAR(length1), UNINIT_VAR(length2), UNINIT_VAR(pack_length);
+ size_t UNINIT_VAR(length1), UNINIT_VAR(length2), UNINIT_VAR(pack_length);
bool is_string= TRUE;
key1+= key_part->length;
@@ -865,13 +867,13 @@ bool key_buf_cmp(KEY *key_info, uint used_key_parts,
Compare the strings taking into account length in characters
and collation
*/
- uint byte_len1= length1, byte_len2= length2;
+ size_t byte_len1= length1, byte_len2= length2;
if (cs->mbmaxlen > 1)
{
- uint char_length1= my_charpos(cs, pos1 + pack_length,
+ size_t char_length1= my_charpos(cs, pos1 + pack_length,
pos1 + pack_length + length1,
length1 / cs->mbmaxlen);
- uint char_length2= my_charpos(cs, pos2 + pack_length,
+ size_t char_length2= my_charpos(cs, pos2 + pack_length,
pos2 + pack_length + length2,
length2 / cs->mbmaxlen);
set_if_smaller(length1, char_length1);