[Commits] Rev 3495: Fix of column_get name charset conversion. in file:///home/bell/maria/bzr/work-maria-5.5-dnames/

sanja at montyprogram.com sanja at montyprogram.com
Tue Aug 21 11:20:15 EEST 2012


At file:///home/bell/maria/bzr/work-maria-5.5-dnames/

------------------------------------------------------------
revno: 3495
revision-id: sanja at montyprogram.com-20120821082012-hnemm4bwfg60l6ah
parent: sanja at montyprogram.com-20120821075836-mb2o3dca1lly0nav
committer: sanja at montyprogram.com
branch nick: work-maria-5.5-dnames
timestamp: Tue 2012-08-21 11:20:12 +0300
message:
  Fix of column_get name charset conversion.
-------------- next part --------------
=== modified file 'mysql-test/r/dyncol_koi8.result'
--- a/mysql-test/r/dyncol_koi8.result	2012-08-21 07:30:06 +0000
+++ b/mysql-test/r/dyncol_koi8.result	2012-08-21 08:20:12 +0000
@@ -12,4 +12,7 @@ hex(column_create("????????", 1212))
 select column_exists(column_create('???','value'),'???');
 column_exists(column_create('???','value'),'???')
 1
+select column_get(column_create('???','value'),'???' as char);
+column_get(column_create('???','value'),'???' as char)
+value
 set names default;

=== modified file 'mysql-test/t/dyncol_koi8.test'
--- a/mysql-test/t/dyncol_koi8.test	2012-08-21 07:30:06 +0000
+++ b/mysql-test/t/dyncol_koi8.test	2012-08-21 08:20:12 +0000
@@ -10,4 +10,5 @@ select hex(column_create("????????", 121
 --echo # MDEV-461: DNAMES: column names do not work with non-trivial encodings
 --echo #
 select column_exists(column_create('???','value'),'???');
+select column_get(column_create('???','value'),'???' as char);
 set names default;

=== modified file 'sql/item_strfunc.cc'
--- a/sql/item_strfunc.cc	2012-08-20 14:10:22 +0000
+++ b/sql/item_strfunc.cc	2012-08-21 08:20:12 +0000
@@ -4169,8 +4169,27 @@ bool Item_dyncol_get::get_dyn_value(DYNA
   else
   {
     String *nm= args[1]->val_str(&nmbuf);
-    buf.str= (char *) nm->ptr();
-    buf.length= nm->length();
+    if (my_charset_same(nm->charset(), &my_charset_utf8_general_ci))
+    {
+      buf.str= (char *) nm->ptr();
+      buf.length= nm->length();
+    }
+    else
+    {
+      uint strlen;
+      uint dummy_errors;
+      buf.str= (char *)sql_alloc((strlen= nm->length() *
+                                     my_charset_utf8_general_ci.mbmaxlen + 1));
+      if (buf.str)
+      {
+        buf.length=
+          copy_and_convert(buf.str, strlen, &my_charset_utf8_general_ci,
+                           nm->ptr(), nm->length(), nm->charset(),
+                           &dummy_errors);
+      }
+      else
+        buf.length= 0;
+    }
     name= &buf;
   }
 



More information about the commits mailing list