1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-27 18:02:13 +03:00

MDEV-29672 Add MTR tests covering key and key segment flags and types

This commit is contained in:
Alexander Barkov
2022-09-28 18:49:09 +04:00
parent e3fdabd501
commit 1118e979c2
7 changed files with 5257 additions and 1 deletions

View File

@ -348,6 +348,7 @@ public:
}
void qs_append(const char *str, size_t len);
void qs_append_hex(const char *str, uint32 len);
void qs_append_hex_uint32(uint32 num);
void qs_append(double d);
void qs_append(double *d);
inline void qs_append(const char c)
@ -571,7 +572,13 @@ public:
}
return false;
}
bool append_hex_uint32(uint32 num)
{
if (reserve(8))
return true;
qs_append_hex_uint32(num);
return false;
}
bool append_with_step(const char *s, uint32 arg_length, uint32 step_alloc)
{
uint32 new_length= arg_length + str_length;
@ -916,6 +923,17 @@ public:
{
return append(&ls);
}
bool append_name_value(const LEX_CSTRING &name,
const LEX_CSTRING &value,
uchar quot= '\0')
{
return
append(name) ||
append('=') ||
(quot && append(quot)) ||
append(value) ||
(quot && append(quot));
}
bool append(const char *s, size_t size);
bool append_with_prefill(const char *s, uint32 arg_length,
uint32 full_length, char fill_char);
@ -928,6 +946,37 @@ public:
return append(s.str, s.length, cs);
}
/*
Append a bitmask in an uint32 with a translation into a
C-style human readable representation, e.g.:
0x05 -> "(flag04|flag01)"
@param flags - the flags to translate
@param names - an array of flag names
@param count - the number of available elements in "names"
*/
bool append_flag32_names(uint32 flags, const char *names[], size_t count)
{
bool added= false;
if (flags && append('('))
return true;
for (ulong i= 0; i <= 31; i++)
{
ulong bit= 31 - i;
if (flags & (1 << bit))
{
if (added && append('|'))
return true;
if (append(bit < count ? names[bit] : "?"))
return true;
added= true;
}
}
if (flags && append(')'))
return true;
return false;
}
void strip_sp();
friend int sortcmp(const String *a,const String *b, CHARSET_INFO *cs);
friend int stringcmp(const String *a,const String *b);