diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2020-07-02 09:41:44 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2020-07-02 09:41:44 +0300 |
commit | 1813d92d0c505a1c752f4a9d6e37db6bffe4efdd (patch) | |
tree | f570314890197949ae55cbbad3a94eb5893c4177 /sql/field.cc | |
parent | 0fe97c20b341665058491fca4d665207406775c6 (diff) | |
parent | f347b3e0e6592329b1447fa460aca0a4b1f680b1 (diff) | |
download | mariadb-git-1813d92d0c505a1c752f4a9d6e37db6bffe4efdd.tar.gz |
Merge 10.4 into 10.5
Diffstat (limited to 'sql/field.cc')
-rw-r--r-- | sql/field.cc | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/sql/field.cc b/sql/field.cc index 8e8ed7df0cb..9b6f117a82e 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -11107,6 +11107,46 @@ void Field_blob::print_key_value(String *out, uint32 length) } +/* + @brief Print value of the key part + + @param + out Output string + key value of the key + length Length of field in bytes, + excluding NULL flag and length bytes +*/ + + +void +Field::print_key_part_value(String *out, const uchar* key, uint32 length) +{ + StringBuffer<128> tmp(system_charset_info); + uint null_byte= 0; + if (real_maybe_null()) + { + /* + Byte 0 of key is the null-byte. If set, key is NULL. + Otherwise, print the key value starting immediately after the + null-byte + */ + if (*key) + { + out->append(STRING_WITH_LEN("NULL")); + return; + } + null_byte++; // Skip null byte + } + + set_key_image(key + null_byte, length); + print_key_value(&tmp, length); + if (charset() == &my_charset_bin) + out->append(tmp.ptr(), tmp.length(), tmp.charset()); + else + tmp.print(out, system_charset_info); +} + + void Field::print_key_value_binary(String *out, const uchar* key, uint32 length) { out->append_semi_hex((const char*)key, length, charset()); |