summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <bar@mysql.com>2004-12-08 14:03:29 +0400
committerunknown <bar@mysql.com>2004-12-08 14:03:29 +0400
commit22b16624d5170bd6cc985be7476dc58e5e721b07 (patch)
treeca5568204a0fa35f07cbdb731b7b3fddac3614d2 /sql
parent3a994c8a731b4c1cb15226eea2702cbebc12041f (diff)
downloadmariadb-git-22b16624d5170bd6cc985be7476dc58e5e721b07.tar.gz
- VARCHAR(n) with binary character set is now displayed as VARBINARY(N).
- CREATE TABLE t1 SELECT BINARY 'literal' now creates a VARBINARY() column, not a BINARY().
Diffstat (limited to 'sql')
-rw-r--r--sql/field.cc13
1 files changed, 10 insertions, 3 deletions
diff --git a/sql/field.cc b/sql/field.cc
index 73f442a868e..dafb3dc25da 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -4778,11 +4778,18 @@ void Field_varstring::sort_string(char *to,uint length)
void Field_varstring::sql_type(String &res) const
{
+ THD *thd= table->in_use;
CHARSET_INFO *cs=res.charset();
- ulong length= cs->cset->snprintf(cs,(char*) res.ptr(),
- res.alloced_length(),"varchar(%u)",
- field_length / charset()->mbmaxlen);
+ ulong length;
+
+ length= cs->cset->snprintf(cs,(char*) res.ptr(),
+ res.alloced_length(), "%s(%d)",
+ (has_charset() ? "varchar" : "varbinary"),
+ (int) field_length / charset()->mbmaxlen);
res.length(length);
+ if ((thd->variables.sql_mode & (MODE_MYSQL323 | MODE_MYSQL40)) &&
+ has_charset() && (charset()->state & MY_CS_BINSORT))
+ res.append(" binary");
}