mirror of
https://github.com/MariaDB/server.git
synced 2025-01-17 12:32:27 +01:00
Merge paul@bk-internal.mysql.com:/home/bk/mysql-4.1
into teton.kitebird.com:/home/paul/mysql-4.1
This commit is contained in:
commit
12ba773bb9
32 changed files with 926 additions and 48 deletions
|
@ -15,6 +15,7 @@ arjen@george.bitbike.com
|
|||
bar@bar.intranet.mysql.r18.ru
|
||||
bar@bar.mysql.r18.ru
|
||||
bar@bar.udmsearch.izhnet.ru
|
||||
bar@deer.(none)
|
||||
bar@gw.udmsearch.izhnet.ru
|
||||
bell@laptop.sanja.is.com.ua
|
||||
bell@sanja.is.com.ua
|
||||
|
|
|
@ -227,11 +227,12 @@ typedef struct {
|
|||
} COMMANDS;
|
||||
|
||||
static COMMANDS commands[] = {
|
||||
{ "help", 'h', com_help, 1, "Display this help." },
|
||||
{ "?", '?', com_help, 1, "Synonym for `help'." },
|
||||
{ "clear", 'c', com_clear, 0, "Clear command."},
|
||||
{ "connect",'r', com_connect,1,
|
||||
"Reconnect to the server. Optional arguments are db and host." },
|
||||
{ "delimiter", 'd', com_delimiter, 1,
|
||||
"Set query delimiter. " },
|
||||
#ifdef USE_POPEN
|
||||
{ "edit", 'e', com_edit, 0, "Edit command with $EDITOR."},
|
||||
#endif
|
||||
|
@ -239,6 +240,7 @@ static COMMANDS commands[] = {
|
|||
"Send command to mysql server, display result vertically."},
|
||||
{ "exit", 'q', com_quit, 0, "Exit mysql. Same as quit."},
|
||||
{ "go", 'g', com_go, 0, "Send command to mysql server." },
|
||||
{ "help", 'h', com_help, 1, "Display this help." },
|
||||
#ifdef USE_POPEN
|
||||
{ "nopager",'n', com_nopager,0, "Disable pager, print to stdout." },
|
||||
#endif
|
||||
|
@ -261,8 +263,6 @@ static COMMANDS commands[] = {
|
|||
"Set outfile [to_outfile]. Append everything into given outfile." },
|
||||
{ "use", 'u', com_use, 1,
|
||||
"Use another database. Takes database name as argument." },
|
||||
{ "delimiter", 'd', com_delimiter, 1,
|
||||
"Set query delimiter. " },
|
||||
/* Get bash-like expansion for some commands */
|
||||
{ "create table", 0, 0, 0, ""},
|
||||
{ "create database", 0, 0, 0, ""},
|
||||
|
@ -1577,8 +1577,8 @@ static int
|
|||
com_help(String *buffer __attribute__((unused)),
|
||||
char *line __attribute__((unused)))
|
||||
{
|
||||
reg1 int i;
|
||||
char * help_arg= strchr(line,' ');
|
||||
reg1 int i, j;
|
||||
char * help_arg= strchr(line,' '), buff[32], *end;
|
||||
|
||||
if (help_arg)
|
||||
return com_server_help(buffer,line,help_arg+1);
|
||||
|
@ -1591,8 +1591,11 @@ com_help(String *buffer __attribute__((unused)),
|
|||
put_info("Note that all text commands must be first on line and end with ';'",INFO_INFO);
|
||||
for (i = 0; commands[i].name; i++)
|
||||
{
|
||||
end= strmov(buff, commands[i].name);
|
||||
for (j= strlen(commands[i].name); j < 10; j++)
|
||||
end= strmov(end, " ");
|
||||
if (commands[i].func)
|
||||
tee_fprintf(stdout, "%s\t(\\%c)\t%s\n", commands[i].name,
|
||||
tee_fprintf(stdout, "%s(\\%c) %s\n", buff,
|
||||
commands[i].cmd_char, commands[i].doc);
|
||||
}
|
||||
if (connected && mysql_get_server_version(&mysql) >= 40100)
|
||||
|
|
|
@ -15,6 +15,8 @@ Created 9/20/1997 Heikki Tuuri
|
|||
#include "hash0hash.h"
|
||||
#include "log0log.h"
|
||||
|
||||
extern ibool recv_replay_file_ops;
|
||||
|
||||
/***********************************************************************
|
||||
Reads the checkpoint info needed in hot backup. */
|
||||
|
||||
|
|
|
@ -34,6 +34,11 @@ Created 9/20/1997 Heikki Tuuri
|
|||
#include "dict0boot.h"
|
||||
#include "fil0fil.h"
|
||||
|
||||
/* This is set to FALSE if the backup was originally taken with the
|
||||
ibbackup --include regexp option: then we do not want to create tables in
|
||||
directories which were not included */
|
||||
ibool recv_replay_file_ops = TRUE;
|
||||
|
||||
/* Log records are stored in the hash table in chunks at most of this size;
|
||||
this must be less than UNIV_PAGE_SIZE as it is stored in the buffer pool */
|
||||
#define RECV_DATA_BLOCK_SIZE (MEM_MAX_ALLOC_IN_BUF - sizeof(recv_data_t))
|
||||
|
@ -1974,18 +1979,21 @@ loop:
|
|||
|| type == MLOG_FILE_RENAME
|
||||
|| type == MLOG_FILE_DELETE)) {
|
||||
#ifdef UNIV_HOTBACKUP
|
||||
/* In ibbackup --apply-log, replay an .ibd file
|
||||
operation, if possible; note that
|
||||
fil_path_to_mysql_datadir is set in ibbackup to
|
||||
point to the datadir we should use there */
|
||||
if (recv_replay_file_ops) {
|
||||
|
||||
/* In ibbackup --apply-log, replay an .ibd file
|
||||
operation, if possible; note that
|
||||
fil_path_to_mysql_datadir is set in ibbackup to
|
||||
point to the datadir we should use there */
|
||||
|
||||
if (NULL == fil_op_log_parse_or_replay(body, end_ptr,
|
||||
type, TRUE, space)) {
|
||||
fprintf(stderr,
|
||||
if (NULL == fil_op_log_parse_or_replay(body,
|
||||
end_ptr, type, TRUE, space)) {
|
||||
fprintf(stderr,
|
||||
"InnoDB: Error: file op log record of type %lu space %lu not complete in\n"
|
||||
"InnoDB: the replay phase. Path %s\n", (ulint)type, space, (char*)(body + 2));
|
||||
|
||||
ut_a(0);
|
||||
ut_a(0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
/* In normal mysqld crash recovery we do not try to
|
||||
|
|
|
@ -534,6 +534,8 @@ row_purge_parse_undo_rec(
|
|||
|
||||
node->table = NULL;
|
||||
|
||||
row_mysql_unfreeze_data_dictionary(trx);
|
||||
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
|
|
|
@ -81,28 +81,6 @@ static void end_server(MYSQL *mysql)
|
|||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
** Connect to sql server
|
||||
** If host == 0 then use localhost
|
||||
**************************************************************************/
|
||||
|
||||
MYSQL * STDCALL
|
||||
mysql_connect(MYSQL *mysql,const char *host,
|
||||
const char *user, const char *passwd)
|
||||
{
|
||||
MYSQL *res;
|
||||
mysql=mysql_init(mysql); /* Make it thread safe */
|
||||
{
|
||||
DBUG_ENTER("mysql_connect");
|
||||
if (!(res=mysql_real_connect(mysql,host,user,passwd,NullS,0,NullS,0)))
|
||||
{
|
||||
if (mysql->free_me)
|
||||
my_free((gptr) mysql,MYF(0));
|
||||
}
|
||||
DBUG_RETURN(res);
|
||||
}
|
||||
}
|
||||
|
||||
static inline int mysql_init_charset(MYSQL *mysql)
|
||||
{
|
||||
char charset_name_buff[16], *charset_name;
|
||||
|
|
4
mysql-test/include/have_big5.inc
Normal file
4
mysql-test/include/have_big5.inc
Normal file
|
@ -0,0 +1,4 @@
|
|||
-- require r/have_big5.require
|
||||
disable_query_log;
|
||||
show collation like "big5_chinese_ci";
|
||||
enable_query_log;
|
4
mysql-test/include/have_tis620.inc
Normal file
4
mysql-test/include/have_tis620.inc
Normal file
|
@ -0,0 +1,4 @@
|
|||
-- require r/have_tis620.require
|
||||
disable_query_log;
|
||||
show collation like "tis620_thai_ci";
|
||||
enable_query_log;
|
|
@ -66,7 +66,7 @@ if [ x$BINARY_DIST = x1 ] ; then
|
|||
basedir=..
|
||||
else
|
||||
basedir=.
|
||||
EXTRA_ARG="--language=../sql/share/english/"
|
||||
EXTRA_ARG="--language=../sql/share/english/ --character-sets-dir=../sql/share/charsets/"
|
||||
fi
|
||||
|
||||
mysqld_boot=" $execdir/mysqld --no-defaults --bootstrap --skip-grant-tables \
|
||||
|
|
|
@ -101,6 +101,21 @@ t1 CREATE TABLE `t1` (
|
|||
`c5` char(2) character set utf8 NOT NULL default ''
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table t1;
|
||||
create table t1 (a binary(10), b char(10) character set koi8r);
|
||||
insert into t1 values (_binary'ÔÅÓÔ',_binary'ÔÅÓÔ');
|
||||
select a,b,cast(a as char character set cp1251),cast(b as binary) from t1;
|
||||
a b cast(a as char character set cp1251) cast(b as binary)
|
||||
ÔÅÓÔ ÔÅÓÔ ÔÅÓÔ ÔÅÓÔ
|
||||
set names koi8r;
|
||||
select a,b,cast(a as char character set cp1251),cast(b as binary) from t1;
|
||||
a b cast(a as char character set cp1251) cast(b as binary)
|
||||
ÔÅÓÔ ÔÅÓÔ æåõæ ÔÅÓÔ
|
||||
set names cp1251;
|
||||
select a,b,cast(a as char character set cp1251),cast(b as binary) from t1;
|
||||
a b cast(a as char character set cp1251) cast(b as binary)
|
||||
ÔÅÓÔ òåñò ÔÅÓÔ ÔÅÓÔ
|
||||
drop table t1;
|
||||
set names binary;
|
||||
select cast("2001-1-1" as date) = "2001-01-01";
|
||||
cast("2001-1-1" as date) = "2001-01-01"
|
||||
1
|
||||
|
|
10
mysql-test/r/ctype_big5.result
Normal file
10
mysql-test/r/ctype_big5.result
Normal file
|
@ -0,0 +1,10 @@
|
|||
drop table if exists t1;
|
||||
SET NAMES big5;
|
||||
CREATE TABLE t1 (c CHAR(10) CHARACTER SET big5, KEY(c));
|
||||
INSERT INTO t1 VALUES ('aaa'),('aaaa'),('aaaaa');
|
||||
SELECT * FROM t1 WHERE c LIKE 'aaa%';
|
||||
c
|
||||
aaa
|
||||
aaaa
|
||||
aaaaa
|
||||
DROP TABLE t1;
|
113
mysql-test/r/ctype_tis620.result
Normal file
113
mysql-test/r/ctype_tis620.result
Normal file
|
@ -0,0 +1,113 @@
|
|||
drop table if exists t1;
|
||||
SET @pl0= _tis620 0x000102030405060708090A0B0C0D0E0F;
|
||||
SET @pl1= _tis620 0x101112131415161718191A1B1C1D1E1F;
|
||||
SET @pl2= _tis620 0x202122232425262728292A2B2C2D2E2F;
|
||||
SET @pl3= _tis620 0x303132333435363738393A3B3C3D3E3F;
|
||||
SET @pl4= _tis620 0x404142434445464748494A4B4C4D4E4F;
|
||||
SET @pl5= _tis620 0x505152535455565758595A5B5C5D5E5F;
|
||||
SET @pl6= _tis620 0x606162636465666768696A6B6C6D6E6F;
|
||||
SET @pl7= _tis620 0x707172737475767778797A7B7C7D7E7F;
|
||||
SET @pl8= _tis620 0x808182838485868788898A8B8C8D8E8F;
|
||||
SET @pl9= _tis620 0x909192939495969798999A9B9C9D9E9F;
|
||||
SET @plA= _tis620 0xA0A1A2A3A4A5A6A7A8A9AAABACADAEAF;
|
||||
SET @plB= _tis620 0xB0B1B2B3B4B5B6B7B8B9BABBBCBDBEBF;
|
||||
SET @plC= _tis620 0xC0C1C2C3C4C5C6C7C8C9CACBCCCDCECF;
|
||||
SET @plD= _tis620 0xD0D1D2D3D4D5D6D7D8D9DADBDCDDDEDF;
|
||||
SET @plE= _tis620 0xE0E1E2E3E4E5E6E7E8E9EAEBECEDEEEF;
|
||||
SET @plF= _tis620 0xF0F1F2F3F4F5F6F7F8F9FAFBFCFDFEFF;
|
||||
SELECT hex(@u0:=convert(@pl0 using utf8));
|
||||
hex(@u0:=convert(@pl0 using utf8))
|
||||
000102030405060708090A0B0C0D0E0F
|
||||
SELECT hex(@u1:=convert(@pl1 using utf8));
|
||||
hex(@u1:=convert(@pl1 using utf8))
|
||||
101112131415161718191A1B1C1D1E1F
|
||||
SELECT hex(@u2:=convert(@pl2 using utf8));
|
||||
hex(@u2:=convert(@pl2 using utf8))
|
||||
202122232425262728292A2B2C2D2E2F
|
||||
SELECT hex(@u3:=convert(@pl3 using utf8));
|
||||
hex(@u3:=convert(@pl3 using utf8))
|
||||
303132333435363738393A3B3C3D3E3F
|
||||
SELECT hex(@u4:=convert(@pl4 using utf8));
|
||||
hex(@u4:=convert(@pl4 using utf8))
|
||||
404142434445464748494A4B4C4D4E4F
|
||||
SELECT hex(@u5:=convert(@pl5 using utf8));
|
||||
hex(@u5:=convert(@pl5 using utf8))
|
||||
505152535455565758595A5B5C5D5E5F
|
||||
SELECT hex(@u6:=convert(@pl6 using utf8));
|
||||
hex(@u6:=convert(@pl6 using utf8))
|
||||
606162636465666768696A6B6C6D6E6F
|
||||
SELECT hex(@u7:=convert(@pl7 using utf8));
|
||||
hex(@u7:=convert(@pl7 using utf8))
|
||||
707172737475767778797A7B7C7D7E7F
|
||||
SELECT hex(@u8:=convert(@pl8 using utf8));
|
||||
hex(@u8:=convert(@pl8 using utf8))
|
||||
C280C281C282C283C284C285C286C287C288C289C28AC28BC28CC28DC28EC28F
|
||||
SELECT hex(@u9:=convert(@pl9 using utf8));
|
||||
hex(@u9:=convert(@pl9 using utf8))
|
||||
C290C291C292C293C294C295C296C297C298C299C29AC29BC29CC29DC29EC29F
|
||||
SELECT hex(@uA:=convert(@plA using utf8));
|
||||
hex(@uA:=convert(@plA using utf8))
|
||||
EFBFBDE0B881E0B882E0B883E0B884E0B885E0B886E0B887E0B888E0B889E0B88AE0B88BE0B88CE0B88DE0B88EE0B88F
|
||||
SELECT hex(@uB:=convert(@plB using utf8));
|
||||
hex(@uB:=convert(@plB using utf8))
|
||||
E0B890E0B891E0B892E0B893E0B894E0B895E0B896E0B897E0B898E0B899E0B89AE0B89BE0B89CE0B89DE0B89EE0B89F
|
||||
SELECT hex(@uC:=convert(@plC using utf8));
|
||||
hex(@uC:=convert(@plC using utf8))
|
||||
E0B8A0E0B8A1E0B8A2E0B8A3E0B8A4E0B8A5E0B8A6E0B8A7E0B8A8E0B8A9E0B8AAE0B8ABE0B8ACE0B8ADE0B8AEE0B8AF
|
||||
SELECT hex(@uD:=convert(@plD using utf8));
|
||||
hex(@uD:=convert(@plD using utf8))
|
||||
E0B8B0E0B8B1E0B8B2E0B8B3E0B8B4E0B8B5E0B8B6E0B8B7E0B8B8E0B8B9E0B8BAEFBFBDEFBFBDEFBFBDEFBFBDE0B8BF
|
||||
SELECT hex(@uE:=convert(@plE using utf8));
|
||||
hex(@uE:=convert(@plE using utf8))
|
||||
E0B980E0B981E0B982E0B983E0B984E0B985E0B986E0B987E0B988E0B989E0B98AE0B98BE0B98CE0B98DE0B98EE0B98F
|
||||
SELECT hex(@uF:=convert(@plF using utf8));
|
||||
hex(@uF:=convert(@plF using utf8))
|
||||
E0B990E0B991E0B992E0B993E0B994E0B995E0B996E0B997E0B998E0B999E0B99AE0B99BEFBFBDEFBFBDEFBFBDEFBFBD
|
||||
SELECT hex(convert(@u0 USING tis620));
|
||||
hex(convert(@u0 USING tis620))
|
||||
000102030405060708090A0B0C0D0E0F
|
||||
SELECT hex(convert(@u1 USING tis620));
|
||||
hex(convert(@u1 USING tis620))
|
||||
101112131415161718191A1B1C1D1E1F
|
||||
SELECT hex(convert(@u2 USING tis620));
|
||||
hex(convert(@u2 USING tis620))
|
||||
202122232425262728292A2B2C2D2E2F
|
||||
SELECT hex(convert(@u3 USING tis620));
|
||||
hex(convert(@u3 USING tis620))
|
||||
303132333435363738393A3B3C3D3E3F
|
||||
SELECT hex(convert(@u4 USING tis620));
|
||||
hex(convert(@u4 USING tis620))
|
||||
404142434445464748494A4B4C4D4E4F
|
||||
SELECT hex(convert(@u5 USING tis620));
|
||||
hex(convert(@u5 USING tis620))
|
||||
505152535455565758595A5B5C5D5E5F
|
||||
SELECT hex(convert(@u6 USING tis620));
|
||||
hex(convert(@u6 USING tis620))
|
||||
606162636465666768696A6B6C6D6E6F
|
||||
SELECT hex(convert(@u7 USING tis620));
|
||||
hex(convert(@u7 USING tis620))
|
||||
707172737475767778797A7B7C7D7E7F
|
||||
SELECT hex(convert(@u8 USING tis620));
|
||||
hex(convert(@u8 USING tis620))
|
||||
808182838485868788898A8B8C8D8E8F
|
||||
SELECT hex(convert(@u9 USING tis620));
|
||||
hex(convert(@u9 USING tis620))
|
||||
909192939495969798999A9B9C9D9E9F
|
||||
SELECT hex(convert(@uA USING tis620));
|
||||
hex(convert(@uA USING tis620))
|
||||
FFA1A2A3A4A5A6A7A8A9AAABACADAEAF
|
||||
SELECT hex(convert(@uB USING tis620));
|
||||
hex(convert(@uB USING tis620))
|
||||
B0B1B2B3B4B5B6B7B8B9BABBBCBDBEBF
|
||||
SELECT hex(convert(@uC USING tis620));
|
||||
hex(convert(@uC USING tis620))
|
||||
C0C1C2C3C4C5C6C7C8C9CACBCCCDCECF
|
||||
SELECT hex(convert(@uD USING tis620));
|
||||
hex(convert(@uD USING tis620))
|
||||
D0D1D2D3D4D5D6D7D8D9DAFFFFFFFFDF
|
||||
SELECT hex(convert(@uE USING tis620));
|
||||
hex(convert(@uE USING tis620))
|
||||
E0E1E2E3E4E5E6E7E8E9EAEBECEDEEEF
|
||||
SELECT hex(convert(@uF USING tis620));
|
||||
hex(convert(@uF USING tis620))
|
||||
F0F1F2F3F4F5F6F7F8F9FAFBFFFFFFFF
|
2
mysql-test/r/have_big5.require
Normal file
2
mysql-test/r/have_big5.require
Normal file
|
@ -0,0 +1,2 @@
|
|||
Collation Charset Id Default Compiled Sortlen
|
||||
big5_chinese_ci big5 1 Yes Yes 1
|
2
mysql-test/r/have_tis620.require
Normal file
2
mysql-test/r/have_tis620.require
Normal file
|
@ -0,0 +1,2 @@
|
|||
Collation Charset Id Default Compiled Sortlen
|
||||
tis620_thai_ci tis620 18 Yes Yes 4
|
|
@ -120,3 +120,45 @@ select @a+0, @a:=@a+0+count(*), count(*), @a+0 from t1 group by i;
|
|||
1 3 2 0
|
||||
3 6 3 0
|
||||
drop table t1;
|
||||
set @a=_latin2'test';
|
||||
select charset(@a),collation(@a),coercibility(@a);
|
||||
charset(@a) collation(@a) coercibility(@a)
|
||||
latin2 latin2_general_ci 3
|
||||
select @a=_latin2'TEST';
|
||||
@a=_latin2'TEST'
|
||||
1
|
||||
select @a=_latin2'TEST' collate latin2_bin;
|
||||
@a=_latin2'TEST' collate latin2_bin
|
||||
0
|
||||
set @a=_latin2'test' collate latin2_general_ci;
|
||||
select charset(@a),collation(@a),coercibility(@a);
|
||||
charset(@a) collation(@a) coercibility(@a)
|
||||
latin2 latin2_general_ci 0
|
||||
select @a=_latin2'TEST';
|
||||
@a=_latin2'TEST'
|
||||
1
|
||||
select @a=_latin2'TEST' collate latin2_bin;
|
||||
ERROR HY000: Illegal mix of collations (latin2_general_ci,EXPLICIT) and (latin2_bin,EXPLICIT) for operation '='
|
||||
select charset(@a:=_latin2'test');
|
||||
charset(@a:=_latin2'test')
|
||||
latin2
|
||||
select collation(@a:=_latin2'test');
|
||||
collation(@a:=_latin2'test')
|
||||
latin2_general_ci
|
||||
select coercibility(@a:=_latin2'test');
|
||||
coercibility(@a:=_latin2'test')
|
||||
3
|
||||
select collation(@a:=_latin2'test' collate latin2_bin);
|
||||
collation(@a:=_latin2'test' collate latin2_bin)
|
||||
latin2_bin
|
||||
select coercibility(@a:=_latin2'test' collate latin2_bin);
|
||||
coercibility(@a:=_latin2'test' collate latin2_bin)
|
||||
0
|
||||
select (@a:=_latin2'test' collate latin2_bin) = _latin2'TEST';
|
||||
(@a:=_latin2'test' collate latin2_bin) = _latin2'TEST'
|
||||
0
|
||||
select charset(@a),collation(@a),coercibility(@a);
|
||||
charset(@a) collation(@a) coercibility(@a)
|
||||
latin2 latin2_bin 0
|
||||
select (@a:=_latin2'test' collate latin2_bin) = _latin2'TEST' collate latin2_general_ci;
|
||||
ERROR HY000: Illegal mix of collations (latin2_bin,EXPLICIT) and (latin2_general_ci,EXPLICIT) for operation '='
|
||||
|
|
|
@ -64,6 +64,19 @@ select * from t1;
|
|||
show create table t1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug 2202
|
||||
# CAST from BINARY to non-BINARY and from non-BINARY to BINARY
|
||||
#
|
||||
create table t1 (a binary(10), b char(10) character set koi8r);
|
||||
insert into t1 values (_binary'ÔÅÓÔ',_binary'ÔÅÓÔ');
|
||||
select a,b,cast(a as char character set cp1251),cast(b as binary) from t1;
|
||||
set names koi8r;
|
||||
select a,b,cast(a as char character set cp1251),cast(b as binary) from t1;
|
||||
set names cp1251;
|
||||
select a,b,cast(a as char character set cp1251),cast(b as binary) from t1;
|
||||
drop table t1;
|
||||
set names binary;
|
||||
|
||||
#
|
||||
# The following should be fixed in 4.1
|
||||
|
|
18
mysql-test/t/ctype_big5.test
Normal file
18
mysql-test/t/ctype_big5.test
Normal file
|
@ -0,0 +1,18 @@
|
|||
-- source include/have_big5.inc
|
||||
|
||||
#
|
||||
# Tests with the big5 character set
|
||||
#
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
|
||||
SET NAMES big5;
|
||||
|
||||
#
|
||||
# Bug 1883: LIKE did not work in some cases with a key.
|
||||
#
|
||||
CREATE TABLE t1 (c CHAR(10) CHARACTER SET big5, KEY(c));
|
||||
INSERT INTO t1 VALUES ('aaa'),('aaaa'),('aaaaa');
|
||||
SELECT * FROM t1 WHERE c LIKE 'aaa%';
|
||||
DROP TABLE t1;
|
64
mysql-test/t/ctype_tis620.test
Normal file
64
mysql-test/t/ctype_tis620.test
Normal file
|
@ -0,0 +1,64 @@
|
|||
-- source include/have_tis620.inc
|
||||
|
||||
#
|
||||
# Tests with the big5 character set
|
||||
#
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
|
||||
#
|
||||
# Bug 1552: tis620 <-> unicode conversion crashed
|
||||
# Check tis620 -> utf8 -> tis620 round trip conversion
|
||||
#
|
||||
|
||||
SET @pl0= _tis620 0x000102030405060708090A0B0C0D0E0F;
|
||||
SET @pl1= _tis620 0x101112131415161718191A1B1C1D1E1F;
|
||||
SET @pl2= _tis620 0x202122232425262728292A2B2C2D2E2F;
|
||||
SET @pl3= _tis620 0x303132333435363738393A3B3C3D3E3F;
|
||||
SET @pl4= _tis620 0x404142434445464748494A4B4C4D4E4F;
|
||||
SET @pl5= _tis620 0x505152535455565758595A5B5C5D5E5F;
|
||||
SET @pl6= _tis620 0x606162636465666768696A6B6C6D6E6F;
|
||||
SET @pl7= _tis620 0x707172737475767778797A7B7C7D7E7F;
|
||||
SET @pl8= _tis620 0x808182838485868788898A8B8C8D8E8F;
|
||||
SET @pl9= _tis620 0x909192939495969798999A9B9C9D9E9F;
|
||||
SET @plA= _tis620 0xA0A1A2A3A4A5A6A7A8A9AAABACADAEAF;
|
||||
SET @plB= _tis620 0xB0B1B2B3B4B5B6B7B8B9BABBBCBDBEBF;
|
||||
SET @plC= _tis620 0xC0C1C2C3C4C5C6C7C8C9CACBCCCDCECF;
|
||||
SET @plD= _tis620 0xD0D1D2D3D4D5D6D7D8D9DADBDCDDDEDF;
|
||||
SET @plE= _tis620 0xE0E1E2E3E4E5E6E7E8E9EAEBECEDEEEF;
|
||||
SET @plF= _tis620 0xF0F1F2F3F4F5F6F7F8F9FAFBFCFDFEFF;
|
||||
|
||||
SELECT hex(@u0:=convert(@pl0 using utf8));
|
||||
SELECT hex(@u1:=convert(@pl1 using utf8));
|
||||
SELECT hex(@u2:=convert(@pl2 using utf8));
|
||||
SELECT hex(@u3:=convert(@pl3 using utf8));
|
||||
SELECT hex(@u4:=convert(@pl4 using utf8));
|
||||
SELECT hex(@u5:=convert(@pl5 using utf8));
|
||||
SELECT hex(@u6:=convert(@pl6 using utf8));
|
||||
SELECT hex(@u7:=convert(@pl7 using utf8));
|
||||
SELECT hex(@u8:=convert(@pl8 using utf8));
|
||||
SELECT hex(@u9:=convert(@pl9 using utf8));
|
||||
SELECT hex(@uA:=convert(@plA using utf8));
|
||||
SELECT hex(@uB:=convert(@plB using utf8));
|
||||
SELECT hex(@uC:=convert(@plC using utf8));
|
||||
SELECT hex(@uD:=convert(@plD using utf8));
|
||||
SELECT hex(@uE:=convert(@plE using utf8));
|
||||
SELECT hex(@uF:=convert(@plF using utf8));
|
||||
|
||||
SELECT hex(convert(@u0 USING tis620));
|
||||
SELECT hex(convert(@u1 USING tis620));
|
||||
SELECT hex(convert(@u2 USING tis620));
|
||||
SELECT hex(convert(@u3 USING tis620));
|
||||
SELECT hex(convert(@u4 USING tis620));
|
||||
SELECT hex(convert(@u5 USING tis620));
|
||||
SELECT hex(convert(@u6 USING tis620));
|
||||
SELECT hex(convert(@u7 USING tis620));
|
||||
SELECT hex(convert(@u8 USING tis620));
|
||||
SELECT hex(convert(@u9 USING tis620));
|
||||
SELECT hex(convert(@uA USING tis620));
|
||||
SELECT hex(convert(@uB USING tis620));
|
||||
SELECT hex(convert(@uC USING tis620));
|
||||
SELECT hex(convert(@uD USING tis620));
|
||||
SELECT hex(convert(@uE USING tis620));
|
||||
SELECT hex(convert(@uF USING tis620));
|
|
@ -71,3 +71,31 @@ select @a:=0; select @a, @a:=@a+count(*), count(*), @a from t1 group by i;
|
|||
select @a:=0; select @a+0, @a:=@a+0+count(*), count(*), @a+0 from t1 group by i;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug #2244: User variables didn't copy collation and derivation
|
||||
# attributes from values they were initialized to.
|
||||
#
|
||||
|
||||
set @a=_latin2'test';
|
||||
select charset(@a),collation(@a),coercibility(@a);
|
||||
select @a=_latin2'TEST';
|
||||
select @a=_latin2'TEST' collate latin2_bin;
|
||||
|
||||
set @a=_latin2'test' collate latin2_general_ci;
|
||||
select charset(@a),collation(@a),coercibility(@a);
|
||||
select @a=_latin2'TEST';
|
||||
--error 1266
|
||||
select @a=_latin2'TEST' collate latin2_bin;
|
||||
|
||||
#
|
||||
# Check the same invoking Item_set_user_var
|
||||
#
|
||||
select charset(@a:=_latin2'test');
|
||||
select collation(@a:=_latin2'test');
|
||||
select coercibility(@a:=_latin2'test');
|
||||
select collation(@a:=_latin2'test' collate latin2_bin);
|
||||
select coercibility(@a:=_latin2'test' collate latin2_bin);
|
||||
select (@a:=_latin2'test' collate latin2_bin) = _latin2'TEST';
|
||||
select charset(@a),collation(@a),coercibility(@a);
|
||||
--error 1266
|
||||
select (@a:=_latin2'test' collate latin2_bin) = _latin2'TEST' collate latin2_general_ci;
|
||||
|
|
|
@ -539,8 +539,8 @@ static CHARSET_INFO *get_internal_charset(uint cs_number, myf flags)
|
|||
{
|
||||
strxmov(get_charsets_dir(buf), cs->csname, ".xml", NullS);
|
||||
my_read_charset_file(buf,flags);
|
||||
cs= (cs->state & MY_CS_LOADED) ? cs : NULL;
|
||||
}
|
||||
cs= (cs->state & MY_CS_AVAILABLE) ? cs : NULL;
|
||||
pthread_mutex_unlock(&THR_LOCK_charset);
|
||||
return cs;
|
||||
}
|
||||
|
|
|
@ -2163,6 +2163,7 @@ bool Item_func_set_user_var::fix_fields(THD *thd, TABLE_LIST *tables,
|
|||
is different from query_id).
|
||||
*/
|
||||
entry->update_query_id= thd->query_id;
|
||||
entry->collation.set(args[0]->collation);
|
||||
cached_result_type= args[0]->result_type();
|
||||
return 0;
|
||||
}
|
||||
|
@ -2174,6 +2175,7 @@ Item_func_set_user_var::fix_length_and_dec()
|
|||
maybe_null=args[0]->maybe_null;
|
||||
max_length=args[0]->max_length;
|
||||
decimals=args[0]->decimals;
|
||||
collation.set(args[0]->collation);
|
||||
}
|
||||
|
||||
|
||||
|
@ -2488,7 +2490,9 @@ void Item_func_get_user_var::fix_length_and_dec()
|
|||
|
||||
if (!(var_entry= get_variable(&thd->user_vars, name, 0)))
|
||||
null_value= 1;
|
||||
|
||||
else
|
||||
collation.set(var_entry->collation);
|
||||
|
||||
if (!(opt_bin_log && is_update_query(thd->lex->sql_command)))
|
||||
return;
|
||||
|
||||
|
|
|
@ -2104,8 +2104,8 @@ String *Item_func_conv_charset::val_str(String *str)
|
|||
null_value=1;
|
||||
return 0;
|
||||
}
|
||||
null_value= str->copy(arg->ptr(),arg->length(),arg->charset(),conv_charset);
|
||||
return null_value ? 0 : str;
|
||||
null_value= str_value.copy(arg->ptr(),arg->length(),arg->charset(),conv_charset);
|
||||
return null_value ? 0 : &str_value;
|
||||
}
|
||||
|
||||
void Item_func_conv_charset::fix_length_and_dec()
|
||||
|
|
|
@ -1848,6 +1848,8 @@ String *Item_char_typecast::val_str(String *str)
|
|||
}
|
||||
res= str;
|
||||
}
|
||||
|
||||
res->set_charset(cast_cs);
|
||||
|
||||
/*
|
||||
Cut the tail if cast with length
|
||||
|
|
|
@ -2148,8 +2148,12 @@ static int init_common_variables(const char *conf_file_name, int argc,
|
|||
{
|
||||
CHARSET_INFO *default_collation;
|
||||
default_collation= get_charset_by_name(default_collation_name, MYF(0));
|
||||
if (!default_collation || !my_charset_same(default_charset_info,
|
||||
default_collation))
|
||||
if (!default_collation)
|
||||
{
|
||||
sql_print_error(ER(ER_UNKNOWN_COLLATION), default_collation_name);
|
||||
return 1;
|
||||
}
|
||||
if (!my_charset_same(default_charset_info, default_collation))
|
||||
{
|
||||
sql_print_error(ER(ER_COLLATION_CHARSET_MISMATCH),
|
||||
default_collation_name,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version='1.0' encoding="utf-8"?>
|
||||
|
||||
<charsets max-id="93">
|
||||
<charsets max-id="94">
|
||||
|
||||
<description>
|
||||
This file lists all of the available character sets.
|
||||
|
@ -100,6 +100,7 @@ To make maintaining easier please:
|
|||
<collation name="latin1_swedish_ci" id="8" order="Finnish, Swedish" flag="primary"/>
|
||||
<collation name="latin1_danish_ci" id="15" order="Danish"/>
|
||||
<collation name="latin1_german2_ci" id="31" order="German Phonebook" flag="compiled"/>
|
||||
<collation name="latin1_spanish_ci" id="94" order="Spanish"/>
|
||||
<collation name="latin1_bin" id="47" order="Binary">
|
||||
<flag>binary</flag>
|
||||
<flag>compiled</flag>
|
||||
|
|
257
sql/share/charsets/languages.html
Normal file
257
sql/share/charsets/languages.html
Normal file
|
@ -0,0 +1,257 @@
|
|||
#!/bin/sh
|
||||
#<pre>
|
||||
(
|
||||
echo "DROP TABLE lang;"
|
||||
echo "CREATE TABLE lang (lang varchar(128), letters text character set utf8);"
|
||||
(
|
||||
grep -v "^#" << END
|
||||
#
|
||||
Greenlandic ÁÂÃÊÍÎÔÚÛáâãêíîôúûĨĩĸŨũ
|
||||
#Use of these letters was abolished in a spelling reform in 1973:
|
||||
#Greenlandic ÅÆØåæø
|
||||
#Characters not found in the UCS:
|
||||
# K LATIN CAPITAL LETTER KRA
|
||||
#############################################################
|
||||
#Basque ÑÜñüŔŕ
|
||||
#Characters not found in the UCS:
|
||||
# D LATIN CAPITAL LETTER D WITH MACRON
|
||||
# d LATIN SMALL LETTER D WITH MACRON
|
||||
# L LATIN CAPITAL LETTER L WITH MACRON
|
||||
# l LATIN SMALL LETTER L WITH MACRON
|
||||
# T LATIN CAPITAL LETTER T WITH MACRON
|
||||
# t LATIN SMALL LETTER T WITH MACRON
|
||||
#############################################################
|
||||
#Maltese #ÀÁÂÈÉÊÌÍÎÒÓÔÙÚÛ#àáâèéêìíîòÓôùúû#ĊċĠġĦħŻżʼ
|
||||
#BosnianCyr ЂЈЉЊЋЏАБВГДЕЖЗИКЛМНОПРСТУФХЦЧШабвгдежзиклмнопрстуфхцчшђјљњћџ
|
||||
#Scots A
|
||||
#Scots1 ƷȜȝʒ
|
||||
###########################################
|
||||
#### Hiragana 3040-309F
|
||||
Hiragana ぁあぃいぅうぇえぉおかがきぎくぐけげこごさざしじすずせぜそぞただちぢっつづてでとどなにぬねのはばぱひびぴふぶぷへべぺほぼぽまみむめもゃやゅゆょよらりるれろゎわゐゑをん
|
||||
Hiragana1 ゔ゙゚
|
||||
Hiragana2 ゛゜ゝゞ
|
||||
#### Katakana 30A0-30FF
|
||||
Katakana ァアィイゥウェエォオカガキギクグケゲコゴサザシジスズセゼソゾタダチヂッツヅテデトドナニヌネノハバパヒビピフブプヘベペホボポマミムメモャヤュユョヨラリルレロヮワヰヱヲンヴヵヶ
|
||||
Katakana1 ヷヸヹヺ
|
||||
Katakana2 ・ーヽヾ
|
||||
############################################
|
||||
Albanian ÂÇËâçë
|
||||
Bosnian ĆćČčĐ𩹮ž
|
||||
Breton ÂÊÑÙÜâêñùü
|
||||
Catalan ÀÇÈÉÍÏÒÓÚÜàçèéíïòóúü
|
||||
#Catalan1 ·Ŀŀ
|
||||
Croatian ĆćČčĐ𩹮ž
|
||||
CroatianLig DZDzdzDŽDždžLJLjljNJNjnj
|
||||
Czech ÁÉÍÓÚÝáéíóúýČčĎďĚěŇňŘřŠšŤťŮůŽž
|
||||
Danish ÁÄÅÆÉÓÖØÜáäåæéóöøü
|
||||
Dutch ÀÂÄÆÇÈÉÊËÎÏÑÒÓÔÖÙÚÛÜàâäæçèéêëîïñòóôöùúûü
|
||||
Esperanto ĈĉĜĝĤĥĴĵŜŝŬŭ
|
||||
Estonian ÄÕÖÜäõöüŠšŽž
|
||||
Faroese ÅÆÐÓÖØÚÝåæðóöøúý
|
||||
Finnish ÄÅÖÜäåöü
|
||||
#Finnish1 ŠšŽž
|
||||
French(limited) ÀÂÆÇÈÉÊËÎÏÑÔÙÛàâæçèéêëîïñôùûÿ
|
||||
French ŒœŸ
|
||||
German ÄÖÜßäöü
|
||||
Hungarian ÁÉÍÓÖÚÜáéíóöúüŐőŰű
|
||||
Icelandic ÁÆÉÍÐÓÖÚÝÞáæéíðóöúýþ
|
||||
Italian ÀÈÉÌÍÏÒÓÙÚàèéìíïòóùú
|
||||
#Latin A
|
||||
Latvian ĀāČčĒēĢģĪīĶķĻļŅņŠšŪūŽž
|
||||
Lithuanian ĄąČčĖėĘęĮįŠšŪūŲųŽž
|
||||
Norwegian ÅÆØåæø
|
||||
Polish ÓóĄąĆćĘꣳŃńŚśŹźŻż
|
||||
Portuguese ÀÁÂÃÇÉÊÍÓÔÕÚÜàáâãçéêíóôõúü
|
||||
#http://en.wikipedia.org/wiki/Special_Romanian_Unicode_characters
|
||||
Romanian ÂÎâîĂăȘșȚț
|
||||
Romanian(ErrorST) ÂÎâîĂ㪺Ţţ
|
||||
Slovak ÁÄÉÍÓÔÚÝáäéíóôúýČčĎďĹ弾ŇňŔ੹ŤťŽž
|
||||
Slovene Č芚Žž
|
||||
Sorbian-Lower ĆćČčĚ죳ŃńŘřŚśŠšŹźŽž
|
||||
Sorbian-Upper ÓóĆćČčĚ죳ŃńŘřŠšŽž
|
||||
Spanish ÁÉÍÑÓÚÜáéíñóúü
|
||||
Swedish ÄÅÖäåö
|
||||
Turkish ÂÇÖÛÜâçöûüĞğİı
|
||||
Welsh ÀÁÂÄÈÉÊËÌÍÎÏÒÓÔÖÙÚÛÜÝàáâäèéêëìíîïòóôöùúûüýÿŴŵŶŷŸẀẁẂẃẄẅỲỳ
|
||||
##################################
|
||||
Belarusian ЁІЎАБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюяёіў
|
||||
Bulgarian АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЬЮЯабвгдежзийклмнопрстуфхцчшщъьюя
|
||||
Bulgarian1 ЀҭѐѝѢѣѪѫ
|
||||
Macedonian ЃЅЈЉЊЌЏАБВГДЕЖЗИКЛМНОПРСТУФХЦЧШабвгдежзиклмнопрстуфхцчшѓѕјљњќџ
|
||||
Russian ЁАБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюяё
|
||||
RussianOLD ІіѢѣѲѳѴѵ
|
||||
Serbian ЂЈЉЊЋЏАБВГДЕЖЗИКЛМНОПРСТУФХЦЧШабвгдежзиклмнопрстуфхцчшђјљњћџ
|
||||
Ukrainian ЄІЇАБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЬЭЮЯабвгдежзийклмнопрстуфхцчшщьэюяєіїҐґ
|
||||
##################################
|
||||
Armenian ԱԲԳԴԵԶԷԸԹԺԻԼԽԾԿՁՂՃՄՅՆՇՈՉՊՋՌՍՎՏՑՒՓՔՕՖ՛՜՝՞՟աբգդեֆ։
|
||||
#Armenian1 ՚֊
|
||||
#Characters not found in the UCS:
|
||||
# ARMENIAN ETERNITY SIGN
|
||||
#
|
||||
GeorgianOld ႠႡႢႣႤႥႦႧႨႩႪႫႬႭႮႯႰႱႲႳႴႵႶႷႸႹႺႻႼႽႾႿჀჁჂჃჄჅ
|
||||
Georgian აბგდევზთიკლმნოპჟრსტუფქღყშჩცძწჭხჯჰ
|
||||
GeorgianArc ჱჲჳჴჵჶ
|
||||
GeorgianPunc ჻
|
||||
#
|
||||
GreekExt1 ΄΅Ά·ΈΉΊ»Ό½ΎΏΐ
|
||||
Greek ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩαβγδεζηθικλμνξοπρστυφχψω
|
||||
GreekExt2 ΪΫάέήίΰϊϋόύώ
|
||||
GreekExt4 ς
|
||||
#
|
||||
Hebrew אבגדהוזחטיךכלםמןנסעףפץצקרשת
|
||||
##################################
|
||||
#Abaza
|
||||
#Abkhaz
|
||||
#Adyghe
|
||||
#Agul *
|
||||
#(Aisor)
|
||||
#Akhvakh *
|
||||
#(?lvdalska)
|
||||
#(Andi) *
|
||||
#(Aragonese)
|
||||
#Archi *
|
||||
#Arumanian
|
||||
#(Arvanite)
|
||||
#Asturian
|
||||
#Avar
|
||||
#Azerbaijani
|
||||
#(Bagulal) *
|
||||
#Balkar
|
||||
#Bashkir
|
||||
#Basque !
|
||||
#Bats *
|
||||
#Bezhta *
|
||||
#(Botlikh) *
|
||||
#Budukh *
|
||||
#(Chamalal)
|
||||
#Chechen
|
||||
#Chuvash
|
||||
#Cornish !
|
||||
#(Corsican)
|
||||
#Dargwa
|
||||
#Erzya
|
||||
#(Franco-Proven?al)
|
||||
#(Frisian, East)
|
||||
#(Frisian, North)
|
||||
#Frisian, West
|
||||
#Friulian
|
||||
#Gagauz
|
||||
#Gaelic, Irish !
|
||||
#Gaelic, Manx !
|
||||
#Gaelic, Scottish !
|
||||
#Galician !
|
||||
#(German, Low) !
|
||||
#(German, Swiss) !
|
||||
#Godoberi *
|
||||
#(Hinukh) *
|
||||
#(Hunzib) *
|
||||
#Ingrian
|
||||
#Ingush
|
||||
#Istro-Romanian
|
||||
#(Judeo-Georgian)
|
||||
#(Judeo-Kurdish)
|
||||
#(Judeo-Tati)
|
||||
#Kabardian
|
||||
#Kalmyk
|
||||
#Karachay
|
||||
#(Karaim)
|
||||
#(Karata) *
|
||||
#Karelian
|
||||
#Kashubian
|
||||
#Kazakh
|
||||
#Khinalug
|
||||
#(Khvarshi) *
|
||||
#(Kirmanji)
|
||||
#Komi
|
||||
#Komi-Permyak
|
||||
#(Kryts)
|
||||
#Kumyk
|
||||
#(Kurdish)
|
||||
#(Ladin)
|
||||
#(Ladino)
|
||||
#Lak
|
||||
#Laz
|
||||
#Lezgian
|
||||
#Livonian
|
||||
#(Ludian)
|
||||
#Luxemburgish !
|
||||
#Mari, Hill
|
||||
#Mari, Meadow
|
||||
#Megleno-Romanian
|
||||
#(Mingrelian)
|
||||
#Moksha
|
||||
#Moldavian
|
||||
#Nenets, Tundra
|
||||
#Nogai
|
||||
#Occitan
|
||||
#Old Church Slavonic
|
||||
#(Olonets)
|
||||
#Ossetian
|
||||
#(Romani)
|
||||
#Romansch
|
||||
#(Rusyn)
|
||||
#Rutul
|
||||
#Sami, Inari
|
||||
#Sami, Kildin
|
||||
#Sami, Lule
|
||||
#Sami, Northern
|
||||
#Sami, Skolt
|
||||
#Sami, Southern
|
||||
#(Sami, Ter) *
|
||||
#(Sami, Ume) *
|
||||
#(Sardinian) *
|
||||
#Scots !
|
||||
#Svan
|
||||
#Tabasaran
|
||||
#(Talysh)
|
||||
#Tatar, Crimean
|
||||
#Tatar, Kazan
|
||||
#Tati
|
||||
#(Tindi) *
|
||||
#(Tsakonian) *
|
||||
#Tsakhur *
|
||||
#(Tsez) *
|
||||
#(Turkish, Crimean)
|
||||
#Ubykh *
|
||||
#Udi
|
||||
#Udmurt
|
||||
#(V?mhusm?l)
|
||||
#Vepsian
|
||||
#Votic
|
||||
#(Walloon)
|
||||
#(Yiddish)
|
||||
################################
|
||||
# 4 Gaelic-new-orthography
|
||||
# 4 Frisian
|
||||
# 3 Rhaeto-Romanic
|
||||
# 2 S&AACUTEmi-with-restrictions
|
||||
# 1 Rhjaeto-Romanic
|
||||
# 1 Gaelic-old-and-new-orthographies
|
||||
END
|
||||
) |
|
||||
|
||||
while read a b
|
||||
do
|
||||
c=`echo $b | replace "&#x" "" ";" ""`
|
||||
printf "INSERT INTO lang VALUES ('$a',_ucs2 X'$c');\n"
|
||||
done
|
||||
) | mysql -f test
|
||||
|
||||
#mysql test << END
|
||||
#SELECT * FROM lang WHERE CONVERT(letters USING latin1) NOT LIKE _binary'%?%';
|
||||
#SELECT * FROM lang WHERE CONVERT(letters USING latin2) NOT LIKE _binary'%?%';
|
||||
#END
|
||||
|
||||
|
||||
|
||||
list="big5 dec8 cp850 hp8 koi8r latin1 latin2 swe7 ascii ujis sjis hebrew euckr koi8u gb2312 greek cp1250 gbk latin5 armscii8 cp866 keybcs2 macce macroman cp852 latin7 cp1251 cp1256 cp1257 geostd8"
|
||||
|
||||
for p in $list
|
||||
do
|
||||
echo "-----------------"
|
||||
echo $p:
|
||||
mysql -sss test << END
|
||||
SELECT lang FROM lang WHERE CONVERT(letters USING $p) NOT LIKE _binary'%?%' ORDER BY lang;
|
||||
END
|
||||
done
|
||||
|
|
@ -209,6 +209,27 @@
|
|||
</collation>
|
||||
|
||||
|
||||
<collation name="latin1_spanish_ci">
|
||||
<map>
|
||||
00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
|
||||
10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
|
||||
20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
|
||||
30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
|
||||
40 41 51 53 57 5B 65 67 69 6B 75 77 79 7B 7D 81
|
||||
8F 91 93 95 98 9A A4 A6 A8 AA AF B3 B4 B5 B6 B7
|
||||
B8 41 51 53 57 5B 65 67 69 6B 75 77 79 7B 7D 81
|
||||
8F 91 93 95 98 9A A4 A6 A8 AA AF B9 BA BB BC BF
|
||||
C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
|
||||
D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF
|
||||
E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
|
||||
F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF
|
||||
41 41 41 41 41 41 41 53 5B 5B 5B 5B 6B 6B 6B 6B
|
||||
57 7F 81 81 81 81 81 BD 81 9A 9A 9A 9A AA B1 97
|
||||
41 41 41 41 41 41 41 53 5B 5B 5B 5B 6B 6B 6B 6B
|
||||
57 7F 81 81 81 81 81 BE 81 9A 9A 9A 9A AA B1 AA
|
||||
</map>
|
||||
</collation>
|
||||
|
||||
</charset>
|
||||
|
||||
</charsets>
|
||||
|
|
|
@ -834,6 +834,7 @@ static int check_connection(THD *thd)
|
|||
char *passwd= strend(user)+1;
|
||||
char *db= passwd;
|
||||
char db_buff[NAME_LEN+1]; // buffer to store db in utf8
|
||||
char user_buff[USERNAME_LENGTH+1]; // buffer to store user in utf8
|
||||
/*
|
||||
Old clients send null-terminated string as password; new clients send
|
||||
the size (1 byte) + string (not null-terminated). Hence in case of empty
|
||||
|
@ -854,6 +855,14 @@ static int check_connection(THD *thd)
|
|||
db= db_buff;
|
||||
}
|
||||
|
||||
if (user)
|
||||
{
|
||||
user_buff[copy_and_convert(user_buff, sizeof(user_buff)-1,
|
||||
system_charset_info, user, strlen(user),
|
||||
thd->charset())]= '\0';
|
||||
user= user_buff;
|
||||
}
|
||||
|
||||
if (thd->user)
|
||||
x_free(thd->user);
|
||||
if (!(thd->user= my_strdup(user, MYF(0))))
|
||||
|
|
|
@ -235,7 +235,7 @@ bool String::copy(const char *str, uint32 arg_length,
|
|||
{
|
||||
if ((from_cs == &my_charset_bin) || (to_cs == &my_charset_bin))
|
||||
{
|
||||
return copy(str, arg_length, &my_charset_bin);
|
||||
return copy(str, arg_length, to_cs);
|
||||
}
|
||||
uint32 new_length= to_cs->mbmaxlen*arg_length;
|
||||
if (alloc(new_length))
|
||||
|
|
|
@ -377,7 +377,7 @@ static my_bool my_like_range_big5(CHARSET_INFO *cs __attribute__((unused)),
|
|||
*min_length= (uint) (min_str-min_org);
|
||||
*max_length= res_length;
|
||||
do {
|
||||
*min_str++ = '\0'; /* Because if key compression */
|
||||
*min_str++ = ' '; /* Because if key compression */
|
||||
*max_str++ = max_sort_char;
|
||||
} while (min_str != min_end);
|
||||
return 0;
|
||||
|
|
|
@ -701,6 +701,205 @@ void ThNormalize(uchar* ptr, uint field_length, const uchar* from, uint length)
|
|||
}
|
||||
#endif /* NOT_NEEDED */
|
||||
|
||||
static unsigned short cs_to_uni[256]={
|
||||
0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007,
|
||||
0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F,
|
||||
0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017,
|
||||
0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F,
|
||||
0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027,
|
||||
0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F,
|
||||
0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037,
|
||||
0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F,
|
||||
0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047,
|
||||
0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F,
|
||||
0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057,
|
||||
0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F,
|
||||
0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067,
|
||||
0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F,
|
||||
0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077,
|
||||
0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F,
|
||||
0x0080,0x0081,0x0082,0x0083,0x0084,0x0085,0x0086,0x0087,
|
||||
0x0088,0x0089,0x008A,0x008B,0x008C,0x008D,0x008E,0x008F,
|
||||
0x0090,0x0091,0x0092,0x0093,0x0094,0x0095,0x0096,0x0097,
|
||||
0x0098,0x0099,0x009A,0x009B,0x009C,0x009D,0x009E,0x009F,
|
||||
0xFFFD,0x0E01,0x0E02,0x0E03,0x0E04,0x0E05,0x0E06,0x0E07,
|
||||
0x0E08,0x0E09,0x0E0A,0x0E0B,0x0E0C,0x0E0D,0x0E0E,0x0E0F,
|
||||
0x0E10,0x0E11,0x0E12,0x0E13,0x0E14,0x0E15,0x0E16,0x0E17,
|
||||
0x0E18,0x0E19,0x0E1A,0x0E1B,0x0E1C,0x0E1D,0x0E1E,0x0E1F,
|
||||
0x0E20,0x0E21,0x0E22,0x0E23,0x0E24,0x0E25,0x0E26,0x0E27,
|
||||
0x0E28,0x0E29,0x0E2A,0x0E2B,0x0E2C,0x0E2D,0x0E2E,0x0E2F,
|
||||
0x0E30,0x0E31,0x0E32,0x0E33,0x0E34,0x0E35,0x0E36,0x0E37,
|
||||
0x0E38,0x0E39,0x0E3A,0xFFFD,0xFFFD,0xFFFD,0xFFFD,0x0E3F,
|
||||
0x0E40,0x0E41,0x0E42,0x0E43,0x0E44,0x0E45,0x0E46,0x0E47,
|
||||
0x0E48,0x0E49,0x0E4A,0x0E4B,0x0E4C,0x0E4D,0x0E4E,0x0E4F,
|
||||
0x0E50,0x0E51,0x0E52,0x0E53,0x0E54,0x0E55,0x0E56,0x0E57,
|
||||
0x0E58,0x0E59,0x0E5A,0x0E5B,0xFFFD,0xFFFD,0xFFFD,0xFFFD
|
||||
};
|
||||
static unsigned char pl00[256]={
|
||||
0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007,
|
||||
0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F,
|
||||
0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017,
|
||||
0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F,
|
||||
0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027,
|
||||
0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F,
|
||||
0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037,
|
||||
0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F,
|
||||
0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047,
|
||||
0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F,
|
||||
0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057,
|
||||
0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F,
|
||||
0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067,
|
||||
0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F,
|
||||
0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077,
|
||||
0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F,
|
||||
0x0080,0x0081,0x0082,0x0083,0x0084,0x0085,0x0086,0x0087,
|
||||
0x0088,0x0089,0x008A,0x008B,0x008C,0x008D,0x008E,0x008F,
|
||||
0x0090,0x0091,0x0092,0x0093,0x0094,0x0095,0x0096,0x0097,
|
||||
0x0098,0x0099,0x009A,0x009B,0x009C,0x009D,0x009E,0x009F,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000
|
||||
};
|
||||
static unsigned char pl0E[256]={
|
||||
0x0000,0x00A1,0x00A2,0x00A3,0x00A4,0x00A5,0x00A6,0x00A7,
|
||||
0x00A8,0x00A9,0x00AA,0x00AB,0x00AC,0x00AD,0x00AE,0x00AF,
|
||||
0x00B0,0x00B1,0x00B2,0x00B3,0x00B4,0x00B5,0x00B6,0x00B7,
|
||||
0x00B8,0x00B9,0x00BA,0x00BB,0x00BC,0x00BD,0x00BE,0x00BF,
|
||||
0x00C0,0x00C1,0x00C2,0x00C3,0x00C4,0x00C5,0x00C6,0x00C7,
|
||||
0x00C8,0x00C9,0x00CA,0x00CB,0x00CC,0x00CD,0x00CE,0x00CF,
|
||||
0x00D0,0x00D1,0x00D2,0x00D3,0x00D4,0x00D5,0x00D6,0x00D7,
|
||||
0x00D8,0x00D9,0x00DA,0x0000,0x0000,0x0000,0x0000,0x00DF,
|
||||
0x00E0,0x00E1,0x00E2,0x00E3,0x00E4,0x00E5,0x00E6,0x00E7,
|
||||
0x00E8,0x00E9,0x00EA,0x00EB,0x00EC,0x00ED,0x00EE,0x00EF,
|
||||
0x00F0,0x00F1,0x00F2,0x00F3,0x00F4,0x00F5,0x00F6,0x00F7,
|
||||
0x00F8,0x00F9,0x00FA,0x00FB,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000
|
||||
};
|
||||
static unsigned char plFF[256]={
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x00FF,0x0000,0x0000
|
||||
};
|
||||
static unsigned char *uni_to_cs[256]={
|
||||
pl00,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
|
||||
NULL,NULL,NULL,NULL,NULL,NULL,pl0E,NULL,
|
||||
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
|
||||
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
|
||||
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
|
||||
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
|
||||
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
|
||||
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
|
||||
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
|
||||
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
|
||||
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
|
||||
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
|
||||
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
|
||||
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
|
||||
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
|
||||
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
|
||||
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
|
||||
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
|
||||
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
|
||||
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
|
||||
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
|
||||
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
|
||||
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
|
||||
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
|
||||
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
|
||||
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
|
||||
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
|
||||
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
|
||||
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
|
||||
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
|
||||
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
|
||||
NULL,NULL,NULL,NULL,NULL,NULL,NULL,plFF
|
||||
};
|
||||
|
||||
|
||||
static
|
||||
int my_mb_wc_tis620(CHARSET_INFO *cs,my_wc_t *wc,
|
||||
const unsigned char *str,
|
||||
const unsigned char *end __attribute__((unused)))
|
||||
{
|
||||
if (str >= end)
|
||||
return MY_CS_TOOFEW(0);
|
||||
|
||||
*wc=cs_to_uni[*str];
|
||||
return (!wc[0] && str[0]) ? MY_CS_ILSEQ : 1;
|
||||
}
|
||||
|
||||
static
|
||||
int my_wc_mb_tis620(CHARSET_INFO *cs,my_wc_t wc,
|
||||
unsigned char *str,
|
||||
unsigned char *end __attribute__((unused)))
|
||||
{
|
||||
unsigned char *pl;
|
||||
|
||||
if (str >= end)
|
||||
return MY_CS_TOOSMALL;
|
||||
|
||||
pl= uni_to_cs[(wc>>8) & 0xFF];
|
||||
str[0]= pl ? pl[wc & 0xFF] : '\0';
|
||||
return (!str[0] && wc) ? MY_CS_ILUNI : 1;
|
||||
}
|
||||
|
||||
|
||||
static MY_COLLATION_HANDLER my_collation_ci_handler =
|
||||
{
|
||||
|
@ -721,8 +920,8 @@ static MY_CHARSET_HANDLER my_charset_handler=
|
|||
my_numchars_8bit,
|
||||
my_charpos_8bit,
|
||||
my_lengthsp_8bit,
|
||||
my_mb_wc_8bit, /* mb_wc */
|
||||
my_wc_mb_8bit, /* wc_mb */
|
||||
my_mb_wc_tis620, /* mb_wc */
|
||||
my_wc_mb_tis620, /* wc_mb */
|
||||
my_caseup_str_8bit,
|
||||
my_casedn_str_8bit,
|
||||
my_caseup_8bit,
|
||||
|
|
72
strings/dump_map.c
Normal file
72
strings/dump_map.c
Normal file
|
@ -0,0 +1,72 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
static void print_short_array(unsigned short *a)
|
||||
{
|
||||
int i;
|
||||
printf("{\n");
|
||||
for (i=0; i<=0xFF; i++)
|
||||
{
|
||||
printf("0x%04X%s%s",(int)a[i],i<0xFF?",":"",(i+1) % 8 ? "" :"\n");
|
||||
}
|
||||
printf("};\n");
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
int main(void)
|
||||
{
|
||||
char str[160];
|
||||
unsigned short touni[256];
|
||||
unsigned short fromuni[65536];
|
||||
unsigned short fromstat[256];
|
||||
int i;
|
||||
|
||||
bzero((void*)touni,sizeof(touni));
|
||||
bzero((void*)fromuni,sizeof(fromuni));
|
||||
bzero((void*)fromstat,sizeof(fromstat));
|
||||
|
||||
while (fgets(str,sizeof(str),stdin))
|
||||
{
|
||||
unsigned int c,u;
|
||||
|
||||
if ((str[0]=='#') || (2!=sscanf(str,"%x%x",&c,&u)))
|
||||
continue;
|
||||
if (c>0xFF || u>0xFFFF)
|
||||
continue;
|
||||
|
||||
touni[c]= u;
|
||||
fromuni[u]= c;
|
||||
}
|
||||
|
||||
printf("unsigned short cs_to_uni[256]=");
|
||||
print_short_array(touni);
|
||||
|
||||
for (i=0;i<=0xFF;i++)
|
||||
{
|
||||
fromstat[touni[i]>>8]++;
|
||||
}
|
||||
|
||||
for (i=0;i<=256;i++)
|
||||
{
|
||||
if (fromstat[i])
|
||||
{
|
||||
printf("unsigned char pl%02X[256]=",i);
|
||||
print_short_array(fromuni+i*256);
|
||||
}
|
||||
}
|
||||
|
||||
printf("unsigned short *uni_to_cs[256]={\n");
|
||||
for (i=0;i<=255;i++)
|
||||
{
|
||||
if (fromstat[i])
|
||||
printf("pl%02X",i);
|
||||
else
|
||||
printf("NULL");
|
||||
printf("%s%s",i<255?",":"",((i+1) % 8) ? "":"\n");
|
||||
}
|
||||
printf("};\n");
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Reference in a new issue