summaryrefslogtreecommitdiff
path: root/sql/field.cc
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2019-09-06 14:25:20 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2019-09-06 14:25:20 +0300
commit780d2bb8a7eca4fdbdf70fbd51c0bdbae5b0057e (patch)
treeb7447115f45de0f03bbe18c26fc0866367483066 /sql/field.cc
parentdb9e41ddc31f2e705a54132cf69c781e1cc60f07 (diff)
parent18af13b88ba580562981a190c25da128a2e9db26 (diff)
downloadmariadb-git-780d2bb8a7eca4fdbdf70fbd51c0bdbae5b0057e.tar.gz
Merge 10.4 into 10.5
Diffstat (limited to 'sql/field.cc')
-rw-r--r--sql/field.cc45
1 files changed, 45 insertions, 0 deletions
diff --git a/sql/field.cc b/sql/field.cc
index dbd9a30b244..be97ceeb227 100644
--- a/sql/field.cc
+++ b/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()
{