mirror of
https://github.com/MariaDB/server.git
synced 2026-01-06 05:22:24 +03:00
Merge 10.4 into 10.5
This commit is contained in:
45
sql/field.cc
45
sql/field.cc
@@ -7314,6 +7314,28 @@ void Field_string::sql_type(String &res) const
|
||||
res.append(STRING_WITH_LEN(" binary"));
|
||||
}
|
||||
|
||||
/**
|
||||
For fields which are associated with character sets their length is provided
|
||||
in octets and their character set information is also provided as part of
|
||||
type information.
|
||||
|
||||
@param res String which contains filed type and length.
|
||||
*/
|
||||
void Field_string::sql_rpl_type(String *res) const
|
||||
{
|
||||
CHARSET_INFO *cs=charset();
|
||||
if (Field_string::has_charset())
|
||||
{
|
||||
size_t length= cs->cset->snprintf(cs, (char*) res->ptr(),
|
||||
res->alloced_length(),
|
||||
"char(%u octets) character set %s",
|
||||
field_length,
|
||||
charset()->csname);
|
||||
res->length(length);
|
||||
}
|
||||
else
|
||||
Field_string::sql_type(*res);
|
||||
}
|
||||
|
||||
uchar *Field_string::pack(uchar *to, const uchar *from, uint max_length)
|
||||
{
|
||||
@@ -7754,6 +7776,29 @@ void Field_varstring::sql_type(String &res) const
|
||||
res.append(STRING_WITH_LEN(" binary"));
|
||||
}
|
||||
|
||||
/**
|
||||
For fields which are associated with character sets their length is provided
|
||||
in octets and their character set information is also provided as part of
|
||||
type information.
|
||||
|
||||
@param res String which contains filed type and length.
|
||||
*/
|
||||
void Field_varstring::sql_rpl_type(String *res) const
|
||||
{
|
||||
CHARSET_INFO *cs=charset();
|
||||
if (Field_varstring::has_charset())
|
||||
{
|
||||
size_t length= cs->cset->snprintf(cs, (char*) res->ptr(),
|
||||
res->alloced_length(),
|
||||
"varchar(%u octets) character set %s",
|
||||
field_length,
|
||||
charset()->csname);
|
||||
res->length(length);
|
||||
}
|
||||
else
|
||||
Field_varstring::sql_type(*res);
|
||||
}
|
||||
|
||||
|
||||
uint32 Field_varstring::data_length()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user