diff options
author | Sergei Golubchik <serg@mariadb.org> | 2018-01-22 20:10:57 +0100 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2018-01-22 20:26:34 +0100 |
commit | ea78c5744b958ddcd6946faf5ca24f115275a366 (patch) | |
tree | a9e5fdc307131112c1d9f2d9db348f37680e935a | |
parent | 431607237d0d1438cdc69f5bf5a188253d7549cf (diff) | |
download | mariadb-git-ea78c5744b958ddcd6946faf5ca24f115275a366.tar.gz |
MDEV-13988 connect.drop-open-error fails
PCOLRES::Length is the length in characters, not in bytes
(because it's printed as length in "VARCHAR(N)").
So convert it into characters using cs->mbmaxlen.
-rw-r--r-- | storage/connect/myconn.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/storage/connect/myconn.cpp b/storage/connect/myconn.cpp index 08bb24e14df..fe00f6a1eab 100644 --- a/storage/connect/myconn.cpp +++ b/storage/connect/myconn.cpp @@ -933,8 +933,9 @@ PQRYRES MYSQLC::GetResult(PGLOBAL g, bool pdb) crp->Prec = (crp->Type == TYPE_DOUBLE || crp->Type == TYPE_DECIM) ? fld->decimals : 0; - crp->Length = MY_MAX(fld->length, fld->max_length); - crp->Clen = GetTypeSize(crp->Type, crp->Length); + CHARSET_INFO *cs= get_charset(fld->charsetnr, MYF(0)); + crp->Clen = GetTypeSize(crp->Type, fld->length); + crp->Length = fld->length / (cs ? cs->mbmaxlen : 1); uns = (fld->flags & (UNSIGNED_FLAG | ZEROFILL_FLAG)) ? true : false; if (!(crp->Kdata = AllocValBlock(g, NULL, crp->Type, m_Rows, |