Hi,
Is there any difference between _binary'Binary' and CONVERT('Binary' USING
binary)
mysql> SELECT CHARSET(CONCAT(_binary'Bianry',CONVERT('abc' USING latin1)));
+--------------------------------------------------------------+
| CHARSET(CONCAT(_binary'Bianry',CONVERT('abc' USING latin1))) |
+--------------------------------------------------------------+
| latin1 |
+--------------------------------------------------------------+
1 row in set (0.00 sec)
mysql> SELECT CHARSET(CONCAT(CONVERT('Bianry' USING binary),CONVERT('abc' USING
latin1)));
+-----------------------------------------------------------------------------+
| CHARSET(CONCAT(CONVERT('Bianry' USING binary),CONVERT('abc' USING latin1))) |
+-----------------------------------------------------------------------------+
| binary |
+-----------------------------------------------------------------------------+
1 row in set (0.00 sec)
In Japan, we have to use many kinds of character set.
eucjpms,ujis for unix
cp932,sjis for Windows
utf8 for Java, MySQL meta data
So, it's a very complicated world.
> Hi there,
>
> I tried a few other queries:
>
> first, confirm that what you think is a binary is indeed a binary:
>
> mysql> SELECT CHARSET(_binary'Binary');
> +--------------------------+
> | CHARSET(_binary'Binary') |
> +--------------------------+
> | binary |
> +--------------------------+
> 1 row in set (0.00 sec)
>
> check the regular text (for completeness' sake)
>
> mysql> select charset ('binary');
> +--------------------+
> | charset ('binary') |
> +--------------------+
> | latin1 |
> +--------------------+
> 1 row in set (0.00 sec)
>
> OK, so concatenating the 2 should result in a binary according to the manual:
>
> mysql> SELECT CHARSET(CONCAT(_binary'Bianry',CONVERT('abc' USING latin1)));
> +--------------------------------------------------------------+
> | CHARSET(CONCAT(_binary'Bianry',CONVERT('abc' USING latin1))) |
> +--------------------------------------------------------------+
> | latin1 |
> +--------------------------------------------------------------+
> 1 row in set (0.00 sec)
>
> Hrm, I got the same result you did.
>
> However,
>
> mysql> SELECT CHARSET(CONCAT(_binary'Binary','foo'));
> +------------------------------------------+
> | CHARSET(CONCAT((_binary'Binary'),'foo')) |
> +------------------------------------------+
> | binary |
> +------------------------------------------+
> 1 row in set (0.00 sec)
>
> works just fine. Why are you converting the text to latin1? It's
> already there. That conversion seems to be messing things up.
>
> Perhaps someone can explain why the conversion messes things up --
> seems like a bug to me.
>
> -Sheeri
>
> On 2/26/06, Hirofumi Fujiwara <[EMAIL PROTECTED]> wrote:
> > Dear MySQL fans,
> >
> > I tested CONCAT() with binary strings and I got strange result.
> >
> > Manual says:
> > http://dev.mysql.com/doc/refman/5.0/en/string-functions.html
> >
> > If the arguments include any binary strings, the result is a binary
> > string.
> >
> > But the following test says:
> >
> > bianry + latin1 ----> latin1 (not bianry)
> >
> > mysql> SELECT CHARSET(CONCAT(_binary'Bianry',CONVERT('abc' USING latin1)));
> > +--------------------------------------------------------------+
> > | CHARSET(CONCAT(_binary'Bianry',CONVERT('abc' USING latin1))) |
> > +--------------------------------------------------------------+
> > | latin1 |
> > +--------------------------------------------------------------+
> > 1 row in set (0.00 sec)
> >
> > ------------------------------------------------------------
> > Hirofumi Fujiwara (Tokyo JAPAN) enjoy JAVA and Puzzle World
> > [EMAIL PROTECTED] http://www.pro.or.jp/~fuji/index-eng.html
> > [EMAIL PROTECTED] Puzzle Japan http://www.puzzle.jp/
> > ------------------------------------------------------------
> > My SUDOKU Probs http://www.pro.or.jp/~fuji/sudoku/problems/
> > ------------------------------------------------------------
> >
> > --
> > MySQL General Mailing List
> > For list archives: http://lists.mysql.com/mysql
> > To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]
> >
> >
>
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]