|
Home > Archive > MySQL ODBC Connector > January 2006 > default characterset of function string parameter
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
default characterset of function string parameter
|
|
| Hirofumi Fujiwara 2006-01-29, 3:23 am |
| Dear MySQL fans,
I am checking MySQL 5.0 to use multibyte strings, Japanese.
When I use char type parameter without CHARACTER SET clause,
parameter's character set is not the database character set but
latin1.
17.2.1. CREATE PROCEDURE says:
For character data types, if there is a CHARACTER SET clause
in the declaration, the specified character set and its default
collation are used. If there is no such clause, the database
character set and collation are used. (These are given by the
values of the character_set_databa
se and collation_database
system variables.)
Following is my test:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
mysql> SET @@character_set_data
base=eucjpms;
Query OK, 0 rows affected (0.00 sec)
mysql> SHOW VARIABLES LIKE 'character\_set\_%';
+--------------------------+---------+
| Variable_name | Value |
+--------------------------+---------+
| character_set_client
| eucjpms |
| character_set_connec
tion | eucjpms |
| character_set_databa
se | eucjpms |
| character_set_result
s | eucjpms |
| character_set_server
| latin1 |
| character_set_system
| utf8 |
+--------------------------+---------+
6 rows in set (0.00 sec)
mysql> DELIMITER //
mysql> CREATE FUNCTION parametercharset( s CHAR(20) )
-> RETURNS CHAR(50) CHARACTER SET binary
-> DETERMINISTIC RETURN CONCAT( s, ':', CHARSET(s) );
-> //
Query OK, 0 rows affected (0.00 sec)
mysql> DELIMITER ;
mysql> SELECT parametercharset('he
llo');
+----------------------------------------------------+
| parametercharset('he
llo') |
+----------------------------------------------------+
| hello:latin1 |
+----------------------------------------------------+
1 row in set (0.00 sec)
mysql>
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
------------------------------------------------------------
Hirofumi Fujiwara (Tokyo JAPAN) enjoy JAVA and Puzzle World
uji@fuji.gr.jp http://www.pro.or.jp/~fuji/index-eng.html
uji@timedia.co.jp 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/mysql? unsub...sie.nctu.edu.tw
| |
| Gleb Paharenko 2006-01-30, 7:23 am |
| Hello.
This seems like a bug:
http://bugs.mysql.com/bug.php?id=16676
Hirofumi Fujiwara wrote:
> Dear MySQL fans,
>
> I am checking MySQL 5.0 to use multibyte strings, Japanese.
>
> When I use char type parameter without CHARACTER SET clause,
> parameter's character set is not the database character set but
> latin1.
>
> 17.2.1. CREATE PROCEDURE says:
> For character data types, if there is a CHARACTER SET clause
> in the declaration, the specified character set and its default
> collation are used. If there is no such clause, the database
> character set and collation are used. (These are given by the
> values of the character_set_databa
se and collation_database
> system variables.)
>
> Following is my test:
>
> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> mysql> SET @@character_set_data
base=eucjpms;
> Query OK, 0 rows affected (0.00 sec)
>
> mysql> SHOW VARIABLES LIKE 'character\_set\_%';
> +--------------------------+---------+
> | Variable_name | Value |
> +--------------------------+---------+
> | character_set_client
| eucjpms |
> | character_set_connec
tion | eucjpms |
> | character_set_databa
se | eucjpms |
> | character_set_result
s | eucjpms |
> | character_set_server
| latin1 |
> | character_set_system
| utf8 |
> +--------------------------+---------+
> 6 rows in set (0.00 sec)
>
> mysql> DELIMITER //
> mysql> CREATE FUNCTION parametercharset( s CHAR(20) )
> -> RETURNS CHAR(50) CHARACTER SET binary
> -> DETERMINISTIC RETURN CONCAT( s, ':', CHARSET(s) );
> -> //
> Query OK, 0 rows affected (0.00 sec)
>
> mysql> DELIMITER ;
> mysql> SELECT parametercharset('he
llo');
> +----------------------------------------------------+
> | parametercharset('he
llo') |
> +----------------------------------------------------+
> | hello:latin1 |
> +----------------------------------------------------+
> 1 row in set (0.00 sec)
>
> mysql>
> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> ------------------------------------------------------------
> Hirofumi Fujiwara (Tokyo JAPAN) enjoy JAVA and Puzzle World
> uji@fuji.gr.jp http://www.pro.or.jp/~fuji/index-eng.html
> uji@timedia.co.jp Puzzle Japan http://www.puzzle.jp/
> ------------------------------------------------------------
> My SUDOKU Probs http://www.pro.or.jp/~fuji/sudoku/problems/
> ------------------------------------------------------------
--
For technical support contracts, goto https://order.mysql.com/?ref=ensita
This email is sponsored by Ensita.NET http://www.ensita.net/
__ ___ ___ ____ __
/ |/ /_ __/ __/ __ \/ / Gleb Paharenko
/ /|_/ / // /\ \/ /_/ / /__ Gleb.Paharenko@stripped
/_/ /_/\_, /___/\___\_\___/ MySQL AB / Ensita.NET
<___/ www.mysql.com
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql? unsub...sie.nctu.edu.tw
|
|
|
|
|