Manual merge from mysql-next-mr.
Conflicts: - sql/item.cc
This commit is contained in:
commit
b73cba223b
@ -22,15 +22,15 @@ IF(NOT DEFAULT_COLLATIONS)
|
||||
SET(DEFAULT_COLLATION "latin1_swedish_ci")
|
||||
ENDIF()
|
||||
|
||||
SET(CHARSETS ${DEFAULT_CHARSET} latin1 utf8 utf8mb3)
|
||||
SET(CHARSETS_COMPLEX big5 cp1250 cp932 eucjpms euckr gb2312 gbk latin1 latin2 sjis tis620 ucs2 ujis utf8 utf8mb3 utf16 utf32)
|
||||
SET(CHARSETS ${DEFAULT_CHARSET} latin1 utf8 utf8mb4)
|
||||
SET(CHARSETS_COMPLEX big5 cp1250 cp932 eucjpms euckr gb2312 gbk latin1 latin2 sjis tis620 ucs2 ujis utf8 utf8mb4 utf16 utf32)
|
||||
|
||||
SET(CHARSETS_AVAILABLE
|
||||
binary armscii8 ascii big5 cp1250 cp1251 cp1256 cp1257
|
||||
cp850 cp852 cp866 cp932 dec8 eucjpms euckr gb2312 gbk geostd8
|
||||
greek hebrew hp8 keybcs2 koi8r koi8u
|
||||
latin1 latin2 latin5 latin7 macce macroman
|
||||
sjis swe7 tis620 ucs2 ujis utf8 utf8mb3 utf16 utf32)
|
||||
sjis swe7 tis620 ucs2 ujis utf8 utf8mb4 utf16 utf32)
|
||||
|
||||
|
||||
SET (EXTRA_CHARSETS "all")
|
||||
|
@ -13,11 +13,11 @@ define(CHARSETS_AVAILABLE1,armscii8 ascii big5 cp1250 cp1251 cp1256 cp1257)
|
||||
define(CHARSETS_AVAILABLE2,cp850 cp852 cp866 cp932 dec8 eucjpms euckr gb2312 gbk geostd8)
|
||||
define(CHARSETS_AVAILABLE3,greek hebrew hp8 keybcs2 koi8r koi8u)
|
||||
define(CHARSETS_AVAILABLE4,latin1 latin2 latin5 latin7 macce macroman)
|
||||
define(CHARSETS_AVAILABLE5,sjis swe7 tis620 ucs2 ujis utf8)
|
||||
define(CHARSETS_AVAILABLE5,sjis swe7 tis620 ucs2 ujis utf8mb4 utf8 utf16 utf32)
|
||||
|
||||
DEFAULT_CHARSET=latin1
|
||||
CHARSETS_AVAILABLE="CHARSETS_AVAILABLE0 CHARSETS_AVAILABLE1 CHARSETS_AVAILABLE2 CHARSETS_AVAILABLE3 CHARSETS_AVAILABLE4 CHARSETS_AVAILABLE5"
|
||||
CHARSETS_COMPLEX="big5 cp1250 cp932 eucjpms euckr gb2312 gbk latin1 latin2 sjis tis620 ucs2 ujis utf8"
|
||||
CHARSETS_COMPLEX="big5 cp1250 cp932 eucjpms euckr gb2312 gbk latin1 latin2 sjis tis620 ucs2 ujis utf8mb4 utf8 utf16 utf32"
|
||||
|
||||
AC_DIVERT_POP
|
||||
|
||||
@ -50,7 +50,7 @@ AC_ARG_WITH(extra-charsets,
|
||||
|
||||
AC_MSG_CHECKING("character sets")
|
||||
|
||||
CHARSETS="$default_charset latin1 utf8"
|
||||
CHARSETS="$default_charset latin1 utf8mb4 utf8"
|
||||
|
||||
if test "$extra_charsets" = no; then
|
||||
CHARSETS="$CHARSETS"
|
||||
@ -195,8 +195,23 @@ do
|
||||
AC_DEFINE([USE_MB], [1], [Use multi-byte character routines])
|
||||
AC_DEFINE(USE_MB_IDENT, 1)
|
||||
;;
|
||||
utf8mb4)
|
||||
AC_DEFINE(HAVE_CHARSET_utf8mb4, 1, [Define to enable utf8mb4])
|
||||
AC_DEFINE([USE_MB], 1, [Use multi-byte character routines])
|
||||
AC_DEFINE(USE_MB_IDENT, 1)
|
||||
;;
|
||||
utf8)
|
||||
AC_DEFINE(HAVE_CHARSET_utf8, 1, [Define to enable ut8])
|
||||
AC_DEFINE(HAVE_CHARSET_utf8, 1, [Define to enable utf8])
|
||||
AC_DEFINE([USE_MB], 1, [Use multi-byte character routines])
|
||||
AC_DEFINE(USE_MB_IDENT, 1)
|
||||
;;
|
||||
utf16)
|
||||
AC_DEFINE(HAVE_CHARSET_utf16, 1, [Define to enable utf16])
|
||||
AC_DEFINE([USE_MB], 1, [Use multi-byte character routines])
|
||||
AC_DEFINE(USE_MB_IDENT, 1)
|
||||
;;
|
||||
utf32)
|
||||
AC_DEFINE(HAVE_CHARSET_utf32, 1, [Define to enable utf32])
|
||||
AC_DEFINE([USE_MB], 1, [Use multi-byte character routines])
|
||||
AC_DEFINE(USE_MB_IDENT, 1)
|
||||
;;
|
||||
@ -381,6 +396,48 @@ case $default_charset in
|
||||
fi
|
||||
default_charset_collations="$UTFC"
|
||||
;;
|
||||
utf8mb4)
|
||||
default_charset_default_collation="utf8mb4_general_ci"
|
||||
define(UTFC1, utf8mb4_general_ci utf8mb4_bin)
|
||||
define(UTFC2, utf8mb4_czech_ci utf8mb4_danish_ci)
|
||||
define(UTFC3, utf8mb4_esperanto_ci utf8mb4_estonian_ci utf8mb4_hungarian_ci)
|
||||
define(UTFC4, utf8mb4_icelandic_ci utf8mb4_latvian_ci utf8mb4_lithuanian_ci)
|
||||
define(UTFC5, utf8mb4_persian_ci utf8mb4_polish_ci utf8mb4_romanian_ci)
|
||||
define(UTFC6, utf8mb4_sinhala_ci utf8mb4_slovak_ci utf8mb4_slovenian_ci)
|
||||
define(UTFC7, utf8mb4_spanish2_ci utf8mb4_spanish_ci)
|
||||
define(UTFC8, utf8mb4_swedish_ci utf8mb4_turkish_ci)
|
||||
define(UTFC9, utf8mb4_unicode_ci)
|
||||
UTFC="UTFC1 UTFC2 UTFC3 UTFC4 UTFC5 UTFC6 UTFC7 UTFC8 UTFC9"
|
||||
default_charset_collations="$UTFC"
|
||||
;;
|
||||
utf16)
|
||||
default_charset_default_collation="utf16_general_ci"
|
||||
define(UTFC1, utf16_general_ci utf16_bin)
|
||||
define(UTFC2, utf16_czech_ci utf16_danish_ci)
|
||||
define(UTFC3, utf16_esperanto_ci utf16_estonian_ci utf16_hungarian_ci)
|
||||
define(UTFC4, utf16_icelandic_ci utf16_latvian_ci utf16_lithuanian_ci)
|
||||
define(UTFC5, utf16_persian_ci utf16_polish_ci utf16_romanian_ci)
|
||||
define(UTFC6, utf16_sinhala_ci utf16_slovak_ci utf16_slovenian_ci)
|
||||
define(UTFC7, utf16_spanish2_ci utf16_spanish_ci)
|
||||
define(UTFC8, utf16_swedish_ci utf16_turkish_ci)
|
||||
define(UTFC9, utf16_unicode_ci)
|
||||
UTFC="UTFC1 UTFC2 UTFC3 UTFC4 UTFC5 UTFC6 UTFC7 UTFC8 UTFC9"
|
||||
default_charset_collations="$UTFC"
|
||||
;;
|
||||
utf32)
|
||||
default_charset_default_collation="utf32_general_ci"
|
||||
define(UTFC1, utf32_general_ci utf32_bin)
|
||||
define(UTFC2, utf32_czech_ci utf32_danish_ci)
|
||||
define(UTFC3, utf32_esperanto_ci utf32_estonian_ci utf32_hungarian_ci)
|
||||
define(UTFC4, utf32_icelandic_ci utf32_latvian_ci utf32_lithuanian_ci)
|
||||
define(UTFC5, utf32_persian_ci utf32_polish_ci utf32_romanian_ci)
|
||||
define(UTFC6, utf32_sinhala_ci utf32_slovak_ci utf32_slovenian_ci)
|
||||
define(UTFC7, utf32_spanish2_ci utf32_spanish_ci)
|
||||
define(UTFC8, utf32_swedish_ci utf32_turkish_ci)
|
||||
define(UTFC9, utf32_unicode_ci)
|
||||
UTFC="UTFC1 UTFC2 UTFC3 UTFC4 UTFC5 UTFC6 UTFC7 UTFC8 UTFC9"
|
||||
default_charset_collations="$UTFC"
|
||||
;;
|
||||
*)
|
||||
AC_MSG_ERROR([Charset $cs not available. (Available are: $CHARSETS_AVAILABLE).
|
||||
See the Installation chapter in the Reference Manual.])
|
||||
|
@ -432,6 +432,9 @@ inline ulonglong double2ulonglong(double d)
|
||||
#define HAVE_CHARSET_ucs2 1
|
||||
#define HAVE_CHARSET_ujis 1
|
||||
#define HAVE_CHARSET_utf8 1
|
||||
#define HAVE_CHARSET_utf8mb4 1
|
||||
#define HAVE_CHARSET_utf16 1
|
||||
#define HAVE_CHARSET_utf32 1
|
||||
|
||||
#define HAVE_UCA_COLLATIONS 1
|
||||
#define HAVE_BOOL 1
|
||||
|
@ -98,13 +98,14 @@ extern MY_UNI_CTYPE my_uni_ctype[256];
|
||||
#define MY_CS_BINSORT 16 /* if binary sort order */
|
||||
#define MY_CS_PRIMARY 32 /* if primary collation */
|
||||
#define MY_CS_STRNXFRM 64 /* if strnxfrm is used for sort */
|
||||
#define MY_CS_UNICODE 128 /* is a charset is full unicode */
|
||||
#define MY_CS_UNICODE 128 /* is a charset is BMP Unicode */
|
||||
#define MY_CS_READY 256 /* if a charset is initialized */
|
||||
#define MY_CS_AVAILABLE 512 /* If either compiled-in or loaded*/
|
||||
#define MY_CS_CSSORT 1024 /* if case sensitive sort order */
|
||||
#define MY_CS_HIDDEN 2048 /* don't display in SHOW */
|
||||
#define MY_CS_PUREASCII 4096 /* if a charset is pure ascii */
|
||||
#define MY_CS_NONASCII 8192 /* if not ASCII-compatible */
|
||||
#define MY_CS_UNICODE_SUPPLEMENT 16384 /* Non-BMP Unicode characters */
|
||||
#define MY_CHARSET_UNDEFINED 0
|
||||
|
||||
/* Character repertoire flags */
|
||||
@ -112,7 +113,6 @@ extern MY_UNI_CTYPE my_uni_ctype[256];
|
||||
#define MY_REPERTOIRE_EXTENDED 2 /* Extended characters: U+0080..U+FFFF */
|
||||
#define MY_REPERTOIRE_UNICODE30 3 /* ASCII | EXTENDED: U+0000..U+FFFF */
|
||||
|
||||
|
||||
typedef struct my_uni_idx_st
|
||||
{
|
||||
uint16 from;
|
||||
@ -304,10 +304,14 @@ typedef struct charset_info_st
|
||||
|
||||
|
||||
extern MYSQL_PLUGIN_IMPORT CHARSET_INFO my_charset_bin;
|
||||
extern MYSQL_PLUGIN_IMPORT CHARSET_INFO my_charset_latin1;
|
||||
extern MYSQL_PLUGIN_IMPORT CHARSET_INFO my_charset_filename;
|
||||
|
||||
extern CHARSET_INFO my_charset_big5_chinese_ci;
|
||||
extern CHARSET_INFO my_charset_big5_bin;
|
||||
extern CHARSET_INFO my_charset_cp932_japanese_ci;
|
||||
extern CHARSET_INFO my_charset_cp932_bin;
|
||||
extern CHARSET_INFO my_charset_cp1250_czech_ci;
|
||||
extern CHARSET_INFO my_charset_eucjpms_japanese_ci;
|
||||
extern CHARSET_INFO my_charset_eucjpms_bin;
|
||||
extern CHARSET_INFO my_charset_euckr_korean_ci;
|
||||
@ -316,7 +320,6 @@ extern CHARSET_INFO my_charset_gb2312_chinese_ci;
|
||||
extern CHARSET_INFO my_charset_gb2312_bin;
|
||||
extern CHARSET_INFO my_charset_gbk_chinese_ci;
|
||||
extern CHARSET_INFO my_charset_gbk_bin;
|
||||
extern MYSQL_PLUGIN_IMPORT CHARSET_INFO my_charset_latin1;
|
||||
extern CHARSET_INFO my_charset_latin1_german2_ci;
|
||||
extern CHARSET_INFO my_charset_latin1_bin;
|
||||
extern CHARSET_INFO my_charset_latin2_czech_ci;
|
||||
@ -329,11 +332,22 @@ extern CHARSET_INFO my_charset_ucs2_bin;
|
||||
extern CHARSET_INFO my_charset_ucs2_unicode_ci;
|
||||
extern CHARSET_INFO my_charset_ujis_japanese_ci;
|
||||
extern CHARSET_INFO my_charset_ujis_bin;
|
||||
extern CHARSET_INFO my_charset_utf16_bin;
|
||||
extern CHARSET_INFO my_charset_utf16_general_ci;
|
||||
extern CHARSET_INFO my_charset_utf16_unicode_ci;
|
||||
extern CHARSET_INFO my_charset_utf32_bin;
|
||||
extern CHARSET_INFO my_charset_utf32_general_ci;
|
||||
extern CHARSET_INFO my_charset_utf32_unicode_ci;
|
||||
|
||||
extern CHARSET_INFO my_charset_utf8_general_ci;
|
||||
extern CHARSET_INFO my_charset_utf8_unicode_ci;
|
||||
extern CHARSET_INFO my_charset_utf8_bin;
|
||||
extern CHARSET_INFO my_charset_cp1250_czech_ci;
|
||||
extern MYSQL_PLUGIN_IMPORT CHARSET_INFO my_charset_filename;
|
||||
extern CHARSET_INFO my_charset_utf8mb4_bin;
|
||||
extern CHARSET_INFO my_charset_utf8mb4_general_ci;
|
||||
extern CHARSET_INFO my_charset_utf8mb4_unicode_ci;
|
||||
#define MY_UTF8MB3 "utf8"
|
||||
#define MY_UTF8MB4 "utf8mb4"
|
||||
|
||||
|
||||
/* declarations for simple charsets */
|
||||
extern size_t my_strnxfrm_simple(CHARSET_INFO *, uchar *, size_t,
|
||||
@ -430,6 +444,19 @@ my_bool my_like_range_ucs2(CHARSET_INFO *cs,
|
||||
char *min_str, char *max_str,
|
||||
size_t *min_length, size_t *max_length);
|
||||
|
||||
my_bool my_like_range_utf16(CHARSET_INFO *cs,
|
||||
const char *ptr, size_t ptr_length,
|
||||
pbool escape, pbool w_one, pbool w_many,
|
||||
size_t res_length,
|
||||
char *min_str, char *max_str,
|
||||
size_t *min_length, size_t *max_length);
|
||||
|
||||
my_bool my_like_range_utf32(CHARSET_INFO *cs,
|
||||
const char *ptr, size_t ptr_length,
|
||||
pbool escape, pbool w_one, pbool w_many,
|
||||
size_t res_length,
|
||||
char *min_str, char *max_str,
|
||||
size_t *min_length, size_t *max_length);
|
||||
|
||||
int my_wildcmp_8bit(CHARSET_INFO *,
|
||||
const char *str,const char *str_end,
|
||||
@ -480,6 +507,31 @@ uint my_instr_mb(struct charset_info_st *,
|
||||
const char *s, size_t s_length,
|
||||
my_match_t *match, uint nmatch);
|
||||
|
||||
int my_strnncoll_mb_bin(CHARSET_INFO * cs,
|
||||
const uchar *s, size_t slen,
|
||||
const uchar *t, size_t tlen,
|
||||
my_bool t_is_prefix);
|
||||
|
||||
int my_strnncollsp_mb_bin(CHARSET_INFO *cs,
|
||||
const uchar *a, size_t a_length,
|
||||
const uchar *b, size_t b_length,
|
||||
my_bool diff_if_only_endspace_difference);
|
||||
|
||||
int my_wildcmp_mb_bin(CHARSET_INFO *cs,
|
||||
const char *str,const char *str_end,
|
||||
const char *wildstr,const char *wildend,
|
||||
int escape, int w_one, int w_many);
|
||||
|
||||
int my_strcasecmp_mb_bin(CHARSET_INFO * cs __attribute__((unused)),
|
||||
const char *s, const char *t);
|
||||
|
||||
void my_hash_sort_mb_bin(CHARSET_INFO *cs __attribute__((unused)),
|
||||
const uchar *key, size_t len,ulong *nr1, ulong *nr2);
|
||||
|
||||
size_t my_strnxfrm_unicode(CHARSET_INFO *,
|
||||
uchar *dst, size_t dstlen,
|
||||
const uchar *src, size_t srclen);
|
||||
|
||||
int my_wildcmp_unicode(CHARSET_INFO *cs,
|
||||
const char *str, const char *str_end,
|
||||
const char *wildstr, const char *wildend,
|
||||
|
@ -937,10 +937,10 @@ bool Protocol::send_result_set_metadata(List<Item> *list, uint flags)
|
||||
strlen(server_field.org_table_name), cs, thd_cs);
|
||||
client_field->org_name= dup_str_aux(field_alloc, server_field.org_col_name,
|
||||
strlen(server_field.org_col_name), cs, thd_cs);
|
||||
if (item->collation.collation == &my_charset_bin || thd_cs == NULL)
|
||||
if (item->charset_for_protocol() == &my_charset_bin || thd_cs == NULL)
|
||||
{
|
||||
/* No conversion */
|
||||
client_field->charsetnr= server_field.charsetnr;
|
||||
client_field->charsetnr= item->charset_for_protocol()->number;
|
||||
client_field->length= server_field.length;
|
||||
}
|
||||
else
|
||||
|
11
mysql-test/include/ctype_datetime.inc
Normal file
11
mysql-test/include/ctype_datetime.inc
Normal file
@ -0,0 +1,11 @@
|
||||
#
|
||||
# Bug#32390 Character sets: casting utf32 to/from date doesn't work
|
||||
#
|
||||
CREATE TABLE t1 AS SELECT repeat('a',20) AS s1 LIMIT 0;
|
||||
SET timestamp=1216359724;
|
||||
INSERT INTO t1 VALUES (current_date);
|
||||
INSERT INTO t1 VALUES (current_time);
|
||||
INSERT INTO t1 VALUES (current_timestamp);
|
||||
SELECT s1, hex(s1) FROM t1;
|
||||
DROP TABLE t1;
|
||||
SET timestamp=0;
|
50
mysql-test/include/ctype_like.inc
Normal file
50
mysql-test/include/ctype_like.inc
Normal file
@ -0,0 +1,50 @@
|
||||
select @@collation_connection;
|
||||
|
||||
#
|
||||
# Create a table with a nullable varchar(10) column
|
||||
# using currect character_set_connection.
|
||||
create table t1 as select repeat(' ',10) as a union select null;
|
||||
alter table t1 add key(a);
|
||||
show create table t1;
|
||||
insert into t1 values ("a"),("abc"),("abcd"),("hello"),("test");
|
||||
explain select * from t1 where a like 'abc%';
|
||||
explain select * from t1 where a like concat('abc','%');
|
||||
select * from t1 where a like "abc%";
|
||||
select * from t1 where a like concat("abc","%");
|
||||
select * from t1 where a like "ABC%";
|
||||
select * from t1 where a like "test%";
|
||||
select * from t1 where a like "te_t";
|
||||
select * from t1 where a like "%a%";
|
||||
select * from t1 where a like "%abcd%";
|
||||
select * from t1 where a like "%abc\d%";
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug #2619 ucs2 LIKE comparison fails in some cases
|
||||
#
|
||||
|
||||
select 'AA' like 'AA';
|
||||
select 'AA' like 'A%A';
|
||||
select 'AA' like 'A%%A';
|
||||
select 'AA' like 'AA%';
|
||||
select 'AA' like '%AA%';
|
||||
select 'AA' like '%A';
|
||||
select 'AA' like '%AA';
|
||||
select 'AA' like 'A%A%';
|
||||
select 'AA' like '_%_%';
|
||||
select 'AA' like '%A%A';
|
||||
select 'AAA'like 'A%A%A';
|
||||
|
||||
select 'AZ' like 'AZ';
|
||||
select 'AZ' like 'A%Z';
|
||||
select 'AZ' like 'A%%Z';
|
||||
select 'AZ' like 'AZ%';
|
||||
select 'AZ' like '%AZ%';
|
||||
select 'AZ' like '%Z';
|
||||
select 'AZ' like '%AZ';
|
||||
select 'AZ' like 'A%Z%';
|
||||
select 'AZ' like '_%_%';
|
||||
select 'AZ' like '%A%Z';
|
||||
select 'AZ' like 'A_';
|
||||
select 'AZ' like '_Z';
|
||||
select 'AMZ'like 'A%M%Z';
|
1606
mysql-test/include/ctype_numconv.inc
Normal file
1606
mysql-test/include/ctype_numconv.inc
Normal file
File diff suppressed because it is too large
Load Diff
4
mysql-test/include/have_utf16.inc
Normal file
4
mysql-test/include/have_utf16.inc
Normal file
@ -0,0 +1,4 @@
|
||||
-- require r/have_utf16.require
|
||||
disable_query_log;
|
||||
show collation like 'utf16_general_ci';
|
||||
enable_query_log;
|
4
mysql-test/include/have_utf32.inc
Normal file
4
mysql-test/include/have_utf32.inc
Normal file
@ -0,0 +1,4 @@
|
||||
-- require r/have_utf32.require
|
||||
disable_query_log;
|
||||
show collation like 'utf32_general_ci';
|
||||
enable_query_log;
|
7
mysql-test/include/have_utf8mb4.inc
Normal file
7
mysql-test/include/have_utf8mb4.inc
Normal file
@ -0,0 +1,7 @@
|
||||
--require r/have_utf8mb4.require
|
||||
|
||||
--disable_query_log
|
||||
|
||||
SHOW COLLATION LIKE 'utf8mb4_general_ci';
|
||||
|
||||
--enable_query_log
|
@ -101,16 +101,16 @@ Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` varchar(1) CHARACTER SET latin1 COLLATE latin1_danish_ci NOT NULL DEFAULT '',
|
||||
`c2` varchar(1) CHARACTER SET latin1 COLLATE latin1_danish_ci NOT NULL DEFAULT '',
|
||||
`c3` varbinary(1) NOT NULL DEFAULT '',
|
||||
`c4` varbinary(1) NOT NULL DEFAULT '',
|
||||
`c5` varbinary(4) NOT NULL DEFAULT '',
|
||||
`c6` varbinary(4) NOT NULL DEFAULT '',
|
||||
`c3` varchar(1) NOT NULL DEFAULT '',
|
||||
`c4` varchar(1) NOT NULL DEFAULT '',
|
||||
`c5` varchar(4) NOT NULL DEFAULT '',
|
||||
`c6` varchar(4) NOT NULL DEFAULT '',
|
||||
`c7` decimal(2,1) NOT NULL DEFAULT '0.0',
|
||||
`c8` decimal(2,1) NOT NULL DEFAULT '0.0',
|
||||
`c9` decimal(2,1) DEFAULT NULL,
|
||||
`c10` double NOT NULL DEFAULT '0',
|
||||
`c11` double NOT NULL DEFAULT '0',
|
||||
`c12` varbinary(5) NOT NULL DEFAULT ''
|
||||
`c12` varchar(5) NOT NULL DEFAULT ''
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
DROP TABLE t1;
|
||||
SELECT CASE
|
||||
@ -155,8 +155,8 @@ t1 CREATE TABLE `t1` (
|
||||
`COALESCE(1.0)` decimal(2,1) NOT NULL DEFAULT '0.0',
|
||||
`COALESCE('a')` varchar(1) NOT NULL DEFAULT '',
|
||||
`COALESCE(1,1.0)` decimal(2,1) NOT NULL DEFAULT '0.0',
|
||||
`COALESCE(1,'1')` varbinary(1) NOT NULL DEFAULT '',
|
||||
`COALESCE(1.1,'1')` varbinary(4) NOT NULL DEFAULT '',
|
||||
`COALESCE(1,'1')` varchar(1) NOT NULL DEFAULT '',
|
||||
`COALESCE(1.1,'1')` varchar(4) NOT NULL DEFAULT '',
|
||||
`COALESCE('a' COLLATE latin1_bin,'b')` varchar(1) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL DEFAULT ''
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
DROP TABLE t1;
|
||||
|
@ -438,7 +438,7 @@ explain t2;
|
||||
Field Type Null Key Default Extra
|
||||
a int(11) YES NULL
|
||||
b bigint(11) NO 0
|
||||
c bigint(11) unsigned NO 0
|
||||
c bigint(10) unsigned NO 0
|
||||
d date YES NULL
|
||||
e varchar(1) NO
|
||||
f datetime YES NULL
|
||||
@ -457,7 +457,7 @@ Table Create Table
|
||||
t2 CREATE TABLE `t2` (
|
||||
`ifnull(a,a)` tinyint(4) DEFAULT NULL,
|
||||
`ifnull(b,b)` smallint(6) DEFAULT NULL,
|
||||
`ifnull(c,c)` mediumint(8) DEFAULT NULL,
|
||||
`ifnull(c,c)` mediumint(9) DEFAULT NULL,
|
||||
`ifnull(d,d)` int(11) DEFAULT NULL,
|
||||
`ifnull(e,e)` bigint(20) DEFAULT NULL,
|
||||
`ifnull(f,f)` float(3,2) DEFAULT NULL,
|
||||
|
2568
mysql-test/r/ctype_binary.result
Normal file
2568
mysql-test/r/ctype_binary.result
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -53,6 +53,33 @@ select * from t1 where c1='b';
|
||||
c1
|
||||
a
|
||||
drop table t1;
|
||||
show collation like 'utf8mb4_test_ci';
|
||||
Collation Charset Id Default Compiled Sortlen
|
||||
utf8mb4_test_ci utf8mb4 326 8
|
||||
create table t1 (c1 char(1) character set utf8mb4 collate utf8mb4_test_ci);
|
||||
insert into t1 values ('a');
|
||||
select * from t1 where c1='b';
|
||||
c1
|
||||
a
|
||||
drop table t1;
|
||||
show collation like 'utf16_test_ci';
|
||||
Collation Charset Id Default Compiled Sortlen
|
||||
utf16_test_ci utf16 327 8
|
||||
create table t1 (c1 char(1) character set utf16 collate utf16_test_ci);
|
||||
insert into t1 values ('a');
|
||||
select * from t1 where c1='b';
|
||||
c1
|
||||
a
|
||||
drop table t1;
|
||||
show collation like 'utf32_test_ci';
|
||||
Collation Charset Id Default Compiled Sortlen
|
||||
utf32_test_ci utf32 391 8
|
||||
create table t1 (c1 char(1) character set utf32 collate utf32_test_ci);
|
||||
insert into t1 values ('a');
|
||||
select * from t1 where c1='b';
|
||||
c1
|
||||
a
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (
|
||||
col1 varchar(100) character set utf8 collate utf8_test_ci
|
||||
);
|
||||
@ -373,16 +400,22 @@ select "foo" = "foo " collate latin1_test;
|
||||
The following tests check that two-byte collation IDs work
|
||||
select * from information_schema.collations where id>256 order by id;
|
||||
COLLATION_NAME CHARACTER_SET_NAME ID IS_DEFAULT IS_COMPILED SORTLEN
|
||||
utf8mb4_test_ci utf8mb4 326 8
|
||||
utf16_test_ci utf16 327 8
|
||||
utf8_phone_ci utf8 352 8
|
||||
utf8_test_ci utf8 353 8
|
||||
ucs2_test_ci ucs2 358 8
|
||||
ucs2_vn_ci ucs2 359 8
|
||||
utf32_test_ci utf32 391 8
|
||||
utf8_maxuserid_ci utf8 2047 8
|
||||
show collation like '%test%';
|
||||
Collation Charset Id Default Compiled Sortlen
|
||||
latin1_test latin1 99 Yes 1
|
||||
utf8_test_ci utf8 353 8
|
||||
ucs2_test_ci ucs2 358 8
|
||||
utf8mb4_test_ci utf8mb4 326 8
|
||||
utf16_test_ci utf16 327 8
|
||||
utf32_test_ci utf32 391 8
|
||||
show collation like 'ucs2_vn_ci';
|
||||
Collation Charset Id Default Compiled Sortlen
|
||||
ucs2_vn_ci ucs2 359 8
|
||||
|
@ -1683,3 +1683,59 @@ ARMENIAN CAPIT DA 2
|
||||
ARMENIAN CAPIT ECH 2
|
||||
ARMENIAN CAPIT ZA 2
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# WL#1213 Implement 4-byte UTF8, UTF16 and UTF32
|
||||
# Testing that only utf8mb4 is superset for utf8
|
||||
# No other Unicode character set pairs have superset/subset relations
|
||||
#
|
||||
CREATE TABLE t1 (
|
||||
utf8 CHAR CHARACTER SET utf8,
|
||||
utf8mb4 CHAR CHARACTER SET utf8mb4,
|
||||
ucs2 CHAR CHARACTER SET ucs2,
|
||||
utf16 CHAR CHARACTER SET utf16,
|
||||
utf32 CHAR CHARACTER SET utf32
|
||||
);
|
||||
INSERT INTO t1 VALUES ('','','','','');
|
||||
SELECT CHARSET(CONCAT(utf8, utf8mb4)) FROM t1;
|
||||
CHARSET(CONCAT(utf8, utf8mb4))
|
||||
utf8mb4
|
||||
SELECT CHARSET(CONCAT(utf8, ucs2)) FROM t1;
|
||||
ERROR HY000: Illegal mix of collations (utf8_general_ci,IMPLICIT) and (ucs2_general_ci,IMPLICIT) for operation 'concat'
|
||||
SELECT CHARSET(CONCAT(utf8, utf16)) FROM t1;
|
||||
ERROR HY000: Illegal mix of collations (utf8_general_ci,IMPLICIT) and (utf16_general_ci,IMPLICIT) for operation 'concat'
|
||||
SELECT CHARSET(CONCAT(utf8, utf32)) FROM t1;
|
||||
ERROR HY000: Illegal mix of collations (utf8_general_ci,IMPLICIT) and (utf32_general_ci,IMPLICIT) for operation 'concat'
|
||||
SELECT CHARSET(CONCAT(utf8mb4, utf8)) FROM t1;
|
||||
CHARSET(CONCAT(utf8mb4, utf8))
|
||||
utf8mb4
|
||||
SELECT CHARSET(CONCAT(utf8mb4, ucs2)) FROM t1;
|
||||
ERROR HY000: Illegal mix of collations (utf8mb4_general_ci,IMPLICIT) and (ucs2_general_ci,IMPLICIT) for operation 'concat'
|
||||
SELECT CHARSET(CONCAT(utf8mb4, utf16)) FROM t1;
|
||||
ERROR HY000: Illegal mix of collations (utf8mb4_general_ci,IMPLICIT) and (utf16_general_ci,IMPLICIT) for operation 'concat'
|
||||
SELECT CHARSET(CONCAT(utf8mb4, utf32)) FROM t1;
|
||||
ERROR HY000: Illegal mix of collations (utf8mb4_general_ci,IMPLICIT) and (utf32_general_ci,IMPLICIT) for operation 'concat'
|
||||
SELECT CHARSET(CONCAT(ucs2, utf8)) FROM t1;
|
||||
ERROR HY000: Illegal mix of collations (ucs2_general_ci,IMPLICIT) and (utf8_general_ci,IMPLICIT) for operation 'concat'
|
||||
SELECT CHARSET(CONCAT(ucs2, utf8mb4)) FROM t1;
|
||||
ERROR HY000: Illegal mix of collations (ucs2_general_ci,IMPLICIT) and (utf8mb4_general_ci,IMPLICIT) for operation 'concat'
|
||||
SELECT CHARSET(CONCAT(ucs2, utf16)) FROM t1;
|
||||
ERROR HY000: Illegal mix of collations (ucs2_general_ci,IMPLICIT) and (utf16_general_ci,IMPLICIT) for operation 'concat'
|
||||
SELECT CHARSET(CONCAT(ucs2, utf32)) FROM t1;
|
||||
ERROR HY000: Illegal mix of collations (ucs2_general_ci,IMPLICIT) and (utf32_general_ci,IMPLICIT) for operation 'concat'
|
||||
SELECT CHARSET(CONCAT(utf16, utf8)) FROM t1;
|
||||
ERROR HY000: Illegal mix of collations (utf16_general_ci,IMPLICIT) and (utf8_general_ci,IMPLICIT) for operation 'concat'
|
||||
SELECT CHARSET(CONCAT(utf16, ucs2)) FROM t1;
|
||||
ERROR HY000: Illegal mix of collations (utf16_general_ci,IMPLICIT) and (ucs2_general_ci,IMPLICIT) for operation 'concat'
|
||||
SELECT CHARSET(CONCAT(utf16, utf8mb4)) FROM t1;
|
||||
ERROR HY000: Illegal mix of collations (utf16_general_ci,IMPLICIT) and (utf8mb4_general_ci,IMPLICIT) for operation 'concat'
|
||||
SELECT CHARSET(CONCAT(utf16, utf32)) FROM t1;
|
||||
ERROR HY000: Illegal mix of collations (utf16_general_ci,IMPLICIT) and (utf32_general_ci,IMPLICIT) for operation 'concat'
|
||||
SELECT CHARSET(CONCAT(utf32, utf8)) FROM t1;
|
||||
ERROR HY000: Illegal mix of collations (utf32_general_ci,IMPLICIT) and (utf8_general_ci,IMPLICIT) for operation 'concat'
|
||||
SELECT CHARSET(CONCAT(utf32, ucs2)) FROM t1;
|
||||
ERROR HY000: Illegal mix of collations (utf32_general_ci,IMPLICIT) and (ucs2_general_ci,IMPLICIT) for operation 'concat'
|
||||
SELECT CHARSET(CONCAT(utf32, utf8mb4)) FROM t1;
|
||||
ERROR HY000: Illegal mix of collations (utf32_general_ci,IMPLICIT) and (utf8mb4_general_ci,IMPLICIT) for operation 'concat'
|
||||
SELECT CHARSET(CONCAT(utf32, utf16)) FROM t1;
|
||||
ERROR HY000: Illegal mix of collations (utf32_general_ci,IMPLICIT) and (utf16_general_ci,IMPLICIT) for operation 'concat'
|
||||
DROP TABLE t1;
|
||||
|
File diff suppressed because it is too large
Load Diff
1038
mysql-test/r/ctype_utf16.result
Normal file
1038
mysql-test/r/ctype_utf16.result
Normal file
File diff suppressed because it is too large
Load Diff
2373
mysql-test/r/ctype_utf16_uca.result
Normal file
2373
mysql-test/r/ctype_utf16_uca.result
Normal file
File diff suppressed because it is too large
Load Diff
1052
mysql-test/r/ctype_utf32.result
Normal file
1052
mysql-test/r/ctype_utf32.result
Normal file
File diff suppressed because it is too large
Load Diff
2373
mysql-test/r/ctype_utf32_uca.result
Normal file
2373
mysql-test/r/ctype_utf32_uca.result
Normal file
File diff suppressed because it is too large
Load Diff
@ -1899,6 +1899,20 @@ CONVERT(a, CHAR) CONVERT(b, CHAR)
|
||||
DROP TABLE t1;
|
||||
End of 5.0 tests
|
||||
Start of 5.4 tests
|
||||
SET NAMES utf8mb3;
|
||||
SHOW VARIABLES LIKE 'character_set_results%';
|
||||
Variable_name Value
|
||||
character_set_results utf8
|
||||
CREATE TABLE t1 (a CHAR CHARACTER SET utf8mb3 COLLATE utf8mb3_bin);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` char(1) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
DROP TABLE t1;
|
||||
SELECT _utf8mb3'test';
|
||||
test
|
||||
test
|
||||
CREATE TABLE t1 (
|
||||
clipid INT NOT NULL,
|
||||
Tape TINYTEXT,
|
||||
|
2238
mysql-test/r/ctype_utf8mb4.result
Normal file
2238
mysql-test/r/ctype_utf8mb4.result
Normal file
File diff suppressed because it is too large
Load Diff
@ -625,7 +625,7 @@ insert into t1 values (1,repeat('a',255)),(2,repeat('b',255));
|
||||
select f2,group_concat(f1) from t1 group by f2;
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def test t1 t1 f2 f2 253 255 255 Y 0 0 8
|
||||
def group_concat(f1) 253 400 1 Y 128 0 63
|
||||
def group_concat(f1) 253 400 1 Y 0 0 8
|
||||
f2 group_concat(f1)
|
||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 1
|
||||
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb 2
|
||||
@ -737,7 +737,7 @@ insert into t1 values (1,repeat('a',255)),(2,repeat('b',255));
|
||||
select f2,group_concat(f1) from t1 group by f2;
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def test t1 t1 f2 f2 253 255 255 Y 0 0 8
|
||||
def group_concat(f1) 252 1024 1 Y 128 0 63
|
||||
def group_concat(f1) 252 1024 1 Y 0 0 8
|
||||
f2 group_concat(f1)
|
||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 1
|
||||
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb 2
|
||||
|
@ -761,7 +761,7 @@ latin2 latin2_general_ci 2
|
||||
drop table t1;
|
||||
select charset(null), collation(null), coercibility(null);
|
||||
charset(null) collation(null) coercibility(null)
|
||||
binary binary 5
|
||||
binary binary 6
|
||||
CREATE TABLE t1 (a int, b int);
|
||||
CREATE TABLE t2 (a int, b int);
|
||||
INSERT INTO t1 VALUES (1,1),(2,2);
|
||||
@ -777,7 +777,7 @@ a b a b
|
||||
1 1 NULL NULL
|
||||
2 2 2 2
|
||||
select t1.*,t2.* from t1 left join t2 on (t1.b=t2.b)
|
||||
where coercibility(t2.a) = 2 order by t1.a,t2.a;
|
||||
where coercibility(t2.a) = 5 order by t1.a,t2.a;
|
||||
a b a b
|
||||
1 1 NULL NULL
|
||||
2 2 2 2
|
||||
@ -1230,13 +1230,13 @@ create table t1 (i int);
|
||||
insert into t1 values (1000000000),(1);
|
||||
select lpad(i, 7, ' ') as t from t1;
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def t 253 7 7 Y 128 31 63
|
||||
def t 253 7 7 Y 0 31 8
|
||||
t
|
||||
1000000
|
||||
1
|
||||
select rpad(i, 7, ' ') as t from t1;
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def t 253 7 7 Y 128 31 63
|
||||
def t 253 7 7 Y 0 31 8
|
||||
t
|
||||
1000000
|
||||
1
|
||||
|
2
mysql-test/r/have_utf16.require
Normal file
2
mysql-test/r/have_utf16.require
Normal file
@ -0,0 +1,2 @@
|
||||
Collation Charset Id Default Compiled Sortlen
|
||||
utf16_general_ci utf16 54 Yes Yes 1
|
2
mysql-test/r/have_utf32.require
Normal file
2
mysql-test/r/have_utf32.require
Normal file
@ -0,0 +1,2 @@
|
||||
Collation Charset Id Default Compiled Sortlen
|
||||
utf32_general_ci utf32 60 Yes Yes 1
|
2
mysql-test/r/have_utf8mb4.require
Normal file
2
mysql-test/r/have_utf8mb4.require
Normal file
@ -0,0 +1,2 @@
|
||||
Collation Charset Id Default Compiled Sortlen
|
||||
utf8mb4_general_ci utf8mb4 45 Yes Yes 1
|
@ -126,7 +126,7 @@ renamed
|
||||
1
|
||||
select * from v3 where renamed=1 group by renamed;
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def v3 v3 renamed renamed 8 12 0 Y 32896 0 63
|
||||
def v3 v3 renamed renamed 8 11 0 Y 32896 0 63
|
||||
renamed
|
||||
drop table t1;
|
||||
drop view v1,v2,v3;
|
||||
|
@ -1788,11 +1788,11 @@ t5 CREATE TABLE `t5` (
|
||||
`const06` varchar(10) NOT NULL DEFAULT '',
|
||||
`param06` longtext,
|
||||
`const07` date DEFAULT NULL,
|
||||
`param07` longblob,
|
||||
`param07` longtext,
|
||||
`const08` varchar(19) NOT NULL DEFAULT '',
|
||||
`param08` longtext,
|
||||
`const09` datetime DEFAULT NULL,
|
||||
`param09` longblob,
|
||||
`param09` longtext,
|
||||
`const10` int(10) NOT NULL DEFAULT '0',
|
||||
`param10` bigint(20) DEFAULT NULL,
|
||||
`const11` int(4) DEFAULT NULL,
|
||||
@ -1818,11 +1818,11 @@ def test t5 t5 param05 param05 252 4294967295 3 Y 144 0 63
|
||||
def test t5 t5 const06 const06 253 10 10 N 1 0 8
|
||||
def test t5 t5 param06 param06 252 4294967295 10 Y 16 0 8
|
||||
def test t5 t5 const07 const07 10 10 10 Y 128 0 63
|
||||
def test t5 t5 param07 param07 252 4294967295 10 Y 144 0 63
|
||||
def test t5 t5 param07 param07 252 4294967295 10 Y 16 0 8
|
||||
def test t5 t5 const08 const08 253 19 19 N 1 0 8
|
||||
def test t5 t5 param08 param08 252 4294967295 19 Y 16 0 8
|
||||
def test t5 t5 const09 const09 12 19 19 Y 128 0 63
|
||||
def test t5 t5 param09 param09 252 4294967295 19 Y 144 0 63
|
||||
def test t5 t5 param09 param09 252 4294967295 19 Y 16 0 8
|
||||
def test t5 t5 const10 const10 3 10 9 N 32769 0 63
|
||||
def test t5 t5 param10 param10 8 20 9 Y 32768 0 63
|
||||
def test t5 t5 const11 const11 3 4 4 Y 32768 0 63
|
||||
@ -1929,10 +1929,10 @@ def @arg09 5 23 1 Y 32896 31 63
|
||||
def @arg10 5 23 1 Y 32896 31 63
|
||||
def @arg11 246 83 6 Y 32896 30 63
|
||||
def @arg12 246 83 6 Y 32896 30 63
|
||||
def @arg13 251 16777216 10 Y 128 31 63
|
||||
def @arg14 251 16777216 19 Y 128 31 63
|
||||
def @arg15 251 16777216 19 Y 128 31 63
|
||||
def @arg16 251 16777216 8 Y 128 31 63
|
||||
def @arg13 251 16777216 10 Y 0 31 8
|
||||
def @arg14 251 16777216 19 Y 0 31 8
|
||||
def @arg15 251 16777216 19 Y 0 31 8
|
||||
def @arg16 251 16777216 8 Y 0 31 8
|
||||
def @arg17 8 20 4 Y 32928 0 63
|
||||
def @arg18 8 20 1 Y 32896 0 63
|
||||
def @arg19 8 20 1 Y 32896 0 63
|
||||
@ -1976,10 +1976,10 @@ def @arg09 5 23 0 Y 32896 31 63
|
||||
def @arg10 5 23 0 Y 32896 31 63
|
||||
def @arg11 246 83 0 Y 32896 30 63
|
||||
def @arg12 246 83 0 Y 32896 30 63
|
||||
def @arg13 251 16777216 0 Y 128 31 63
|
||||
def @arg14 251 16777216 0 Y 128 31 63
|
||||
def @arg15 251 16777216 19 Y 128 31 63
|
||||
def @arg16 251 16777216 0 Y 128 31 63
|
||||
def @arg13 251 16777216 0 Y 0 31 8
|
||||
def @arg14 251 16777216 0 Y 0 31 8
|
||||
def @arg15 251 16777216 19 Y 0 31 8
|
||||
def @arg16 251 16777216 0 Y 0 31 8
|
||||
def @arg17 8 20 0 Y 32928 0 63
|
||||
def @arg18 8 20 0 Y 32896 0 63
|
||||
def @arg19 8 20 0 Y 32896 0 63
|
||||
@ -2026,10 +2026,10 @@ def @arg09 5 23 1 Y 32896 31 63
|
||||
def @arg10 5 23 1 Y 32896 31 63
|
||||
def @arg11 246 83 6 Y 32896 30 63
|
||||
def @arg12 246 83 6 Y 32896 30 63
|
||||
def @arg13 251 16777216 10 Y 128 31 63
|
||||
def @arg14 251 16777216 19 Y 128 31 63
|
||||
def @arg15 251 16777216 19 Y 128 31 63
|
||||
def @arg16 251 16777216 8 Y 128 31 63
|
||||
def @arg13 251 16777216 10 Y 0 31 8
|
||||
def @arg14 251 16777216 19 Y 0 31 8
|
||||
def @arg15 251 16777216 19 Y 0 31 8
|
||||
def @arg16 251 16777216 8 Y 0 31 8
|
||||
def @arg17 8 20 4 Y 32928 0 63
|
||||
def @arg18 8 20 1 Y 32896 0 63
|
||||
def @arg19 8 20 1 Y 32896 0 63
|
||||
@ -2066,10 +2066,10 @@ def @arg09 5 23 0 Y 32896 31 63
|
||||
def @arg10 5 23 0 Y 32896 31 63
|
||||
def @arg11 246 83 0 Y 32896 30 63
|
||||
def @arg12 246 83 0 Y 32896 30 63
|
||||
def @arg13 251 16777216 0 Y 128 31 63
|
||||
def @arg14 251 16777216 0 Y 128 31 63
|
||||
def @arg15 251 16777216 19 Y 128 31 63
|
||||
def @arg16 251 16777216 0 Y 128 31 63
|
||||
def @arg13 251 16777216 0 Y 0 31 8
|
||||
def @arg14 251 16777216 0 Y 0 31 8
|
||||
def @arg15 251 16777216 19 Y 0 31 8
|
||||
def @arg16 251 16777216 0 Y 0 31 8
|
||||
def @arg17 8 20 0 Y 32928 0 63
|
||||
def @arg18 8 20 0 Y 32896 0 63
|
||||
def @arg19 8 20 0 Y 32896 0 63
|
||||
@ -2114,10 +2114,10 @@ def @arg09 5 23 1 Y 32896 31 63
|
||||
def @arg10 5 23 1 Y 32896 31 63
|
||||
def @arg11 246 83 6 Y 32896 30 63
|
||||
def @arg12 246 83 6 Y 32896 30 63
|
||||
def @arg13 251 16777216 10 Y 128 31 63
|
||||
def @arg14 251 16777216 19 Y 128 31 63
|
||||
def @arg15 251 16777216 19 Y 128 31 63
|
||||
def @arg16 251 16777216 8 Y 128 31 63
|
||||
def @arg13 251 16777216 10 Y 0 31 8
|
||||
def @arg14 251 16777216 19 Y 0 31 8
|
||||
def @arg15 251 16777216 19 Y 0 31 8
|
||||
def @arg16 251 16777216 8 Y 0 31 8
|
||||
def @arg17 8 20 4 Y 32928 0 63
|
||||
def @arg18 8 20 1 Y 32896 0 63
|
||||
def @arg19 8 20 1 Y 32896 0 63
|
||||
@ -2158,10 +2158,10 @@ def @arg09 5 23 0 Y 32896 31 63
|
||||
def @arg10 5 23 0 Y 32896 31 63
|
||||
def @arg11 246 83 0 Y 32896 30 63
|
||||
def @arg12 246 83 0 Y 32896 30 63
|
||||
def @arg13 251 16777216 0 Y 128 31 63
|
||||
def @arg14 251 16777216 0 Y 128 31 63
|
||||
def @arg15 251 16777216 19 Y 128 31 63
|
||||
def @arg16 251 16777216 0 Y 128 31 63
|
||||
def @arg13 251 16777216 0 Y 0 31 8
|
||||
def @arg14 251 16777216 0 Y 0 31 8
|
||||
def @arg15 251 16777216 19 Y 0 31 8
|
||||
def @arg16 251 16777216 0 Y 0 31 8
|
||||
def @arg17 8 20 0 Y 32928 0 63
|
||||
def @arg18 8 20 0 Y 32896 0 63
|
||||
def @arg19 8 20 0 Y 32896 0 63
|
||||
@ -2204,10 +2204,10 @@ def @arg09 5 23 1 Y 32896 31 63
|
||||
def @arg10 5 23 1 Y 32896 31 63
|
||||
def @arg11 246 83 6 Y 32896 30 63
|
||||
def @arg12 246 83 6 Y 32896 30 63
|
||||
def @arg13 251 16777216 10 Y 128 31 63
|
||||
def @arg14 251 16777216 19 Y 128 31 63
|
||||
def @arg15 251 16777216 19 Y 128 31 63
|
||||
def @arg16 251 16777216 8 Y 128 31 63
|
||||
def @arg13 251 16777216 10 Y 0 31 8
|
||||
def @arg14 251 16777216 19 Y 0 31 8
|
||||
def @arg15 251 16777216 19 Y 0 31 8
|
||||
def @arg16 251 16777216 8 Y 0 31 8
|
||||
def @arg17 8 20 4 Y 32928 0 63
|
||||
def @arg18 8 20 1 Y 32896 0 63
|
||||
def @arg19 8 20 1 Y 32896 0 63
|
||||
@ -2242,10 +2242,10 @@ def @arg09 5 23 0 Y 32896 31 63
|
||||
def @arg10 5 23 0 Y 32896 31 63
|
||||
def @arg11 246 83 0 Y 32896 30 63
|
||||
def @arg12 246 83 0 Y 32896 30 63
|
||||
def @arg13 251 16777216 0 Y 128 31 63
|
||||
def @arg14 251 16777216 0 Y 128 31 63
|
||||
def @arg15 251 16777216 19 Y 128 31 63
|
||||
def @arg16 251 16777216 0 Y 128 31 63
|
||||
def @arg13 251 16777216 0 Y 0 31 8
|
||||
def @arg14 251 16777216 0 Y 0 31 8
|
||||
def @arg15 251 16777216 19 Y 0 31 8
|
||||
def @arg16 251 16777216 0 Y 0 31 8
|
||||
def @arg17 8 20 0 Y 32928 0 63
|
||||
def @arg18 8 20 0 Y 32896 0 63
|
||||
def @arg19 8 20 0 Y 32896 0 63
|
||||
|
@ -1771,11 +1771,11 @@ t5 CREATE TABLE `t5` (
|
||||
`const06` varchar(10) NOT NULL DEFAULT '',
|
||||
`param06` longtext,
|
||||
`const07` date DEFAULT NULL,
|
||||
`param07` longblob,
|
||||
`param07` longtext,
|
||||
`const08` varchar(19) NOT NULL DEFAULT '',
|
||||
`param08` longtext,
|
||||
`const09` datetime DEFAULT NULL,
|
||||
`param09` longblob,
|
||||
`param09` longtext,
|
||||
`const10` int(10) NOT NULL DEFAULT '0',
|
||||
`param10` bigint(20) DEFAULT NULL,
|
||||
`const11` int(4) DEFAULT NULL,
|
||||
@ -1801,11 +1801,11 @@ def test t5 t5 param05 param05 252 4294967295 3 Y 144 0 63
|
||||
def test t5 t5 const06 const06 253 10 10 N 1 0 8
|
||||
def test t5 t5 param06 param06 252 4294967295 10 Y 16 0 8
|
||||
def test t5 t5 const07 const07 10 10 10 Y 128 0 63
|
||||
def test t5 t5 param07 param07 252 4294967295 10 Y 144 0 63
|
||||
def test t5 t5 param07 param07 252 4294967295 10 Y 16 0 8
|
||||
def test t5 t5 const08 const08 253 19 19 N 1 0 8
|
||||
def test t5 t5 param08 param08 252 4294967295 19 Y 16 0 8
|
||||
def test t5 t5 const09 const09 12 19 19 Y 128 0 63
|
||||
def test t5 t5 param09 param09 252 4294967295 19 Y 144 0 63
|
||||
def test t5 t5 param09 param09 252 4294967295 19 Y 16 0 8
|
||||
def test t5 t5 const10 const10 3 10 9 N 32769 0 63
|
||||
def test t5 t5 param10 param10 8 20 9 Y 32768 0 63
|
||||
def test t5 t5 const11 const11 3 4 4 Y 32768 0 63
|
||||
@ -1912,10 +1912,10 @@ def @arg09 5 23 1 Y 32896 31 63
|
||||
def @arg10 5 23 1 Y 32896 31 63
|
||||
def @arg11 246 83 6 Y 32896 30 63
|
||||
def @arg12 246 83 6 Y 32896 30 63
|
||||
def @arg13 251 16777216 10 Y 128 31 63
|
||||
def @arg14 251 16777216 19 Y 128 31 63
|
||||
def @arg15 251 16777216 19 Y 128 31 63
|
||||
def @arg16 251 16777216 8 Y 128 31 63
|
||||
def @arg13 251 16777216 10 Y 0 31 8
|
||||
def @arg14 251 16777216 19 Y 0 31 8
|
||||
def @arg15 251 16777216 19 Y 0 31 8
|
||||
def @arg16 251 16777216 8 Y 0 31 8
|
||||
def @arg17 8 20 4 Y 32928 0 63
|
||||
def @arg18 8 20 1 Y 32896 0 63
|
||||
def @arg19 8 20 1 Y 32896 0 63
|
||||
@ -1959,10 +1959,10 @@ def @arg09 5 23 0 Y 32896 31 63
|
||||
def @arg10 5 23 0 Y 32896 31 63
|
||||
def @arg11 246 83 0 Y 32896 30 63
|
||||
def @arg12 246 83 0 Y 32896 30 63
|
||||
def @arg13 251 16777216 0 Y 128 31 63
|
||||
def @arg14 251 16777216 0 Y 128 31 63
|
||||
def @arg15 251 16777216 19 Y 128 31 63
|
||||
def @arg16 251 16777216 0 Y 128 31 63
|
||||
def @arg13 251 16777216 0 Y 0 31 8
|
||||
def @arg14 251 16777216 0 Y 0 31 8
|
||||
def @arg15 251 16777216 19 Y 0 31 8
|
||||
def @arg16 251 16777216 0 Y 0 31 8
|
||||
def @arg17 8 20 0 Y 32928 0 63
|
||||
def @arg18 8 20 0 Y 32896 0 63
|
||||
def @arg19 8 20 0 Y 32896 0 63
|
||||
@ -2009,10 +2009,10 @@ def @arg09 5 23 1 Y 32896 31 63
|
||||
def @arg10 5 23 1 Y 32896 31 63
|
||||
def @arg11 246 83 6 Y 32896 30 63
|
||||
def @arg12 246 83 6 Y 32896 30 63
|
||||
def @arg13 251 16777216 10 Y 128 31 63
|
||||
def @arg14 251 16777216 19 Y 128 31 63
|
||||
def @arg15 251 16777216 19 Y 128 31 63
|
||||
def @arg16 251 16777216 8 Y 128 31 63
|
||||
def @arg13 251 16777216 10 Y 0 31 8
|
||||
def @arg14 251 16777216 19 Y 0 31 8
|
||||
def @arg15 251 16777216 19 Y 0 31 8
|
||||
def @arg16 251 16777216 8 Y 0 31 8
|
||||
def @arg17 8 20 4 Y 32928 0 63
|
||||
def @arg18 8 20 1 Y 32896 0 63
|
||||
def @arg19 8 20 1 Y 32896 0 63
|
||||
@ -2049,10 +2049,10 @@ def @arg09 5 23 0 Y 32896 31 63
|
||||
def @arg10 5 23 0 Y 32896 31 63
|
||||
def @arg11 246 83 0 Y 32896 30 63
|
||||
def @arg12 246 83 0 Y 32896 30 63
|
||||
def @arg13 251 16777216 0 Y 128 31 63
|
||||
def @arg14 251 16777216 0 Y 128 31 63
|
||||
def @arg15 251 16777216 19 Y 128 31 63
|
||||
def @arg16 251 16777216 0 Y 128 31 63
|
||||
def @arg13 251 16777216 0 Y 0 31 8
|
||||
def @arg14 251 16777216 0 Y 0 31 8
|
||||
def @arg15 251 16777216 19 Y 0 31 8
|
||||
def @arg16 251 16777216 0 Y 0 31 8
|
||||
def @arg17 8 20 0 Y 32928 0 63
|
||||
def @arg18 8 20 0 Y 32896 0 63
|
||||
def @arg19 8 20 0 Y 32896 0 63
|
||||
@ -2097,10 +2097,10 @@ def @arg09 5 23 1 Y 32896 31 63
|
||||
def @arg10 5 23 1 Y 32896 31 63
|
||||
def @arg11 246 83 6 Y 32896 30 63
|
||||
def @arg12 246 83 6 Y 32896 30 63
|
||||
def @arg13 251 16777216 10 Y 128 31 63
|
||||
def @arg14 251 16777216 19 Y 128 31 63
|
||||
def @arg15 251 16777216 19 Y 128 31 63
|
||||
def @arg16 251 16777216 8 Y 128 31 63
|
||||
def @arg13 251 16777216 10 Y 0 31 8
|
||||
def @arg14 251 16777216 19 Y 0 31 8
|
||||
def @arg15 251 16777216 19 Y 0 31 8
|
||||
def @arg16 251 16777216 8 Y 0 31 8
|
||||
def @arg17 8 20 4 Y 32928 0 63
|
||||
def @arg18 8 20 1 Y 32896 0 63
|
||||
def @arg19 8 20 1 Y 32896 0 63
|
||||
@ -2141,10 +2141,10 @@ def @arg09 5 23 0 Y 32896 31 63
|
||||
def @arg10 5 23 0 Y 32896 31 63
|
||||
def @arg11 246 83 0 Y 32896 30 63
|
||||
def @arg12 246 83 0 Y 32896 30 63
|
||||
def @arg13 251 16777216 0 Y 128 31 63
|
||||
def @arg14 251 16777216 0 Y 128 31 63
|
||||
def @arg15 251 16777216 19 Y 128 31 63
|
||||
def @arg16 251 16777216 0 Y 128 31 63
|
||||
def @arg13 251 16777216 0 Y 0 31 8
|
||||
def @arg14 251 16777216 0 Y 0 31 8
|
||||
def @arg15 251 16777216 19 Y 0 31 8
|
||||
def @arg16 251 16777216 0 Y 0 31 8
|
||||
def @arg17 8 20 0 Y 32928 0 63
|
||||
def @arg18 8 20 0 Y 32896 0 63
|
||||
def @arg19 8 20 0 Y 32896 0 63
|
||||
@ -2187,10 +2187,10 @@ def @arg09 5 23 1 Y 32896 31 63
|
||||
def @arg10 5 23 1 Y 32896 31 63
|
||||
def @arg11 246 83 6 Y 32896 30 63
|
||||
def @arg12 246 83 6 Y 32896 30 63
|
||||
def @arg13 251 16777216 10 Y 128 31 63
|
||||
def @arg14 251 16777216 19 Y 128 31 63
|
||||
def @arg15 251 16777216 19 Y 128 31 63
|
||||
def @arg16 251 16777216 8 Y 128 31 63
|
||||
def @arg13 251 16777216 10 Y 0 31 8
|
||||
def @arg14 251 16777216 19 Y 0 31 8
|
||||
def @arg15 251 16777216 19 Y 0 31 8
|
||||
def @arg16 251 16777216 8 Y 0 31 8
|
||||
def @arg17 8 20 4 Y 32928 0 63
|
||||
def @arg18 8 20 1 Y 32896 0 63
|
||||
def @arg19 8 20 1 Y 32896 0 63
|
||||
@ -2225,10 +2225,10 @@ def @arg09 5 23 0 Y 32896 31 63
|
||||
def @arg10 5 23 0 Y 32896 31 63
|
||||
def @arg11 246 83 0 Y 32896 30 63
|
||||
def @arg12 246 83 0 Y 32896 30 63
|
||||
def @arg13 251 16777216 0 Y 128 31 63
|
||||
def @arg14 251 16777216 0 Y 128 31 63
|
||||
def @arg15 251 16777216 19 Y 128 31 63
|
||||
def @arg16 251 16777216 0 Y 128 31 63
|
||||
def @arg13 251 16777216 0 Y 0 31 8
|
||||
def @arg14 251 16777216 0 Y 0 31 8
|
||||
def @arg15 251 16777216 19 Y 0 31 8
|
||||
def @arg16 251 16777216 0 Y 0 31 8
|
||||
def @arg17 8 20 0 Y 32928 0 63
|
||||
def @arg18 8 20 0 Y 32896 0 63
|
||||
def @arg19 8 20 0 Y 32896 0 63
|
||||
|
@ -1772,11 +1772,11 @@ t5 CREATE TABLE `t5` (
|
||||
`const06` varchar(10) NOT NULL DEFAULT '',
|
||||
`param06` longtext,
|
||||
`const07` date DEFAULT NULL,
|
||||
`param07` longblob,
|
||||
`param07` longtext,
|
||||
`const08` varchar(19) NOT NULL DEFAULT '',
|
||||
`param08` longtext,
|
||||
`const09` datetime DEFAULT NULL,
|
||||
`param09` longblob,
|
||||
`param09` longtext,
|
||||
`const10` int(10) NOT NULL DEFAULT '0',
|
||||
`param10` bigint(20) DEFAULT NULL,
|
||||
`const11` int(4) DEFAULT NULL,
|
||||
@ -1802,11 +1802,11 @@ def test t5 t5 param05 param05 252 4294967295 3 Y 144 0 63
|
||||
def test t5 t5 const06 const06 253 10 10 N 1 0 8
|
||||
def test t5 t5 param06 param06 252 4294967295 10 Y 16 0 8
|
||||
def test t5 t5 const07 const07 10 10 10 Y 128 0 63
|
||||
def test t5 t5 param07 param07 252 4294967295 10 Y 144 0 63
|
||||
def test t5 t5 param07 param07 252 4294967295 10 Y 16 0 8
|
||||
def test t5 t5 const08 const08 253 19 19 N 1 0 8
|
||||
def test t5 t5 param08 param08 252 4294967295 19 Y 16 0 8
|
||||
def test t5 t5 const09 const09 12 19 19 Y 128 0 63
|
||||
def test t5 t5 param09 param09 252 4294967295 19 Y 144 0 63
|
||||
def test t5 t5 param09 param09 252 4294967295 19 Y 16 0 8
|
||||
def test t5 t5 const10 const10 3 10 9 N 32769 0 63
|
||||
def test t5 t5 param10 param10 8 20 9 Y 32768 0 63
|
||||
def test t5 t5 const11 const11 3 4 4 Y 32768 0 63
|
||||
@ -1913,10 +1913,10 @@ def @arg09 5 23 1 Y 32896 31 63
|
||||
def @arg10 5 23 1 Y 32896 31 63
|
||||
def @arg11 246 83 6 Y 32896 30 63
|
||||
def @arg12 246 83 6 Y 32896 30 63
|
||||
def @arg13 251 16777216 10 Y 128 31 63
|
||||
def @arg14 251 16777216 19 Y 128 31 63
|
||||
def @arg15 251 16777216 19 Y 128 31 63
|
||||
def @arg16 251 16777216 8 Y 128 31 63
|
||||
def @arg13 251 16777216 10 Y 0 31 8
|
||||
def @arg14 251 16777216 19 Y 0 31 8
|
||||
def @arg15 251 16777216 19 Y 0 31 8
|
||||
def @arg16 251 16777216 8 Y 0 31 8
|
||||
def @arg17 8 20 4 Y 32928 0 63
|
||||
def @arg18 8 20 1 Y 32896 0 63
|
||||
def @arg19 8 20 1 Y 32896 0 63
|
||||
@ -1960,10 +1960,10 @@ def @arg09 5 23 0 Y 32896 31 63
|
||||
def @arg10 5 23 0 Y 32896 31 63
|
||||
def @arg11 246 83 0 Y 32896 30 63
|
||||
def @arg12 246 83 0 Y 32896 30 63
|
||||
def @arg13 251 16777216 0 Y 128 31 63
|
||||
def @arg14 251 16777216 0 Y 128 31 63
|
||||
def @arg15 251 16777216 19 Y 128 31 63
|
||||
def @arg16 251 16777216 0 Y 128 31 63
|
||||
def @arg13 251 16777216 0 Y 0 31 8
|
||||
def @arg14 251 16777216 0 Y 0 31 8
|
||||
def @arg15 251 16777216 19 Y 0 31 8
|
||||
def @arg16 251 16777216 0 Y 0 31 8
|
||||
def @arg17 8 20 0 Y 32928 0 63
|
||||
def @arg18 8 20 0 Y 32896 0 63
|
||||
def @arg19 8 20 0 Y 32896 0 63
|
||||
@ -2010,10 +2010,10 @@ def @arg09 5 23 1 Y 32896 31 63
|
||||
def @arg10 5 23 1 Y 32896 31 63
|
||||
def @arg11 246 83 6 Y 32896 30 63
|
||||
def @arg12 246 83 6 Y 32896 30 63
|
||||
def @arg13 251 16777216 10 Y 128 31 63
|
||||
def @arg14 251 16777216 19 Y 128 31 63
|
||||
def @arg15 251 16777216 19 Y 128 31 63
|
||||
def @arg16 251 16777216 8 Y 128 31 63
|
||||
def @arg13 251 16777216 10 Y 0 31 8
|
||||
def @arg14 251 16777216 19 Y 0 31 8
|
||||
def @arg15 251 16777216 19 Y 0 31 8
|
||||
def @arg16 251 16777216 8 Y 0 31 8
|
||||
def @arg17 8 20 4 Y 32928 0 63
|
||||
def @arg18 8 20 1 Y 32896 0 63
|
||||
def @arg19 8 20 1 Y 32896 0 63
|
||||
@ -2050,10 +2050,10 @@ def @arg09 5 23 0 Y 32896 31 63
|
||||
def @arg10 5 23 0 Y 32896 31 63
|
||||
def @arg11 246 83 0 Y 32896 30 63
|
||||
def @arg12 246 83 0 Y 32896 30 63
|
||||
def @arg13 251 16777216 0 Y 128 31 63
|
||||
def @arg14 251 16777216 0 Y 128 31 63
|
||||
def @arg15 251 16777216 19 Y 128 31 63
|
||||
def @arg16 251 16777216 0 Y 128 31 63
|
||||
def @arg13 251 16777216 0 Y 0 31 8
|
||||
def @arg14 251 16777216 0 Y 0 31 8
|
||||
def @arg15 251 16777216 19 Y 0 31 8
|
||||
def @arg16 251 16777216 0 Y 0 31 8
|
||||
def @arg17 8 20 0 Y 32928 0 63
|
||||
def @arg18 8 20 0 Y 32896 0 63
|
||||
def @arg19 8 20 0 Y 32896 0 63
|
||||
@ -2098,10 +2098,10 @@ def @arg09 5 23 1 Y 32896 31 63
|
||||
def @arg10 5 23 1 Y 32896 31 63
|
||||
def @arg11 246 83 6 Y 32896 30 63
|
||||
def @arg12 246 83 6 Y 32896 30 63
|
||||
def @arg13 251 16777216 10 Y 128 31 63
|
||||
def @arg14 251 16777216 19 Y 128 31 63
|
||||
def @arg15 251 16777216 19 Y 128 31 63
|
||||
def @arg16 251 16777216 8 Y 128 31 63
|
||||
def @arg13 251 16777216 10 Y 0 31 8
|
||||
def @arg14 251 16777216 19 Y 0 31 8
|
||||
def @arg15 251 16777216 19 Y 0 31 8
|
||||
def @arg16 251 16777216 8 Y 0 31 8
|
||||
def @arg17 8 20 4 Y 32928 0 63
|
||||
def @arg18 8 20 1 Y 32896 0 63
|
||||
def @arg19 8 20 1 Y 32896 0 63
|
||||
@ -2142,10 +2142,10 @@ def @arg09 5 23 0 Y 32896 31 63
|
||||
def @arg10 5 23 0 Y 32896 31 63
|
||||
def @arg11 246 83 0 Y 32896 30 63
|
||||
def @arg12 246 83 0 Y 32896 30 63
|
||||
def @arg13 251 16777216 0 Y 128 31 63
|
||||
def @arg14 251 16777216 0 Y 128 31 63
|
||||
def @arg15 251 16777216 19 Y 128 31 63
|
||||
def @arg16 251 16777216 0 Y 128 31 63
|
||||
def @arg13 251 16777216 0 Y 0 31 8
|
||||
def @arg14 251 16777216 0 Y 0 31 8
|
||||
def @arg15 251 16777216 19 Y 0 31 8
|
||||
def @arg16 251 16777216 0 Y 0 31 8
|
||||
def @arg17 8 20 0 Y 32928 0 63
|
||||
def @arg18 8 20 0 Y 32896 0 63
|
||||
def @arg19 8 20 0 Y 32896 0 63
|
||||
@ -2188,10 +2188,10 @@ def @arg09 5 23 1 Y 32896 31 63
|
||||
def @arg10 5 23 1 Y 32896 31 63
|
||||
def @arg11 246 83 6 Y 32896 30 63
|
||||
def @arg12 246 83 6 Y 32896 30 63
|
||||
def @arg13 251 16777216 10 Y 128 31 63
|
||||
def @arg14 251 16777216 19 Y 128 31 63
|
||||
def @arg15 251 16777216 19 Y 128 31 63
|
||||
def @arg16 251 16777216 8 Y 128 31 63
|
||||
def @arg13 251 16777216 10 Y 0 31 8
|
||||
def @arg14 251 16777216 19 Y 0 31 8
|
||||
def @arg15 251 16777216 19 Y 0 31 8
|
||||
def @arg16 251 16777216 8 Y 0 31 8
|
||||
def @arg17 8 20 4 Y 32928 0 63
|
||||
def @arg18 8 20 1 Y 32896 0 63
|
||||
def @arg19 8 20 1 Y 32896 0 63
|
||||
@ -2226,10 +2226,10 @@ def @arg09 5 23 0 Y 32896 31 63
|
||||
def @arg10 5 23 0 Y 32896 31 63
|
||||
def @arg11 246 83 0 Y 32896 30 63
|
||||
def @arg12 246 83 0 Y 32896 30 63
|
||||
def @arg13 251 16777216 0 Y 128 31 63
|
||||
def @arg14 251 16777216 0 Y 128 31 63
|
||||
def @arg15 251 16777216 19 Y 128 31 63
|
||||
def @arg16 251 16777216 0 Y 128 31 63
|
||||
def @arg13 251 16777216 0 Y 0 31 8
|
||||
def @arg14 251 16777216 0 Y 0 31 8
|
||||
def @arg15 251 16777216 19 Y 0 31 8
|
||||
def @arg16 251 16777216 0 Y 0 31 8
|
||||
def @arg17 8 20 0 Y 32928 0 63
|
||||
def @arg18 8 20 0 Y 32896 0 63
|
||||
def @arg19 8 20 0 Y 32896 0 63
|
||||
|
@ -1708,11 +1708,11 @@ t5 CREATE TABLE `t5` (
|
||||
`const06` varchar(10) NOT NULL DEFAULT '',
|
||||
`param06` longtext,
|
||||
`const07` date DEFAULT NULL,
|
||||
`param07` longblob,
|
||||
`param07` longtext,
|
||||
`const08` varchar(19) NOT NULL DEFAULT '',
|
||||
`param08` longtext,
|
||||
`const09` datetime DEFAULT NULL,
|
||||
`param09` longblob,
|
||||
`param09` longtext,
|
||||
`const10` int(10) NOT NULL DEFAULT '0',
|
||||
`param10` bigint(20) DEFAULT NULL,
|
||||
`const11` int(4) DEFAULT NULL,
|
||||
@ -1738,11 +1738,11 @@ def test t5 t5 param05 param05 252 4294967295 3 Y 144 0 63
|
||||
def test t5 t5 const06 const06 253 10 10 N 1 0 8
|
||||
def test t5 t5 param06 param06 252 4294967295 10 Y 16 0 8
|
||||
def test t5 t5 const07 const07 10 10 10 Y 128 0 63
|
||||
def test t5 t5 param07 param07 252 4294967295 10 Y 144 0 63
|
||||
def test t5 t5 param07 param07 252 4294967295 10 Y 16 0 8
|
||||
def test t5 t5 const08 const08 253 19 19 N 1 0 8
|
||||
def test t5 t5 param08 param08 252 4294967295 19 Y 16 0 8
|
||||
def test t5 t5 const09 const09 12 19 19 Y 128 0 63
|
||||
def test t5 t5 param09 param09 252 4294967295 19 Y 144 0 63
|
||||
def test t5 t5 param09 param09 252 4294967295 19 Y 16 0 8
|
||||
def test t5 t5 const10 const10 3 10 9 N 32769 0 63
|
||||
def test t5 t5 param10 param10 8 20 9 Y 32768 0 63
|
||||
def test t5 t5 const11 const11 3 4 4 Y 32768 0 63
|
||||
@ -1849,10 +1849,10 @@ def @arg09 5 23 1 Y 32896 31 63
|
||||
def @arg10 5 23 1 Y 32896 31 63
|
||||
def @arg11 246 83 6 Y 32896 30 63
|
||||
def @arg12 246 83 6 Y 32896 30 63
|
||||
def @arg13 251 16777216 10 Y 128 31 63
|
||||
def @arg14 251 16777216 19 Y 128 31 63
|
||||
def @arg15 251 16777216 19 Y 128 31 63
|
||||
def @arg16 251 16777216 8 Y 128 31 63
|
||||
def @arg13 251 16777216 10 Y 0 31 8
|
||||
def @arg14 251 16777216 19 Y 0 31 8
|
||||
def @arg15 251 16777216 19 Y 0 31 8
|
||||
def @arg16 251 16777216 8 Y 0 31 8
|
||||
def @arg17 8 20 4 Y 32928 0 63
|
||||
def @arg18 8 20 1 Y 32896 0 63
|
||||
def @arg19 8 20 1 Y 32896 0 63
|
||||
@ -1896,10 +1896,10 @@ def @arg09 5 23 0 Y 32896 31 63
|
||||
def @arg10 5 23 0 Y 32896 31 63
|
||||
def @arg11 246 83 0 Y 32896 30 63
|
||||
def @arg12 246 83 0 Y 32896 30 63
|
||||
def @arg13 251 16777216 0 Y 128 31 63
|
||||
def @arg14 251 16777216 0 Y 128 31 63
|
||||
def @arg15 251 16777216 19 Y 128 31 63
|
||||
def @arg16 251 16777216 0 Y 128 31 63
|
||||
def @arg13 251 16777216 0 Y 0 31 8
|
||||
def @arg14 251 16777216 0 Y 0 31 8
|
||||
def @arg15 251 16777216 19 Y 0 31 8
|
||||
def @arg16 251 16777216 0 Y 0 31 8
|
||||
def @arg17 8 20 0 Y 32928 0 63
|
||||
def @arg18 8 20 0 Y 32896 0 63
|
||||
def @arg19 8 20 0 Y 32896 0 63
|
||||
@ -1946,10 +1946,10 @@ def @arg09 5 23 1 Y 32896 31 63
|
||||
def @arg10 5 23 1 Y 32896 31 63
|
||||
def @arg11 246 83 6 Y 32896 30 63
|
||||
def @arg12 246 83 6 Y 32896 30 63
|
||||
def @arg13 251 16777216 10 Y 128 31 63
|
||||
def @arg14 251 16777216 19 Y 128 31 63
|
||||
def @arg15 251 16777216 19 Y 128 31 63
|
||||
def @arg16 251 16777216 8 Y 128 31 63
|
||||
def @arg13 251 16777216 10 Y 0 31 8
|
||||
def @arg14 251 16777216 19 Y 0 31 8
|
||||
def @arg15 251 16777216 19 Y 0 31 8
|
||||
def @arg16 251 16777216 8 Y 0 31 8
|
||||
def @arg17 8 20 4 Y 32928 0 63
|
||||
def @arg18 8 20 1 Y 32896 0 63
|
||||
def @arg19 8 20 1 Y 32896 0 63
|
||||
@ -1986,10 +1986,10 @@ def @arg09 5 23 0 Y 32896 31 63
|
||||
def @arg10 5 23 0 Y 32896 31 63
|
||||
def @arg11 246 83 0 Y 32896 30 63
|
||||
def @arg12 246 83 0 Y 32896 30 63
|
||||
def @arg13 251 16777216 0 Y 128 31 63
|
||||
def @arg14 251 16777216 0 Y 128 31 63
|
||||
def @arg15 251 16777216 19 Y 128 31 63
|
||||
def @arg16 251 16777216 0 Y 128 31 63
|
||||
def @arg13 251 16777216 0 Y 0 31 8
|
||||
def @arg14 251 16777216 0 Y 0 31 8
|
||||
def @arg15 251 16777216 19 Y 0 31 8
|
||||
def @arg16 251 16777216 0 Y 0 31 8
|
||||
def @arg17 8 20 0 Y 32928 0 63
|
||||
def @arg18 8 20 0 Y 32896 0 63
|
||||
def @arg19 8 20 0 Y 32896 0 63
|
||||
@ -2034,10 +2034,10 @@ def @arg09 5 23 1 Y 32896 31 63
|
||||
def @arg10 5 23 1 Y 32896 31 63
|
||||
def @arg11 246 83 6 Y 32896 30 63
|
||||
def @arg12 246 83 6 Y 32896 30 63
|
||||
def @arg13 251 16777216 10 Y 128 31 63
|
||||
def @arg14 251 16777216 19 Y 128 31 63
|
||||
def @arg15 251 16777216 19 Y 128 31 63
|
||||
def @arg16 251 16777216 8 Y 128 31 63
|
||||
def @arg13 251 16777216 10 Y 0 31 8
|
||||
def @arg14 251 16777216 19 Y 0 31 8
|
||||
def @arg15 251 16777216 19 Y 0 31 8
|
||||
def @arg16 251 16777216 8 Y 0 31 8
|
||||
def @arg17 8 20 4 Y 32928 0 63
|
||||
def @arg18 8 20 1 Y 32896 0 63
|
||||
def @arg19 8 20 1 Y 32896 0 63
|
||||
@ -2078,10 +2078,10 @@ def @arg09 5 23 0 Y 32896 31 63
|
||||
def @arg10 5 23 0 Y 32896 31 63
|
||||
def @arg11 246 83 0 Y 32896 30 63
|
||||
def @arg12 246 83 0 Y 32896 30 63
|
||||
def @arg13 251 16777216 0 Y 128 31 63
|
||||
def @arg14 251 16777216 0 Y 128 31 63
|
||||
def @arg15 251 16777216 19 Y 128 31 63
|
||||
def @arg16 251 16777216 0 Y 128 31 63
|
||||
def @arg13 251 16777216 0 Y 0 31 8
|
||||
def @arg14 251 16777216 0 Y 0 31 8
|
||||
def @arg15 251 16777216 19 Y 0 31 8
|
||||
def @arg16 251 16777216 0 Y 0 31 8
|
||||
def @arg17 8 20 0 Y 32928 0 63
|
||||
def @arg18 8 20 0 Y 32896 0 63
|
||||
def @arg19 8 20 0 Y 32896 0 63
|
||||
@ -2124,10 +2124,10 @@ def @arg09 5 23 1 Y 32896 31 63
|
||||
def @arg10 5 23 1 Y 32896 31 63
|
||||
def @arg11 246 83 6 Y 32896 30 63
|
||||
def @arg12 246 83 6 Y 32896 30 63
|
||||
def @arg13 251 16777216 10 Y 128 31 63
|
||||
def @arg14 251 16777216 19 Y 128 31 63
|
||||
def @arg15 251 16777216 19 Y 128 31 63
|
||||
def @arg16 251 16777216 8 Y 128 31 63
|
||||
def @arg13 251 16777216 10 Y 0 31 8
|
||||
def @arg14 251 16777216 19 Y 0 31 8
|
||||
def @arg15 251 16777216 19 Y 0 31 8
|
||||
def @arg16 251 16777216 8 Y 0 31 8
|
||||
def @arg17 8 20 4 Y 32928 0 63
|
||||
def @arg18 8 20 1 Y 32896 0 63
|
||||
def @arg19 8 20 1 Y 32896 0 63
|
||||
@ -2162,10 +2162,10 @@ def @arg09 5 23 0 Y 32896 31 63
|
||||
def @arg10 5 23 0 Y 32896 31 63
|
||||
def @arg11 246 83 0 Y 32896 30 63
|
||||
def @arg12 246 83 0 Y 32896 30 63
|
||||
def @arg13 251 16777216 0 Y 128 31 63
|
||||
def @arg14 251 16777216 0 Y 128 31 63
|
||||
def @arg15 251 16777216 19 Y 128 31 63
|
||||
def @arg16 251 16777216 0 Y 128 31 63
|
||||
def @arg13 251 16777216 0 Y 0 31 8
|
||||
def @arg14 251 16777216 0 Y 0 31 8
|
||||
def @arg15 251 16777216 19 Y 0 31 8
|
||||
def @arg16 251 16777216 0 Y 0 31 8
|
||||
def @arg17 8 20 0 Y 32928 0 63
|
||||
def @arg18 8 20 0 Y 32896 0 63
|
||||
def @arg19 8 20 0 Y 32896 0 63
|
||||
@ -4730,11 +4730,11 @@ t5 CREATE TABLE `t5` (
|
||||
`const06` varchar(10) NOT NULL DEFAULT '',
|
||||
`param06` longtext,
|
||||
`const07` date DEFAULT NULL,
|
||||
`param07` longblob,
|
||||
`param07` longtext,
|
||||
`const08` varchar(19) NOT NULL DEFAULT '',
|
||||
`param08` longtext,
|
||||
`const09` datetime DEFAULT NULL,
|
||||
`param09` longblob,
|
||||
`param09` longtext,
|
||||
`const10` int(10) NOT NULL DEFAULT '0',
|
||||
`param10` bigint(20) DEFAULT NULL,
|
||||
`const11` int(4) DEFAULT NULL,
|
||||
@ -4760,11 +4760,11 @@ def test t5 t5 param05 param05 252 4294967295 3 Y 144 0 63
|
||||
def test t5 t5 const06 const06 253 10 10 N 1 0 8
|
||||
def test t5 t5 param06 param06 252 4294967295 10 Y 16 0 8
|
||||
def test t5 t5 const07 const07 10 10 10 Y 128 0 63
|
||||
def test t5 t5 param07 param07 252 4294967295 10 Y 144 0 63
|
||||
def test t5 t5 param07 param07 252 4294967295 10 Y 16 0 8
|
||||
def test t5 t5 const08 const08 253 19 19 N 1 0 8
|
||||
def test t5 t5 param08 param08 252 4294967295 19 Y 16 0 8
|
||||
def test t5 t5 const09 const09 12 19 19 Y 128 0 63
|
||||
def test t5 t5 param09 param09 252 4294967295 19 Y 144 0 63
|
||||
def test t5 t5 param09 param09 252 4294967295 19 Y 16 0 8
|
||||
def test t5 t5 const10 const10 3 10 9 N 32769 0 63
|
||||
def test t5 t5 param10 param10 8 20 9 Y 32768 0 63
|
||||
def test t5 t5 const11 const11 3 4 4 Y 32768 0 63
|
||||
@ -4871,10 +4871,10 @@ def @arg09 5 23 1 Y 32896 31 63
|
||||
def @arg10 5 23 1 Y 32896 31 63
|
||||
def @arg11 246 83 6 Y 32896 30 63
|
||||
def @arg12 246 83 6 Y 32896 30 63
|
||||
def @arg13 251 16777216 10 Y 128 31 63
|
||||
def @arg14 251 16777216 19 Y 128 31 63
|
||||
def @arg15 251 16777216 19 Y 128 31 63
|
||||
def @arg16 251 16777216 8 Y 128 31 63
|
||||
def @arg13 251 16777216 10 Y 0 31 8
|
||||
def @arg14 251 16777216 19 Y 0 31 8
|
||||
def @arg15 251 16777216 19 Y 0 31 8
|
||||
def @arg16 251 16777216 8 Y 0 31 8
|
||||
def @arg17 8 20 4 Y 32928 0 63
|
||||
def @arg18 8 20 1 Y 32896 0 63
|
||||
def @arg19 8 20 1 Y 32896 0 63
|
||||
@ -4918,10 +4918,10 @@ def @arg09 5 23 0 Y 32896 31 63
|
||||
def @arg10 5 23 0 Y 32896 31 63
|
||||
def @arg11 246 83 0 Y 32896 30 63
|
||||
def @arg12 246 83 0 Y 32896 30 63
|
||||
def @arg13 251 16777216 0 Y 128 31 63
|
||||
def @arg14 251 16777216 0 Y 128 31 63
|
||||
def @arg15 251 16777216 19 Y 128 31 63
|
||||
def @arg16 251 16777216 0 Y 128 31 63
|
||||
def @arg13 251 16777216 0 Y 0 31 8
|
||||
def @arg14 251 16777216 0 Y 0 31 8
|
||||
def @arg15 251 16777216 19 Y 0 31 8
|
||||
def @arg16 251 16777216 0 Y 0 31 8
|
||||
def @arg17 8 20 0 Y 32928 0 63
|
||||
def @arg18 8 20 0 Y 32896 0 63
|
||||
def @arg19 8 20 0 Y 32896 0 63
|
||||
@ -4968,10 +4968,10 @@ def @arg09 5 23 1 Y 32896 31 63
|
||||
def @arg10 5 23 1 Y 32896 31 63
|
||||
def @arg11 246 83 6 Y 32896 30 63
|
||||
def @arg12 246 83 6 Y 32896 30 63
|
||||
def @arg13 251 16777216 10 Y 128 31 63
|
||||
def @arg14 251 16777216 19 Y 128 31 63
|
||||
def @arg15 251 16777216 19 Y 128 31 63
|
||||
def @arg16 251 16777216 8 Y 128 31 63
|
||||
def @arg13 251 16777216 10 Y 0 31 8
|
||||
def @arg14 251 16777216 19 Y 0 31 8
|
||||
def @arg15 251 16777216 19 Y 0 31 8
|
||||
def @arg16 251 16777216 8 Y 0 31 8
|
||||
def @arg17 8 20 4 Y 32928 0 63
|
||||
def @arg18 8 20 1 Y 32896 0 63
|
||||
def @arg19 8 20 1 Y 32896 0 63
|
||||
@ -5008,10 +5008,10 @@ def @arg09 5 23 0 Y 32896 31 63
|
||||
def @arg10 5 23 0 Y 32896 31 63
|
||||
def @arg11 246 83 0 Y 32896 30 63
|
||||
def @arg12 246 83 0 Y 32896 30 63
|
||||
def @arg13 251 16777216 0 Y 128 31 63
|
||||
def @arg14 251 16777216 0 Y 128 31 63
|
||||
def @arg15 251 16777216 19 Y 128 31 63
|
||||
def @arg16 251 16777216 0 Y 128 31 63
|
||||
def @arg13 251 16777216 0 Y 0 31 8
|
||||
def @arg14 251 16777216 0 Y 0 31 8
|
||||
def @arg15 251 16777216 19 Y 0 31 8
|
||||
def @arg16 251 16777216 0 Y 0 31 8
|
||||
def @arg17 8 20 0 Y 32928 0 63
|
||||
def @arg18 8 20 0 Y 32896 0 63
|
||||
def @arg19 8 20 0 Y 32896 0 63
|
||||
@ -5056,10 +5056,10 @@ def @arg09 5 23 1 Y 32896 31 63
|
||||
def @arg10 5 23 1 Y 32896 31 63
|
||||
def @arg11 246 83 6 Y 32896 30 63
|
||||
def @arg12 246 83 6 Y 32896 30 63
|
||||
def @arg13 251 16777216 10 Y 128 31 63
|
||||
def @arg14 251 16777216 19 Y 128 31 63
|
||||
def @arg15 251 16777216 19 Y 128 31 63
|
||||
def @arg16 251 16777216 8 Y 128 31 63
|
||||
def @arg13 251 16777216 10 Y 0 31 8
|
||||
def @arg14 251 16777216 19 Y 0 31 8
|
||||
def @arg15 251 16777216 19 Y 0 31 8
|
||||
def @arg16 251 16777216 8 Y 0 31 8
|
||||
def @arg17 8 20 4 Y 32928 0 63
|
||||
def @arg18 8 20 1 Y 32896 0 63
|
||||
def @arg19 8 20 1 Y 32896 0 63
|
||||
@ -5100,10 +5100,10 @@ def @arg09 5 23 0 Y 32896 31 63
|
||||
def @arg10 5 23 0 Y 32896 31 63
|
||||
def @arg11 246 83 0 Y 32896 30 63
|
||||
def @arg12 246 83 0 Y 32896 30 63
|
||||
def @arg13 251 16777216 0 Y 128 31 63
|
||||
def @arg14 251 16777216 0 Y 128 31 63
|
||||
def @arg15 251 16777216 19 Y 128 31 63
|
||||
def @arg16 251 16777216 0 Y 128 31 63
|
||||
def @arg13 251 16777216 0 Y 0 31 8
|
||||
def @arg14 251 16777216 0 Y 0 31 8
|
||||
def @arg15 251 16777216 19 Y 0 31 8
|
||||
def @arg16 251 16777216 0 Y 0 31 8
|
||||
def @arg17 8 20 0 Y 32928 0 63
|
||||
def @arg18 8 20 0 Y 32896 0 63
|
||||
def @arg19 8 20 0 Y 32896 0 63
|
||||
@ -5146,10 +5146,10 @@ def @arg09 5 23 1 Y 32896 31 63
|
||||
def @arg10 5 23 1 Y 32896 31 63
|
||||
def @arg11 246 83 6 Y 32896 30 63
|
||||
def @arg12 246 83 6 Y 32896 30 63
|
||||
def @arg13 251 16777216 10 Y 128 31 63
|
||||
def @arg14 251 16777216 19 Y 128 31 63
|
||||
def @arg15 251 16777216 19 Y 128 31 63
|
||||
def @arg16 251 16777216 8 Y 128 31 63
|
||||
def @arg13 251 16777216 10 Y 0 31 8
|
||||
def @arg14 251 16777216 19 Y 0 31 8
|
||||
def @arg15 251 16777216 19 Y 0 31 8
|
||||
def @arg16 251 16777216 8 Y 0 31 8
|
||||
def @arg17 8 20 4 Y 32928 0 63
|
||||
def @arg18 8 20 1 Y 32896 0 63
|
||||
def @arg19 8 20 1 Y 32896 0 63
|
||||
@ -5184,10 +5184,10 @@ def @arg09 5 23 0 Y 32896 31 63
|
||||
def @arg10 5 23 0 Y 32896 31 63
|
||||
def @arg11 246 83 0 Y 32896 30 63
|
||||
def @arg12 246 83 0 Y 32896 30 63
|
||||
def @arg13 251 16777216 0 Y 128 31 63
|
||||
def @arg14 251 16777216 0 Y 128 31 63
|
||||
def @arg15 251 16777216 19 Y 128 31 63
|
||||
def @arg16 251 16777216 0 Y 128 31 63
|
||||
def @arg13 251 16777216 0 Y 0 31 8
|
||||
def @arg14 251 16777216 0 Y 0 31 8
|
||||
def @arg15 251 16777216 19 Y 0 31 8
|
||||
def @arg16 251 16777216 0 Y 0 31 8
|
||||
def @arg17 8 20 0 Y 32928 0 63
|
||||
def @arg18 8 20 0 Y 32896 0 63
|
||||
def @arg19 8 20 0 Y 32896 0 63
|
||||
|
@ -449,11 +449,11 @@ f4 datetime YES NULL
|
||||
create table t5 as select coalesce(f1,f3) as f4 from t1;
|
||||
desc t5;
|
||||
Field Type Null Key Default Extra
|
||||
f4 varbinary(20) YES NULL
|
||||
f4 varchar(20) YES NULL
|
||||
create table t6 as select coalesce(f2,f3) as f4 from t1;
|
||||
desc t6;
|
||||
Field Type Null Key Default Extra
|
||||
f4 varbinary(20) YES NULL
|
||||
f4 varchar(20) YES NULL
|
||||
create table t7 as select coalesce(makedate(1997,1),f2) as f4 from t1;
|
||||
desc t7;
|
||||
Field Type Null Key Default Extra
|
||||
|
@ -271,7 +271,7 @@ drop table t2;
|
||||
create table t2 (primary key (auto)) select auto+1 as auto,1 as t1, 'a' as t2, repeat('a',256) as t3, binary repeat('b',256) as t4, repeat('a',4096) as t5, binary repeat('b',4096) as t6, '' as t7, binary '' as t8 from t1;
|
||||
show full columns from t2;
|
||||
Field Type Collation Null Key Default Extra Privileges Comment
|
||||
auto bigint(12) unsigned NULL NO PRI 0 #
|
||||
auto int(6) unsigned NULL NO PRI 0 #
|
||||
t1 int(1) NULL NO 0 #
|
||||
t2 varchar(1) latin1_swedish_ci NO #
|
||||
t3 varchar(256) latin1_swedish_ci NO #
|
||||
|
@ -554,7 +554,7 @@ aa
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` varbinary(2) NOT NULL DEFAULT ''
|
||||
`a` varchar(2) NOT NULL DEFAULT ''
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table t1;
|
||||
create table t1 SELECT 12 as a UNION select 12.2 as a;
|
||||
@ -655,7 +655,7 @@ f
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`f` varbinary(12) DEFAULT NULL
|
||||
`f` varchar(12) DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table t1;
|
||||
create table t1 SELECT y from t2 UNION select da from t2;
|
||||
@ -666,7 +666,7 @@ y
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`y` varbinary(10) DEFAULT NULL
|
||||
`y` varchar(10) DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table t1;
|
||||
create table t1 SELECT y from t2 UNION select dt from t2;
|
||||
@ -677,7 +677,7 @@ y
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`y` varbinary(19) DEFAULT NULL
|
||||
`y` varchar(19) DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table t1;
|
||||
create table t1 SELECT da from t2 UNION select dt from t2;
|
||||
@ -699,7 +699,7 @@ testc
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`dt` varbinary(19) DEFAULT NULL
|
||||
`dt` varchar(19) DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table t1;
|
||||
create table t1 SELECT dt from t2 UNION select sv from t2;
|
||||
@ -710,7 +710,7 @@ testv
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`dt` varbinary(19) DEFAULT NULL
|
||||
`dt` varchar(19) DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table t1;
|
||||
create table t1 SELECT sc from t2 UNION select sv from t2;
|
||||
|
@ -33,6 +33,36 @@
|
||||
</collation>
|
||||
</charset>
|
||||
|
||||
|
||||
<charset name="utf8mb4">
|
||||
<collation name="utf8mb4_test_ci" id="326">
|
||||
<rules>
|
||||
<reset>a</reset>
|
||||
<s>b</s>
|
||||
</rules>
|
||||
</collation>
|
||||
</charset>
|
||||
|
||||
<charset name="utf16">
|
||||
<collation name="utf16_test_ci" id="327">
|
||||
<rules>
|
||||
<reset>a</reset>
|
||||
<s>b</s>
|
||||
</rules>
|
||||
</collation>
|
||||
</charset>
|
||||
|
||||
|
||||
<charset name="utf32">
|
||||
<collation name="utf32_test_ci" id="391">
|
||||
<rules>
|
||||
<reset>a</reset>
|
||||
<s>b</s>
|
||||
</rules>
|
||||
</collation>
|
||||
</charset>
|
||||
|
||||
|
||||
<charset name="ucs2">
|
||||
<collation name="ucs2_test_ci" id="358">
|
||||
<rules>
|
||||
|
@ -1771,11 +1771,11 @@ t5 CREATE TABLE `t5` (
|
||||
`const06` varchar(10) NOT NULL DEFAULT '',
|
||||
`param06` longtext,
|
||||
`const07` date DEFAULT NULL,
|
||||
`param07` longblob,
|
||||
`param07` longtext,
|
||||
`const08` varchar(19) NOT NULL DEFAULT '',
|
||||
`param08` longtext,
|
||||
`const09` datetime DEFAULT NULL,
|
||||
`param09` longblob,
|
||||
`param09` longtext,
|
||||
`const10` int(10) NOT NULL DEFAULT '0',
|
||||
`param10` bigint(20) DEFAULT NULL,
|
||||
`const11` int(4) DEFAULT NULL,
|
||||
@ -1801,11 +1801,11 @@ def test t5 t5 param05 param05 252 4294967295 3 Y 144 0 63
|
||||
def test t5 t5 const06 const06 253 10 10 N 1 0 8
|
||||
def test t5 t5 param06 param06 252 4294967295 10 Y 16 0 8
|
||||
def test t5 t5 const07 const07 10 10 10 Y 128 0 63
|
||||
def test t5 t5 param07 param07 252 4294967295 10 Y 144 0 63
|
||||
def test t5 t5 param07 param07 252 4294967295 10 Y 16 0 8
|
||||
def test t5 t5 const08 const08 253 19 19 N 1 0 8
|
||||
def test t5 t5 param08 param08 252 4294967295 19 Y 16 0 8
|
||||
def test t5 t5 const09 const09 12 19 19 Y 128 0 63
|
||||
def test t5 t5 param09 param09 252 4294967295 19 Y 144 0 63
|
||||
def test t5 t5 param09 param09 252 4294967295 19 Y 16 0 8
|
||||
def test t5 t5 const10 const10 3 10 9 N 32769 0 63
|
||||
def test t5 t5 param10 param10 8 20 9 Y 32768 0 63
|
||||
def test t5 t5 const11 const11 3 4 4 Y 32768 0 63
|
||||
@ -1912,10 +1912,10 @@ def @arg09 5 23 1 Y 32896 31 63
|
||||
def @arg10 5 23 1 Y 32896 31 63
|
||||
def @arg11 246 83 6 Y 32896 30 63
|
||||
def @arg12 246 83 6 Y 32896 30 63
|
||||
def @arg13 251 16777216 10 Y 128 31 63
|
||||
def @arg14 251 16777216 19 Y 128 31 63
|
||||
def @arg15 251 16777216 19 Y 128 31 63
|
||||
def @arg16 251 16777216 8 Y 128 31 63
|
||||
def @arg13 251 16777216 10 Y 0 31 8
|
||||
def @arg14 251 16777216 19 Y 0 31 8
|
||||
def @arg15 251 16777216 19 Y 0 31 8
|
||||
def @arg16 251 16777216 8 Y 0 31 8
|
||||
def @arg17 8 20 4 Y 32928 0 63
|
||||
def @arg18 8 20 1 Y 32896 0 63
|
||||
def @arg19 8 20 1 Y 32896 0 63
|
||||
@ -1959,10 +1959,10 @@ def @arg09 5 23 0 Y 32896 31 63
|
||||
def @arg10 5 23 0 Y 32896 31 63
|
||||
def @arg11 246 83 0 Y 32896 30 63
|
||||
def @arg12 246 83 0 Y 32896 30 63
|
||||
def @arg13 251 16777216 0 Y 128 31 63
|
||||
def @arg14 251 16777216 0 Y 128 31 63
|
||||
def @arg15 251 16777216 19 Y 128 31 63
|
||||
def @arg16 251 16777216 0 Y 128 31 63
|
||||
def @arg13 251 16777216 0 Y 0 31 8
|
||||
def @arg14 251 16777216 0 Y 0 31 8
|
||||
def @arg15 251 16777216 19 Y 0 31 8
|
||||
def @arg16 251 16777216 0 Y 0 31 8
|
||||
def @arg17 8 20 0 Y 32928 0 63
|
||||
def @arg18 8 20 0 Y 32896 0 63
|
||||
def @arg19 8 20 0 Y 32896 0 63
|
||||
@ -2009,10 +2009,10 @@ def @arg09 5 23 1 Y 32896 31 63
|
||||
def @arg10 5 23 1 Y 32896 31 63
|
||||
def @arg11 246 83 6 Y 32896 30 63
|
||||
def @arg12 246 83 6 Y 32896 30 63
|
||||
def @arg13 251 16777216 10 Y 128 31 63
|
||||
def @arg14 251 16777216 19 Y 128 31 63
|
||||
def @arg15 251 16777216 19 Y 128 31 63
|
||||
def @arg16 251 16777216 8 Y 128 31 63
|
||||
def @arg13 251 16777216 10 Y 0 31 8
|
||||
def @arg14 251 16777216 19 Y 0 31 8
|
||||
def @arg15 251 16777216 19 Y 0 31 8
|
||||
def @arg16 251 16777216 8 Y 0 31 8
|
||||
def @arg17 8 20 4 Y 32928 0 63
|
||||
def @arg18 8 20 1 Y 32896 0 63
|
||||
def @arg19 8 20 1 Y 32896 0 63
|
||||
@ -2049,10 +2049,10 @@ def @arg09 5 23 0 Y 32896 31 63
|
||||
def @arg10 5 23 0 Y 32896 31 63
|
||||
def @arg11 246 83 0 Y 32896 30 63
|
||||
def @arg12 246 83 0 Y 32896 30 63
|
||||
def @arg13 251 16777216 0 Y 128 31 63
|
||||
def @arg14 251 16777216 0 Y 128 31 63
|
||||
def @arg15 251 16777216 19 Y 128 31 63
|
||||
def @arg16 251 16777216 0 Y 128 31 63
|
||||
def @arg13 251 16777216 0 Y 0 31 8
|
||||
def @arg14 251 16777216 0 Y 0 31 8
|
||||
def @arg15 251 16777216 19 Y 0 31 8
|
||||
def @arg16 251 16777216 0 Y 0 31 8
|
||||
def @arg17 8 20 0 Y 32928 0 63
|
||||
def @arg18 8 20 0 Y 32896 0 63
|
||||
def @arg19 8 20 0 Y 32896 0 63
|
||||
@ -2097,10 +2097,10 @@ def @arg09 5 23 1 Y 32896 31 63
|
||||
def @arg10 5 23 1 Y 32896 31 63
|
||||
def @arg11 246 83 6 Y 32896 30 63
|
||||
def @arg12 246 83 6 Y 32896 30 63
|
||||
def @arg13 251 16777216 10 Y 128 31 63
|
||||
def @arg14 251 16777216 19 Y 128 31 63
|
||||
def @arg15 251 16777216 19 Y 128 31 63
|
||||
def @arg16 251 16777216 8 Y 128 31 63
|
||||
def @arg13 251 16777216 10 Y 0 31 8
|
||||
def @arg14 251 16777216 19 Y 0 31 8
|
||||
def @arg15 251 16777216 19 Y 0 31 8
|
||||
def @arg16 251 16777216 8 Y 0 31 8
|
||||
def @arg17 8 20 4 Y 32928 0 63
|
||||
def @arg18 8 20 1 Y 32896 0 63
|
||||
def @arg19 8 20 1 Y 32896 0 63
|
||||
@ -2141,10 +2141,10 @@ def @arg09 5 23 0 Y 32896 31 63
|
||||
def @arg10 5 23 0 Y 32896 31 63
|
||||
def @arg11 246 83 0 Y 32896 30 63
|
||||
def @arg12 246 83 0 Y 32896 30 63
|
||||
def @arg13 251 16777216 0 Y 128 31 63
|
||||
def @arg14 251 16777216 0 Y 128 31 63
|
||||
def @arg15 251 16777216 19 Y 128 31 63
|
||||
def @arg16 251 16777216 0 Y 128 31 63
|
||||
def @arg13 251 16777216 0 Y 0 31 8
|
||||
def @arg14 251 16777216 0 Y 0 31 8
|
||||
def @arg15 251 16777216 19 Y 0 31 8
|
||||
def @arg16 251 16777216 0 Y 0 31 8
|
||||
def @arg17 8 20 0 Y 32928 0 63
|
||||
def @arg18 8 20 0 Y 32896 0 63
|
||||
def @arg19 8 20 0 Y 32896 0 63
|
||||
@ -2187,10 +2187,10 @@ def @arg09 5 23 1 Y 32896 31 63
|
||||
def @arg10 5 23 1 Y 32896 31 63
|
||||
def @arg11 246 83 6 Y 32896 30 63
|
||||
def @arg12 246 83 6 Y 32896 30 63
|
||||
def @arg13 251 16777216 10 Y 128 31 63
|
||||
def @arg14 251 16777216 19 Y 128 31 63
|
||||
def @arg15 251 16777216 19 Y 128 31 63
|
||||
def @arg16 251 16777216 8 Y 128 31 63
|
||||
def @arg13 251 16777216 10 Y 0 31 8
|
||||
def @arg14 251 16777216 19 Y 0 31 8
|
||||
def @arg15 251 16777216 19 Y 0 31 8
|
||||
def @arg16 251 16777216 8 Y 0 31 8
|
||||
def @arg17 8 20 4 Y 32928 0 63
|
||||
def @arg18 8 20 1 Y 32896 0 63
|
||||
def @arg19 8 20 1 Y 32896 0 63
|
||||
@ -2225,10 +2225,10 @@ def @arg09 5 23 0 Y 32896 31 63
|
||||
def @arg10 5 23 0 Y 32896 31 63
|
||||
def @arg11 246 83 0 Y 32896 30 63
|
||||
def @arg12 246 83 0 Y 32896 30 63
|
||||
def @arg13 251 16777216 0 Y 128 31 63
|
||||
def @arg14 251 16777216 0 Y 128 31 63
|
||||
def @arg15 251 16777216 19 Y 128 31 63
|
||||
def @arg16 251 16777216 0 Y 128 31 63
|
||||
def @arg13 251 16777216 0 Y 0 31 8
|
||||
def @arg14 251 16777216 0 Y 0 31 8
|
||||
def @arg15 251 16777216 19 Y 0 31 8
|
||||
def @arg16 251 16777216 0 Y 0 31 8
|
||||
def @arg17 8 20 0 Y 32928 0 63
|
||||
def @arg18 8 20 0 Y 32896 0 63
|
||||
def @arg19 8 20 0 Y 32896 0 63
|
||||
|
@ -3,6 +3,10 @@ source include/not_embedded.inc;
|
||||
source include/have_innodb.inc;
|
||||
source include/master-slave.inc;
|
||||
|
||||
# -- [DISABLED Bug#49557]
|
||||
# This test case fails on Windows due to Bug#49557.
|
||||
source include/not_windows.inc;
|
||||
|
||||
let $engine_type= InnoDB;
|
||||
#let $engine_type= MyISAM;
|
||||
|
||||
|
@ -162,8 +162,16 @@ SET @@character_set_client = utf8;
|
||||
SELECT @@character_set_client;
|
||||
@@character_set_client
|
||||
utf8
|
||||
SET @@character_set_client = utf8mb4;
|
||||
SELECT @@character_set_client;
|
||||
@@character_set_client
|
||||
utf8mb4
|
||||
SET @@character_set_client = ucs2;
|
||||
ERROR 42000: Variable 'character_set_client' can't be set to the value of 'ucs2'
|
||||
SET @@character_set_client = utf16;
|
||||
ERROR 42000: Variable 'character_set_client' can't be set to the value of 'utf16'
|
||||
SET @@character_set_client = utf32;
|
||||
ERROR 42000: Variable 'character_set_client' can't be set to the value of 'utf32'
|
||||
SET @@character_set_client = cp866;
|
||||
SELECT @@character_set_client;
|
||||
@@character_set_client
|
||||
@ -422,7 +430,7 @@ ERROR 42000: Unknown character set: '100'
|
||||
SET @total_charset = (SELECT count(*) FROM INFORMATION_SCHEMA.CHARACTER_SETS);
|
||||
SELECT @total_charset;
|
||||
@total_charset
|
||||
36
|
||||
39
|
||||
'#--------------------FN_DYNVARS_010_10-------------------------#'
|
||||
SET @@character_set_client = abc;
|
||||
ERROR 42000: Unknown character set: 'abc'
|
||||
|
@ -424,7 +424,7 @@ ERROR 42000: Unknown character set: '100'
|
||||
SET @total_charset = (SELECT count(*) FROM INFORMATION_SCHEMA.CHARACTER_SETS);
|
||||
SELECT @total_charset;
|
||||
@total_charset
|
||||
36
|
||||
39
|
||||
'#--------------------FN_DYNVARS_011_10-------------------------#'
|
||||
SET @@character_set_connection = abc;
|
||||
ERROR 42000: Unknown character set: 'abc'
|
||||
|
@ -424,7 +424,7 @@ ERROR 42000: Unknown character set: '100'
|
||||
SET @total_charset = (SELECT count(*) FROM INFORMATION_SCHEMA.CHARACTER_SETS);
|
||||
SELECT @total_charset;
|
||||
@total_charset
|
||||
36
|
||||
39
|
||||
'#--------------------FN_DYNVARS_012_10-------------------------#'
|
||||
SET @@character_set_database = "grek";
|
||||
ERROR 42000: Unknown character set: 'grek'
|
||||
|
@ -402,7 +402,7 @@ ERROR 42000: Unknown character set: '100'
|
||||
SET @total_charset = (SELECT count(*) FROM INFORMATION_SCHEMA.CHARACTER_SETS);
|
||||
SELECT @total_charset;
|
||||
@total_charset
|
||||
36
|
||||
39
|
||||
'#--------------------FN_DYNVARS_008_10-------------------------#'
|
||||
SET @@character_set_filesystem = abc;
|
||||
ERROR 42000: Unknown character set: 'abc'
|
||||
|
Binary file not shown.
@ -27,6 +27,9 @@
|
||||
--source include/have_sjis.inc
|
||||
--source include/have_utf8.inc
|
||||
--source include/have_ucs2.inc
|
||||
--source include/have_utf8mb4.inc
|
||||
--source include/have_utf16.inc
|
||||
--source include/have_utf32.inc
|
||||
|
||||
--source include/load_sysvars.inc
|
||||
###################################################
|
||||
@ -163,9 +166,15 @@ SET @@character_set_client = armscii8;
|
||||
SELECT @@character_set_client;
|
||||
SET @@character_set_client = utf8;
|
||||
SELECT @@character_set_client;
|
||||
SET @@character_set_client = utf8mb4;
|
||||
SELECT @@character_set_client;
|
||||
|
||||
--error ER_WRONG_VALUE_FOR_VAR
|
||||
SET @@character_set_client = ucs2;
|
||||
--error ER_WRONG_VALUE_FOR_VAR
|
||||
SET @@character_set_client = utf16;
|
||||
--error ER_WRONG_VALUE_FOR_VAR
|
||||
SET @@character_set_client = utf32;
|
||||
|
||||
SET @@character_set_client = cp866;
|
||||
SELECT @@character_set_client;
|
||||
|
@ -27,6 +27,9 @@
|
||||
--source include/have_sjis.inc
|
||||
--source include/have_utf8.inc
|
||||
--source include/have_ucs2.inc
|
||||
--source include/have_utf8mb4.inc
|
||||
--source include/have_utf16.inc
|
||||
--source include/have_utf32.inc
|
||||
|
||||
--source include/load_sysvars.inc
|
||||
###################################################
|
||||
|
@ -27,6 +27,9 @@
|
||||
--source include/have_sjis.inc
|
||||
--source include/have_utf8.inc
|
||||
--source include/have_ucs2.inc
|
||||
--source include/have_utf8mb4.inc
|
||||
--source include/have_utf16.inc
|
||||
--source include/have_utf32.inc
|
||||
|
||||
--source include/load_sysvars.inc
|
||||
###################################################
|
||||
|
@ -27,6 +27,9 @@
|
||||
--source include/have_sjis.inc
|
||||
--source include/have_utf8.inc
|
||||
--source include/have_ucs2.inc
|
||||
--source include/have_utf8mb4.inc
|
||||
--source include/have_utf16.inc
|
||||
--source include/have_utf32.inc
|
||||
|
||||
--source include/load_sysvars.inc
|
||||
|
||||
|
@ -27,6 +27,9 @@
|
||||
--source include/have_sjis.inc
|
||||
--source include/have_utf8.inc
|
||||
--source include/have_ucs2.inc
|
||||
--source include/have_utf8mb4.inc
|
||||
--source include/have_utf16.inc
|
||||
--source include/have_utf32.inc
|
||||
|
||||
--source include/load_sysvars.inc
|
||||
################################################
|
||||
|
12
mysql-test/t/ctype_binary.test
Normal file
12
mysql-test/t/ctype_binary.test
Normal file
@ -0,0 +1,12 @@
|
||||
|
||||
set names binary;
|
||||
|
||||
--echo #
|
||||
--echo # Start of 5.5 tests
|
||||
--echo #
|
||||
|
||||
--source include/ctype_numconv.inc
|
||||
|
||||
--echo #
|
||||
--echo # End of 5.5 tests
|
||||
--echo #
|
@ -58,3 +58,13 @@ SHOW CREATE TABLE t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
# End of 4.1 tests
|
||||
|
||||
--echo #
|
||||
--echo # Start of 5.5 tests
|
||||
--echo #
|
||||
|
||||
--source include/ctype_numconv.inc
|
||||
|
||||
--echo #
|
||||
--echo # End of 5.5 tests
|
||||
--echo #
|
||||
|
@ -127,3 +127,14 @@ DROP TABLE `abc
|
||||
select hex(cast(_ascii 0x7f as char(1) character set latin1));
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # Start of 5.5 tests
|
||||
--echo #
|
||||
|
||||
--source include/ctype_numconv.inc
|
||||
|
||||
--echo #
|
||||
--echo # End of 5.5 tests
|
||||
--echo #
|
||||
|
@ -1,4 +1,7 @@
|
||||
--source include/have_ucs2.inc
|
||||
--source include/have_utf8mb4.inc
|
||||
--source include/have_utf16.inc
|
||||
--source include/have_utf32.inc
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
@ -40,6 +43,24 @@ insert into t1 values ('a');
|
||||
select * from t1 where c1='b';
|
||||
drop table t1;
|
||||
|
||||
show collation like 'utf8mb4_test_ci';
|
||||
create table t1 (c1 char(1) character set utf8mb4 collate utf8mb4_test_ci);
|
||||
insert into t1 values ('a');
|
||||
select * from t1 where c1='b';
|
||||
drop table t1;
|
||||
|
||||
show collation like 'utf16_test_ci';
|
||||
create table t1 (c1 char(1) character set utf16 collate utf16_test_ci);
|
||||
insert into t1 values ('a');
|
||||
select * from t1 where c1='b';
|
||||
drop table t1;
|
||||
|
||||
show collation like 'utf32_test_ci';
|
||||
create table t1 (c1 char(1) character set utf32 collate utf32_test_ci);
|
||||
insert into t1 values ('a');
|
||||
select * from t1 where c1='b';
|
||||
drop table t1;
|
||||
|
||||
|
||||
#
|
||||
# Bug#41084 full-text index added to custom UCA collation not working
|
||||
|
@ -1,4 +1,7 @@
|
||||
-- source include/have_ucs2.inc
|
||||
-- source include/have_utf8mb4.inc
|
||||
-- source include/have_utf16.inc
|
||||
-- source include/have_utf32.inc
|
||||
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
@ -211,3 +214,73 @@ SELECT min(comment),count(*) FROM t1 GROUP BY ucs2_f;
|
||||
DROP TABLE t1;
|
||||
|
||||
# End of 4.1 tests
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # WL#1213 Implement 4-byte UTF8, UTF16 and UTF32
|
||||
--echo # Testing that only utf8mb4 is superset for utf8
|
||||
--echo # No other Unicode character set pairs have superset/subset relations
|
||||
--echo #
|
||||
|
||||
CREATE TABLE t1 (
|
||||
utf8 CHAR CHARACTER SET utf8,
|
||||
utf8mb4 CHAR CHARACTER SET utf8mb4,
|
||||
ucs2 CHAR CHARACTER SET ucs2,
|
||||
utf16 CHAR CHARACTER SET utf16,
|
||||
utf32 CHAR CHARACTER SET utf32
|
||||
);
|
||||
INSERT INTO t1 VALUES ('','','','','');
|
||||
|
||||
# utf8mb4 is superset only for utf8
|
||||
SELECT CHARSET(CONCAT(utf8, utf8mb4)) FROM t1;
|
||||
--error ER_CANT_AGGREGATE_2COLLATIONS
|
||||
SELECT CHARSET(CONCAT(utf8, ucs2)) FROM t1;
|
||||
--error ER_CANT_AGGREGATE_2COLLATIONS
|
||||
SELECT CHARSET(CONCAT(utf8, utf16)) FROM t1;
|
||||
--error ER_CANT_AGGREGATE_2COLLATIONS
|
||||
SELECT CHARSET(CONCAT(utf8, utf32)) FROM t1;
|
||||
|
||||
|
||||
# utf8mb4 is superset only for utf8
|
||||
SELECT CHARSET(CONCAT(utf8mb4, utf8)) FROM t1;
|
||||
--error ER_CANT_AGGREGATE_2COLLATIONS
|
||||
SELECT CHARSET(CONCAT(utf8mb4, ucs2)) FROM t1;
|
||||
--error ER_CANT_AGGREGATE_2COLLATIONS
|
||||
SELECT CHARSET(CONCAT(utf8mb4, utf16)) FROM t1;
|
||||
--error ER_CANT_AGGREGATE_2COLLATIONS
|
||||
SELECT CHARSET(CONCAT(utf8mb4, utf32)) FROM t1;
|
||||
|
||||
|
||||
# ucs2 is not a superset for the other Unicode character sets
|
||||
--error ER_CANT_AGGREGATE_2COLLATIONS
|
||||
SELECT CHARSET(CONCAT(ucs2, utf8)) FROM t1;
|
||||
--error ER_CANT_AGGREGATE_2COLLATIONS
|
||||
SELECT CHARSET(CONCAT(ucs2, utf8mb4)) FROM t1;
|
||||
--error ER_CANT_AGGREGATE_2COLLATIONS
|
||||
SELECT CHARSET(CONCAT(ucs2, utf16)) FROM t1;
|
||||
--error ER_CANT_AGGREGATE_2COLLATIONS
|
||||
SELECT CHARSET(CONCAT(ucs2, utf32)) FROM t1;
|
||||
|
||||
|
||||
# utf16 is not a superset for the other Unicode character sets
|
||||
--error ER_CANT_AGGREGATE_2COLLATIONS
|
||||
SELECT CHARSET(CONCAT(utf16, utf8)) FROM t1;
|
||||
--error ER_CANT_AGGREGATE_2COLLATIONS
|
||||
SELECT CHARSET(CONCAT(utf16, ucs2)) FROM t1;
|
||||
--error ER_CANT_AGGREGATE_2COLLATIONS
|
||||
SELECT CHARSET(CONCAT(utf16, utf8mb4)) FROM t1;
|
||||
--error ER_CANT_AGGREGATE_2COLLATIONS
|
||||
SELECT CHARSET(CONCAT(utf16, utf32)) FROM t1;
|
||||
|
||||
|
||||
# utf32 is not a superset for the other Unicode character sets
|
||||
--error ER_CANT_AGGREGATE_2COLLATIONS
|
||||
SELECT CHARSET(CONCAT(utf32, utf8)) FROM t1;
|
||||
--error ER_CANT_AGGREGATE_2COLLATIONS
|
||||
SELECT CHARSET(CONCAT(utf32, ucs2)) FROM t1;
|
||||
--error ER_CANT_AGGREGATE_2COLLATIONS
|
||||
SELECT CHARSET(CONCAT(utf32, utf8mb4)) FROM t1;
|
||||
--error ER_CANT_AGGREGATE_2COLLATIONS
|
||||
SELECT CHARSET(CONCAT(utf32, utf16)) FROM t1;
|
||||
|
||||
DROP TABLE t1;
|
||||
|
@ -733,3 +733,17 @@ SELECT HEX(DAYNAME(19700101));
|
||||
SET character_set_connection=latin1;
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # Start of 5.5 tests
|
||||
--echo #
|
||||
|
||||
SET NAMES latin1;
|
||||
SET collation_connection=ucs2_general_ci;
|
||||
--source include/ctype_numconv.inc
|
||||
SET NAMES latin1;
|
||||
|
||||
--echo #
|
||||
--echo # End of 5.5 tests
|
||||
--echo #
|
||||
|
733
mysql-test/t/ctype_utf16.test
Normal file
733
mysql-test/t/ctype_utf16.test
Normal file
@ -0,0 +1,733 @@
|
||||
-- source include/have_utf16.inc
|
||||
-- source include/have_utf8mb4.inc
|
||||
|
||||
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
--enable_warnings
|
||||
|
||||
--echo #
|
||||
--echo # Start of 5.5 tests
|
||||
--echo #
|
||||
|
||||
SET NAMES latin1;
|
||||
SET character_set_connection=utf16;
|
||||
select hex('a'), hex('a ');
|
||||
-- source include/endspace.inc
|
||||
|
||||
|
||||
# Check that incomplete utf16 characters in HEX notation
|
||||
# are left-padded with zeros
|
||||
#
|
||||
select hex(_utf16 0x44);
|
||||
select hex(_utf16 0x3344);
|
||||
select hex(_utf16 0x113344);
|
||||
|
||||
|
||||
# Check that 0x20 is only trimmed when it is
|
||||
# a part of real SPACE character, not just a part
|
||||
# of a multibyte sequence.
|
||||
# Note, CYRILLIC LETTER ER is used as an example, which
|
||||
# is stored as 0x0420 in utf16, thus contains 0x20 in the
|
||||
# low byte. The second character is THREE-PER-M, U+2004,
|
||||
# which contains 0x20 in the high byte.
|
||||
|
||||
CREATE TABLE t1 (word VARCHAR(64), word2 CHAR(64)) CHARACTER SET utf16;
|
||||
INSERT INTO t1 VALUES (_koi8r 0xF2, _koi8r 0xF2), (X'2004',X'2004');
|
||||
SELECT hex(word) FROM t1 ORDER BY word;
|
||||
SELECT hex(word2) FROM t1 ORDER BY word2;
|
||||
DELETE FROM t1;
|
||||
|
||||
#
|
||||
# Check that real spaces are correctly trimmed.
|
||||
#
|
||||
INSERT INTO t1 VALUES (X'042000200020',X'042000200020'), (X'200400200020', X'200400200020');
|
||||
SELECT hex(word) FROM t1 ORDER BY word;
|
||||
SELECT hex(word2) FROM t1 ORDER BY word2;
|
||||
DROP TABLE t1;
|
||||
|
||||
|
||||
#
|
||||
# Check LPAD/RPAD
|
||||
#
|
||||
SELECT hex(LPAD(_utf16 X'0420',10,_utf16 X'0421'));
|
||||
SELECT hex(LPAD(_utf16 X'0420',10,_utf16 X'04210422'));
|
||||
SELECT hex(LPAD(_utf16 X'0420',10,_utf16 X'042104220423'));
|
||||
SELECT hex(LPAD(_utf16 X'0420042104220423042404250426042704280429042A042B',10,_utf16 X'042104220423'));
|
||||
SELECT hex(LPAD(_utf16 X'D800DC00', 10, _utf16 X'0421'));
|
||||
SELECT hex(LPAD(_utf16 X'0421', 10, _utf16 X'D800DC00'));
|
||||
|
||||
SELECT hex(RPAD(_utf16 X'0420',10,_utf16 X'0421'));
|
||||
SELECT hex(RPAD(_utf16 X'0420',10,_utf16 X'04210422'));
|
||||
SELECT hex(RPAD(_utf16 X'0420',10,_utf16 X'042104220423'));
|
||||
SELECT hex(RPAD(_utf16 X'0420042104220423042404250426042704280429042A042B',10,_utf16 X'042104220423'));
|
||||
SELECT hex(RPAD(_utf16 X'D800DC00', 10, _utf16 X'0421'));
|
||||
SELECT hex(RPAD(_utf16 X'0421', 10, _utf16 X'D800DC00'));
|
||||
|
||||
CREATE TABLE t1 SELECT
|
||||
LPAD(_utf16 X'0420',10,_utf16 X'0421') l,
|
||||
RPAD(_utf16 X'0420',10,_utf16 X'0421') r;
|
||||
SHOW CREATE TABLE t1;
|
||||
select hex(l), hex(r) from t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
create table t1 (f1 char(30));
|
||||
insert into t1 values ("103000"), ("22720000"), ("3401200"), ("78000");
|
||||
select lpad(f1, 12, "-o-/") from t1;
|
||||
drop table t1;
|
||||
|
||||
######################################################
|
||||
#
|
||||
# Test of like
|
||||
#
|
||||
|
||||
SET NAMES latin1;
|
||||
SET character_set_connection=utf16;
|
||||
--source include/ctype_like.inc
|
||||
|
||||
SET NAMES utf8;
|
||||
SET character_set_connection=utf16;
|
||||
CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf16);
|
||||
INSERT INTO t1 VALUES ('фыва'),('Фыва'),('фЫва'),('фыВа'),('фывА'),('ФЫВА');
|
||||
INSERT INTO t1 VALUES ('фывапролдж'),('Фывапролдж'),('фЫвапролдж'),('фыВапролдж');
|
||||
INSERT INTO t1 VALUES ('фывАпролдж'),('фываПролдж'),('фывапРолдж'),('фывапрОлдж');
|
||||
INSERT INTO t1 VALUES ('фывапроЛдж'),('фывапролДж'),('фывапролдЖ'),('ФЫВАПРОЛДЖ');
|
||||
SELECT * FROM t1 WHERE a LIKE '%фЫва%' ORDER BY BINARY a;
|
||||
SELECT * FROM t1 WHERE a LIKE '%фЫв%' ORDER BY BINARY a;
|
||||
SELECT * FROM t1 WHERE a LIKE 'фЫва%' ORDER BY BINARY a;
|
||||
SELECT * FROM t1 WHERE a LIKE 'фЫва%' COLLATE utf16_bin ORDER BY BINARY a;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 (word varchar(64) NOT NULL, PRIMARY KEY (word))
|
||||
ENGINE=MyISAM CHARACTER SET utf16;
|
||||
INSERT INTO t1 (word) VALUES ("cat");
|
||||
SELECT * FROM t1 WHERE word LIKE "c%";
|
||||
SELECT * FROM t1 WHERE word LIKE "ca_";
|
||||
SELECT * FROM t1 WHERE word LIKE "cat";
|
||||
SELECT * FROM t1 WHERE word LIKE _utf16 x'00630025'; # "c%"
|
||||
SELECT * FROM t1 WHERE word LIKE _utf16 x'00630061005F'; # "ca_"
|
||||
DROP TABLE t1;
|
||||
|
||||
|
||||
#
|
||||
# Check that INSERT() works fine.
|
||||
# This invokes charpos() function.
|
||||
select insert(_utf16 0x006100620063,10,2,_utf16 0x006400650066);
|
||||
select insert(_utf16 0x006100620063,1,2,_utf16 0x006400650066);
|
||||
|
||||
########################################################
|
||||
#
|
||||
# Bug 1264
|
||||
#
|
||||
# Description:
|
||||
#
|
||||
# When using a ucs2 table in MySQL,
|
||||
# either with ucs2_general_ci or ucs2_bin collation,
|
||||
# words are returned in an incorrect order when using ORDER BY
|
||||
# on an _indexed_ CHAR or VARCHAR column. They are sorted with
|
||||
# the longest word *first* instead of last. I.E. The word "aardvark"
|
||||
# is in the results before the word "a".
|
||||
#
|
||||
# If there is no index for the column, the problem does not occur.
|
||||
#
|
||||
# Interestingly, if there is no second column, the words are returned
|
||||
# in the correct order.
|
||||
#
|
||||
# According to EXPLAIN, it looks like when the output includes columns that
|
||||
# are not part of the index sorted on, it does a filesort, which fails.
|
||||
# Using a straight index yields correct results.
|
||||
|
||||
SET NAMES latin1;
|
||||
|
||||
#
|
||||
# Two fields, index
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (
|
||||
word VARCHAR(64),
|
||||
bar INT(11) default 0,
|
||||
PRIMARY KEY (word))
|
||||
ENGINE=MyISAM
|
||||
CHARSET utf16
|
||||
COLLATE utf16_general_ci ;
|
||||
|
||||
INSERT INTO t1 (word) VALUES ("aar");
|
||||
INSERT INTO t1 (word) VALUES ("a");
|
||||
INSERT INTO t1 (word) VALUES ("aardvar");
|
||||
INSERT INTO t1 (word) VALUES ("aardvark");
|
||||
INSERT INTO t1 (word) VALUES ("aardvara");
|
||||
INSERT INTO t1 (word) VALUES ("aardvarz");
|
||||
EXPLAIN SELECT * FROM t1 ORDER BY word;
|
||||
SELECT * FROM t1 ORDER BY word;
|
||||
EXPLAIN SELECT word FROM t1 ORDER BY word;
|
||||
SELECT word FROM t1 ORDER by word;
|
||||
DROP TABLE t1;
|
||||
|
||||
|
||||
#
|
||||
# One field, index
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (
|
||||
word VARCHAR(64) ,
|
||||
PRIMARY KEY (word))
|
||||
ENGINE=MyISAM
|
||||
CHARSET utf16
|
||||
COLLATE utf16_general_ci;
|
||||
|
||||
INSERT INTO t1 (word) VALUES ("aar");
|
||||
INSERT INTO t1 (word) VALUES ("a");
|
||||
INSERT INTO t1 (word) VALUES ("aardvar");
|
||||
INSERT INTO t1 (word) VALUES ("aardvark");
|
||||
INSERT INTO t1 (word) VALUES ("aardvara");
|
||||
INSERT INTO t1 (word) VALUES ("aardvarz");
|
||||
EXPLAIN SELECT * FROM t1 ORDER BY WORD;
|
||||
SELECT * FROM t1 ORDER BY word;
|
||||
DROP TABLE t1;
|
||||
|
||||
|
||||
#
|
||||
# Two fields, no index
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (
|
||||
word TEXT,
|
||||
bar INT(11) AUTO_INCREMENT,
|
||||
PRIMARY KEY (bar))
|
||||
ENGINE=MyISAM
|
||||
CHARSET utf16
|
||||
COLLATE utf16_general_ci ;
|
||||
INSERT INTO t1 (word) VALUES ("aar");
|
||||
INSERT INTO t1 (word) VALUES ("a" );
|
||||
INSERT INTO t1 (word) VALUES ("aardvar");
|
||||
INSERT INTO t1 (word) VALUES ("aardvark");
|
||||
INSERT INTO t1 (word) VALUES ("aardvara");
|
||||
INSERT INTO t1 (word) VALUES ("aardvarz");
|
||||
EXPLAIN SELECT * FROM t1 ORDER BY word;
|
||||
SELECT * FROM t1 ORDER BY word;
|
||||
EXPLAIN SELECT word FROM t1 ORDER BY word;
|
||||
SELECT word FROM t1 ORDER BY word;
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# END OF Bug 1264 test
|
||||
#
|
||||
########################################################
|
||||
|
||||
|
||||
#
|
||||
# Check alignment for from-binary-conversion with CAST and CONVERT
|
||||
#
|
||||
SELECT hex(cast(0xAA as char character set utf16));
|
||||
SELECT hex(convert(0xAA using utf16));
|
||||
|
||||
#
|
||||
# Check alignment for string types
|
||||
#
|
||||
CREATE TABLE t1 (a char(10) character set utf16);
|
||||
INSERT INTO t1 VALUES (0x1),(0x11),(0x111),(0x1111),(0x11111);
|
||||
SELECT HEX(a) FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 (a varchar(10) character set utf16);
|
||||
INSERT INTO t1 VALUES (0x1),(0x11),(0x111),(0x1111),(0x11111);
|
||||
SELECT HEX(a) FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 (a text character set utf16);
|
||||
INSERT INTO t1 VALUES (0x1),(0x11),(0x111),(0x1111),(0x11111);
|
||||
SELECT HEX(a) FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 (a mediumtext character set utf16);
|
||||
INSERT INTO t1 VALUES (0x1),(0x11),(0x111),(0x1111),(0x11111);
|
||||
SELECT HEX(a) FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 (a longtext character set utf16);
|
||||
INSERT INTO t1 VALUES (0x1),(0x11),(0x111),(0x1111),(0x11111);
|
||||
SELECT HEX(a) FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
##
|
||||
## Bug #5024 Server crashes with queries on fields
|
||||
## with certain charset/collation settings
|
||||
##
|
||||
##
|
||||
#create table t1 (s1 char character set utf16 collate utf16_czech_ci);
|
||||
#insert into t1 values ('0'),('1'),('2'),('a'),('b'),('c');
|
||||
#select s1 from t1 where s1 > 'a' order by s1;
|
||||
#drop table t1;
|
||||
#
|
||||
|
||||
#
|
||||
# Bug #5081 : UCS2 fields are filled with '0x2020'
|
||||
# after extending field length
|
||||
#
|
||||
create table t1(a char(1)) default charset utf16;
|
||||
insert into t1 values ('a'),('b'),('c');
|
||||
alter table t1 modify a char(5);
|
||||
select a, hex(a) from t1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Check prepare statement from an UTF16 string
|
||||
#
|
||||
set @ivar= 1234;
|
||||
set @str1 = 'select ?';
|
||||
set @str2 = convert(@str1 using utf16);
|
||||
prepare stmt1 from @str2;
|
||||
execute stmt1 using @ivar;
|
||||
|
||||
#
|
||||
# Check that utf16 works with ENUM and SET type
|
||||
#
|
||||
set names utf8;
|
||||
create table t1 (a enum('x','y','z') character set utf16);
|
||||
show create table t1;
|
||||
insert into t1 values ('x');
|
||||
insert into t1 values ('y');
|
||||
insert into t1 values ('z');
|
||||
select a, hex(a) from t1 order by a;
|
||||
alter table t1 change a a enum('x','y','z','d','e','ä','ö','ü') character set utf16;
|
||||
show create table t1;
|
||||
insert into t1 values ('D');
|
||||
insert into t1 values ('E ');
|
||||
insert into t1 values ('ä');
|
||||
insert into t1 values ('ö');
|
||||
insert into t1 values ('ü');
|
||||
select a, hex(a) from t1 order by a;
|
||||
drop table t1;
|
||||
|
||||
create table t1 (a set ('x','y','z','ä','ö','ü') character set utf16);
|
||||
show create table t1;
|
||||
insert into t1 values ('x');
|
||||
insert into t1 values ('y');
|
||||
insert into t1 values ('z');
|
||||
insert into t1 values ('x,y');
|
||||
insert into t1 values ('x,y,z,ä,ö,ü');
|
||||
select a, hex(a) from t1 order by a;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug#7302 UCS2 data in ENUM fields get truncated when new column is added
|
||||
#
|
||||
create table t1(a enum('a','b','c')) default character set utf16;
|
||||
insert into t1 values('a'),('b'),('c');
|
||||
alter table t1 add b char(1);
|
||||
show warnings;
|
||||
select * from t1 order by a;
|
||||
drop table t1;
|
||||
|
||||
SET NAMES latin1;
|
||||
SET collation_connection='utf16_general_ci';
|
||||
-- source include/ctype_filesort.inc
|
||||
-- source include/ctype_like_escape.inc
|
||||
SET NAMES latin1;
|
||||
SET collation_connection='utf16_bin';
|
||||
-- source include/ctype_filesort.inc
|
||||
-- source include/ctype_like_escape.inc
|
||||
|
||||
#
|
||||
# Bug#10344 Some string functions fail for UCS2
|
||||
#
|
||||
select hex(substr(_utf16 0x00e400e50068,1));
|
||||
select hex(substr(_utf16 0x00e400e50068,2));
|
||||
select hex(substr(_utf16 0x00e400e50068,3));
|
||||
select hex(substr(_utf16 0x00e400e50068,-1));
|
||||
select hex(substr(_utf16 0x00e400e50068,-2));
|
||||
select hex(substr(_utf16 0x00e400e50068,-3));
|
||||
select hex(substr(_utf16 0x00e400e5D800DC00,1));
|
||||
select hex(substr(_utf16 0x00e400e5D800DC00,2));
|
||||
select hex(substr(_utf16 0x00e400e5D800DC00,3));
|
||||
select hex(substr(_utf16 0x00e400e5D800DC00,-1));
|
||||
select hex(substr(_utf16 0x00e400e5D800DC00,-2));
|
||||
select hex(substr(_utf16 0x00e400e5D800DC00,-3));
|
||||
|
||||
SET NAMES latin1;
|
||||
|
||||
##
|
||||
## Bug#8235
|
||||
##
|
||||
## This bug also helped to find another problem that
|
||||
## INSERT of a UCS2 string containing a negative number
|
||||
## into a unsigned int column didn't produce warnings.
|
||||
## This test covers both problems.
|
||||
##
|
||||
##SET collation_connection='ucs2_swedish_ci';
|
||||
##CREATE TABLE t1 (Field1 int(10) default '0');
|
||||
### no warnings, negative numbers are allowed
|
||||
##INSERT INTO t1 VALUES ('-1');
|
||||
##SELECT * FROM t1;
|
||||
##DROP TABLE t1;
|
||||
##CREATE TABLE t1 (Field1 int(10) unsigned default '0');
|
||||
### this should generate a "Data truncated" warning
|
||||
##INSERT INTO t1 VALUES ('-1');
|
||||
##DROP TABLE t1;
|
||||
##SET NAMES latin1;
|
||||
|
||||
###
|
||||
### Bug #14583 Bug on query using a LIKE on indexed field with ucs2_bin collation
|
||||
###
|
||||
##--disable_warnings
|
||||
##create table t1(f1 varchar(5) CHARACTER SET utf16 COLLATE utf16_bin NOT NULL) engine=InnoDB;
|
||||
##--enable_warnings
|
||||
##insert into t1 values('a');
|
||||
##create index t1f1 on t1(f1);
|
||||
##select f1 from t1 where f1 like 'a%';
|
||||
##drop table t1;
|
||||
|
||||
#
|
||||
# Bug#9442 Set parameter make query fail if column character set is UCS2
|
||||
#
|
||||
create table t1 (utext varchar(20) character set utf16);
|
||||
insert into t1 values ("lily");
|
||||
insert into t1 values ("river");
|
||||
prepare stmt from 'select utext from t1 where utext like ?';
|
||||
set @param1='%%';
|
||||
execute stmt using @param1;
|
||||
execute stmt using @param1;
|
||||
select utext from t1 where utext like '%%';
|
||||
drop table t1;
|
||||
deallocate prepare stmt;
|
||||
|
||||
#
|
||||
# Bug#22052 Trailing spaces are not removed from UNICODE fields in an index
|
||||
#
|
||||
create table t1 (
|
||||
a char(10) character set utf16 not null,
|
||||
index a (a)
|
||||
) engine=myisam;
|
||||
insert into t1 values (repeat(0x201f, 10));
|
||||
insert into t1 values (repeat(0x2020, 10));
|
||||
insert into t1 values (repeat(0x2021, 10));
|
||||
# make sure "index read" is used
|
||||
explain select hex(a) from t1 order by a;
|
||||
select hex(a) from t1 order by a;
|
||||
alter table t1 drop index a;
|
||||
select hex(a) from t1 order by a;
|
||||
drop table t1;
|
||||
|
||||
##
|
||||
## Bug #20076: server crashes for a query with GROUP BY if MIN/MAX aggregation
|
||||
## over a 'ucs2' field uses a temporary table
|
||||
##
|
||||
##CREATE TABLE t1 (id int, s char(5) CHARACTER SET ucs2 COLLATE ucs2_unicode_ci);
|
||||
##INSERT INTO t1 VALUES (1, 'ZZZZZ'), (1, 'ZZZ'), (2, 'ZZZ'), (2, 'ZZZZZ');
|
||||
##SELECT id, MIN(s) FROM t1 GROUP BY id;
|
||||
##DROP TABLE t1;
|
||||
|
||||
###
|
||||
### Bug #20536: md5() with GROUP BY and UCS2 return different results on myisam/innodb
|
||||
###
|
||||
##
|
||||
##--disable_warnings
|
||||
##drop table if exists bug20536;
|
||||
##--enable_warnings
|
||||
##
|
||||
##set names latin1;
|
||||
##create table bug20536 (id bigint not null auto_increment primary key, name
|
||||
##varchar(255) character set ucs2 not null);
|
||||
##insert into `bug20536` (`id`,`name`) values (1, _latin1 x'7465737431'), (2, "'test\\_2'");
|
||||
##select md5(name) from bug20536;
|
||||
##select sha1(name) from bug20536;
|
||||
##select make_set(3, name, upper(name)) from bug20536;
|
||||
##select export_set(5, name, upper(name)) from bug20536;
|
||||
##select export_set(5, name, upper(name), ",", 5) from bug20536;
|
||||
|
||||
#
|
||||
# Bug #20108: corrupted default enum value for a ucs2 field
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (
|
||||
status enum('active','passive') character set utf16 collate utf16_general_ci
|
||||
NOT NULL default 'passive'
|
||||
);
|
||||
SHOW CREATE TABLE t1;
|
||||
ALTER TABLE t1 ADD a int NOT NULL AFTER status;
|
||||
SHOW CREATE TABLE t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
##CREATE TABLE t2 (
|
||||
## status enum('active','passive') collate ucs2_turkish_ci
|
||||
## NOT NULL default 'passive'
|
||||
##);
|
||||
##SHOW CREATE TABLE t2;
|
||||
##ALTER TABLE t2 ADD a int NOT NULL AFTER status;
|
||||
##DROP TABLE t2;
|
||||
|
||||
|
||||
--echo End of 4.1 tests
|
||||
|
||||
#
|
||||
# Conversion from an UTF16 string to a decimal column
|
||||
#
|
||||
CREATE TABLE t1 (a varchar(64) character set utf16, b decimal(10,3));
|
||||
INSERT INTO t1 VALUES ("1.1", 0), ("2.1", 0);
|
||||
update t1 set b=a;
|
||||
SELECT *, hex(a) FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Bug#9442 Set parameter make query fail if column character set is UCS2
|
||||
#
|
||||
create table t1 (utext varchar(20) character set utf16);
|
||||
insert into t1 values ("lily");
|
||||
insert into t1 values ("river");
|
||||
prepare stmt from 'select utext from t1 where utext like ?';
|
||||
set @param1='%%';
|
||||
execute stmt using @param1;
|
||||
execute stmt using @param1;
|
||||
select utext from t1 where utext like '%%';
|
||||
drop table t1;
|
||||
deallocate prepare stmt;
|
||||
|
||||
#
|
||||
# Bug#22638 SOUNDEX broken for international characters
|
||||
#
|
||||
set names latin1;
|
||||
set character_set_connection=utf16;
|
||||
select soundex(''),soundex('he'),soundex('hello all folks'),soundex('#3556 in bugdb');
|
||||
select hex(soundex('')),hex(soundex('he')),hex(soundex('hello all folks')),hex(soundex('#3556 in bugdb'));
|
||||
select 'mood' sounds like 'mud';
|
||||
# Cyrillic A, BE, VE
|
||||
select hex(soundex(_utf16 0x041004110412));
|
||||
# Make sure that "U+00BF INVERTED QUESTION MARK" is not considered as letter
|
||||
select hex(soundex(_utf16 0x00BF00C0));
|
||||
set names latin1;
|
||||
|
||||
#
|
||||
# Bug #14290: character_maximum_length for text fields
|
||||
#
|
||||
create table t1(a blob, b text charset utf16);
|
||||
select data_type, character_octet_length, character_maximum_length
|
||||
from information_schema.columns where table_name='t1';
|
||||
drop table t1;
|
||||
|
||||
|
||||
set names latin1;
|
||||
set collation_connection=utf16_general_ci;
|
||||
#
|
||||
# Testing cs->coll->instr()
|
||||
#
|
||||
select position('bb' in 'abba');
|
||||
|
||||
#
|
||||
# Testing cs->coll->hash_sort()
|
||||
#
|
||||
create table t1 (a varchar(10) character set utf16) engine=heap;
|
||||
insert into t1 values ('a'),('A'),('b'),('B');
|
||||
select * from t1 where a='a' order by binary a;
|
||||
select hex(min(binary a)),count(*) from t1 group by a;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Testing cs->cset->numchars()
|
||||
#
|
||||
select char_length('abcd'), octet_length('abcd');
|
||||
select char_length(_utf16 0xD800DC00), octet_length(_utf16 0xD800DC00);
|
||||
select char_length(_utf16 0xD87FDFFF), octet_length(_utf16 0xD87FDFFF);
|
||||
|
||||
#
|
||||
# Testing cs->cset->charpos()
|
||||
#
|
||||
select left('abcd',2);
|
||||
select hex(left(_utf16 0xD800DC00D87FDFFF, 1));
|
||||
select hex(right(_utf16 0xD800DC00D87FDFFF, 1));
|
||||
|
||||
#
|
||||
# Testing cs->cset->well_formed_length()
|
||||
#
|
||||
create table t1 (a varchar(10) character set utf16);
|
||||
# Bad sequences
|
||||
--error ER_INVALID_CHARACTER_STRING
|
||||
insert into t1 values (_utf16 0xD800);
|
||||
--error ER_INVALID_CHARACTER_STRING
|
||||
insert into t1 values (_utf16 0xDC00);
|
||||
--error ER_INVALID_CHARACTER_STRING
|
||||
insert into t1 values (_utf16 0xD800D800);
|
||||
--error ER_INVALID_CHARACTER_STRING
|
||||
insert into t1 values (_utf16 0xD800E800);
|
||||
--error ER_INVALID_CHARACTER_STRING
|
||||
insert into t1 values (_utf16 0xD8000800);
|
||||
# Good sequences
|
||||
insert into t1 values (_utf16 0xD800DC00);
|
||||
insert into t1 values (_utf16 0xD800DCFF);
|
||||
insert into t1 values (_utf16 0xDBFFDC00);
|
||||
insert into t1 values (_utf16 0xDBFFDCFF);
|
||||
select hex(a) from t1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug#32393 Character sets: illegal characters in utf16 columns
|
||||
#
|
||||
# Tests that cs->cset->wc_mb() doesn't accept surrogate parts
|
||||
#
|
||||
# via alter
|
||||
#
|
||||
create table t1 (s1 varchar(50) character set ucs2);
|
||||
insert into t1 values (0xdf84);
|
||||
alter table t1 modify column s1 varchar(50) character set utf16;
|
||||
select hex(s1) from t1;
|
||||
drop table t1;
|
||||
#
|
||||
# via update
|
||||
#
|
||||
create table t1 (s1 varchar(5) character set ucs2, s2 varchar(5) character set utf16);
|
||||
insert into t1 (s1) values (0xdf84);
|
||||
update t1 set s2 = s1;
|
||||
select hex(s2) from t1;
|
||||
drop table t1;
|
||||
|
||||
|
||||
|
||||
#
|
||||
# Testing cs->cset->lengthsp()
|
||||
#
|
||||
create table t1 (a char(10)) character set utf16;
|
||||
insert into t1 values ('a ');
|
||||
select hex(a) from t1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Testing cs->cset->caseup() and cs->cset->casedn()
|
||||
#
|
||||
select upper('abcd'), lower('ABCD');
|
||||
|
||||
#
|
||||
# TODO: str_to_datetime() is broken and doesn't work with ucs2 and utf16
|
||||
# Testing cs->cset->snprintf()
|
||||
#
|
||||
#create table t1 (a date);
|
||||
#insert into t1 values ('2007-09-16');
|
||||
#select * from t1;
|
||||
#drop table t1;
|
||||
|
||||
#
|
||||
# Testing cs->cset->l10tostr
|
||||
# !!! Not used in the code
|
||||
|
||||
#
|
||||
# Testing cs->cset->ll10tostr
|
||||
#
|
||||
create table t1 (a varchar(10) character set utf16);
|
||||
insert into t1 values (123456);
|
||||
select a, hex(a) from t1;
|
||||
drop table t1;
|
||||
|
||||
|
||||
# Testing cs->cset->fill
|
||||
# SOUNDEX fills strings with DIGIT ZERO up to four characters
|
||||
select hex(soundex('a'));
|
||||
|
||||
#
|
||||
# Testing cs->cset->strntol
|
||||
# !!! Not used in the code
|
||||
|
||||
#
|
||||
# Testing cs->cset->strntoul
|
||||
#
|
||||
create table t1 (a enum ('a','b','c')) character set utf16;
|
||||
insert into t1 values ('1');
|
||||
select * from t1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Testing cs->cset->strntoll and cs->cset->strntoull
|
||||
#
|
||||
set names latin1;
|
||||
select hex(conv(convert('123' using utf16), -10, 16));
|
||||
select hex(conv(convert('123' using utf16), 10, 16));
|
||||
|
||||
#
|
||||
# Testing cs->cset->strntod
|
||||
#
|
||||
set names latin1;
|
||||
set character_set_connection=utf16;
|
||||
select 1.1 + '1.2';
|
||||
select 1.1 + '1.2xxx';
|
||||
|
||||
# Testing strntoll10_utf16
|
||||
# Testing cs->cset->strtoll10
|
||||
select left('aaa','1');
|
||||
|
||||
#
|
||||
# Testing cs->cset->strntoull10rnd
|
||||
#
|
||||
create table t1 (a int);
|
||||
insert into t1 values ('-1234.1e2');
|
||||
insert into t1 values ('-1234.1e2xxxx');
|
||||
insert into t1 values ('-1234.1e2 ');
|
||||
select * from t1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Testing cs->cset->scan
|
||||
#
|
||||
create table t1 (a int);
|
||||
insert into t1 values ('1 ');
|
||||
insert into t1 values ('1 x');
|
||||
select * from t1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Testing auto-conversion to TEXT
|
||||
#
|
||||
create table t1 (a varchar(17000) character set utf16);
|
||||
show create table t1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Testing that maximim possible key length is 1000 bytes
|
||||
#
|
||||
create table t1 (a varchar(250) character set utf16 primary key);
|
||||
show create table t1;
|
||||
drop table t1;
|
||||
--error ER_TOO_LONG_KEY
|
||||
create table t1 (a varchar(334) character set utf16 primary key);
|
||||
|
||||
#
|
||||
# Conversion to utf8
|
||||
#
|
||||
create table t1 (a char(1) character set utf16);
|
||||
insert into t1 values (0xD800DC00),(0xD800DCFF),(0xDB7FDC00),(0xDB7FDCFF);
|
||||
insert into t1 values (0x00C0), (0x00FF),(0xE000), (0xFFFF);
|
||||
select hex(a), hex(@a:=convert(a using utf8mb4)), hex(convert(@a using utf16)) from t1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Test basic regex functionality
|
||||
#
|
||||
set collation_connection=utf16_general_ci;
|
||||
--source include/ctype_regex.inc
|
||||
set names latin1;
|
||||
|
||||
#
|
||||
# Test how character set works with date/time
|
||||
#
|
||||
SET collation_connection=utf16_general_ci;
|
||||
--source include/ctype_datetime.inc
|
||||
SET NAMES latin1;
|
||||
|
||||
#
|
||||
# Bug#33073 Character sets: ordering fails with utf32
|
||||
#
|
||||
SET collation_connection=utf16_general_ci;
|
||||
CREATE TABLE t1 AS SELECT repeat('a',2) as s1 LIMIT 0;
|
||||
SHOW CREATE TABLE t1;
|
||||
INSERT INTO t1 VALUES ('ab'),('AE'),('ab'),('AE');
|
||||
SELECT * FROM t1 ORDER BY s1;
|
||||
SET max_sort_length=4;
|
||||
SELECT * FROM t1 ORDER BY s1;
|
||||
DROP TABLE t1;
|
||||
SET max_sort_length=DEFAULT;
|
||||
SET NAMES latin1;
|
||||
|
||||
|
||||
#
|
||||
## TODO: add tests for all engines
|
||||
#
|
||||
|
||||
--echo #
|
||||
--echo # End of 5.5 tests
|
||||
--echo #
|
290
mysql-test/t/ctype_utf16_uca.test
Normal file
290
mysql-test/t/ctype_utf16_uca.test
Normal file
@ -0,0 +1,290 @@
|
||||
-- source include/have_utf16.inc
|
||||
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
--enable_warnings
|
||||
|
||||
--echo #
|
||||
--echo # Start of 5.5 tests
|
||||
--echo #
|
||||
|
||||
set names utf8;
|
||||
set collation_connection=utf16_unicode_ci;
|
||||
select hex('a'), hex('a ');
|
||||
-- source include/endspace.inc
|
||||
|
||||
#
|
||||
# Bug #6787 LIKE not working properly with _ and utf8 data
|
||||
#
|
||||
select 'c' like '\_' as want0;
|
||||
|
||||
#
|
||||
# Bug #5679 utf8_unicode_ci LIKE--trailing % doesn't equal zero characters
|
||||
#
|
||||
CREATE TABLE t (
|
||||
c char(20) NOT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARACTER SET utf16 COLLATE utf16_unicode_ci;
|
||||
INSERT INTO t VALUES ('a'),('ab'),('aba');
|
||||
ALTER TABLE t ADD INDEX (c);
|
||||
SELECT c FROM t WHERE c LIKE 'a%';
|
||||
DROP TABLE t;
|
||||
|
||||
|
||||
create table t1 (c1 char(10) character set utf16 collate utf16_bin);
|
||||
|
||||
#
|
||||
# Basic Latin
|
||||
#
|
||||
insert into t1 values ('A'),('a');
|
||||
insert into t1 values ('B'),('b');
|
||||
insert into t1 values ('C'),('c');
|
||||
insert into t1 values ('D'),('d');
|
||||
insert into t1 values ('E'),('e');
|
||||
insert into t1 values ('F'),('f');
|
||||
insert into t1 values ('G'),('g');
|
||||
insert into t1 values ('H'),('h');
|
||||
insert into t1 values ('I'),('i');
|
||||
insert into t1 values ('J'),('j');
|
||||
insert into t1 values ('K'),('k');
|
||||
insert into t1 values ('L'),('l');
|
||||
insert into t1 values ('M'),('m');
|
||||
insert into t1 values ('N'),('n');
|
||||
insert into t1 values ('O'),('o');
|
||||
insert into t1 values ('P'),('p');
|
||||
insert into t1 values ('Q'),('q');
|
||||
insert into t1 values ('R'),('r');
|
||||
insert into t1 values ('S'),('s');
|
||||
insert into t1 values ('T'),('t');
|
||||
insert into t1 values ('U'),('u');
|
||||
insert into t1 values ('V'),('v');
|
||||
insert into t1 values ('W'),('w');
|
||||
insert into t1 values ('X'),('x');
|
||||
insert into t1 values ('Y'),('y');
|
||||
insert into t1 values ('Z'),('z');
|
||||
|
||||
#
|
||||
# Latin1 suppliment
|
||||
#
|
||||
insert into t1 values (0x00e0),(0x00c0);
|
||||
insert into t1 values (0x00e1),(0x00c1);
|
||||
insert into t1 values (0x00e2),(0x00c2);
|
||||
insert into t1 values (0x00e3),(0x00c3);
|
||||
insert into t1 values (0x00e4),(0x00c4);
|
||||
insert into t1 values (0x00e5),(0x00c5);
|
||||
insert into t1 values (0x00e6),(0x00c6);
|
||||
insert into t1 values (0x00e7),(0x00c7);
|
||||
insert into t1 values (0x00e8),(0x00c8);
|
||||
insert into t1 values (0x00e9),(0x00c9);
|
||||
insert into t1 values (0x00ea),(0x00ca);
|
||||
insert into t1 values (0x00eb),(0x00cb);
|
||||
insert into t1 values (0x00ec),(0x00cc);
|
||||
insert into t1 values (0x00ed),(0x00cd);
|
||||
insert into t1 values (0x00ee),(0x00ce);
|
||||
insert into t1 values (0x00ef),(0x00cf);
|
||||
|
||||
insert into t1 values (0x00f0),(0x00d0);
|
||||
insert into t1 values (0x00f1),(0x00d1);
|
||||
insert into t1 values (0x00f2),(0x00d2);
|
||||
insert into t1 values (0x00f3),(0x00d3);
|
||||
insert into t1 values (0x00f4),(0x00d4);
|
||||
insert into t1 values (0x00f5),(0x00d5);
|
||||
insert into t1 values (0x00f6),(0x00d6);
|
||||
insert into t1 values (0x00f7),(0x00d7);
|
||||
insert into t1 values (0x00f8),(0x00d8);
|
||||
insert into t1 values (0x00f9),(0x00d9);
|
||||
insert into t1 values (0x00fa),(0x00da);
|
||||
insert into t1 values (0x00fb),(0x00db);
|
||||
insert into t1 values (0x00fc),(0x00dc);
|
||||
insert into t1 values (0x00fd),(0x00dd);
|
||||
insert into t1 values (0x00fe),(0x00de);
|
||||
insert into t1 values (0x00ff),(0x00df);
|
||||
|
||||
#
|
||||
# Latin extended-A, 0100-017F
|
||||
#
|
||||
insert into t1 values (0x0100),(0x0101),(0x0102),(0x0103);
|
||||
insert into t1 values (0x0104),(0x0105),(0x0106),(0x0107);
|
||||
insert into t1 values (0x0108),(0x0109),(0x010a),(0x010b);
|
||||
insert into t1 values (0x010c),(0x010d),(0x010e),(0x010f);
|
||||
insert into t1 values (0x0110),(0x0111),(0x0112),(0x0113);
|
||||
insert into t1 values (0x0114),(0x0115),(0x0116),(0x0117);
|
||||
insert into t1 values (0x0118),(0x0119),(0x011a),(0x011b);
|
||||
insert into t1 values (0x011c),(0x011d),(0x011e),(0x011f);
|
||||
insert into t1 values (0x0120),(0x0121),(0x0122),(0x0123);
|
||||
insert into t1 values (0x0124),(0x0125),(0x0126),(0x0127);
|
||||
insert into t1 values (0x0128),(0x0129),(0x012a),(0x012b);
|
||||
insert into t1 values (0x012c),(0x012d),(0x012e),(0x012f);
|
||||
insert into t1 values (0x0130),(0x0131),(0x0132),(0x0133);
|
||||
insert into t1 values (0x0134),(0x0135),(0x0136),(0x0137);
|
||||
insert into t1 values (0x0138),(0x0139),(0x013a),(0x013b);
|
||||
insert into t1 values (0x013c),(0x013d),(0x013e),(0x013f);
|
||||
insert into t1 values (0x0140),(0x0141),(0x0142),(0x0143);
|
||||
insert into t1 values (0x0144),(0x0145),(0x0146),(0x0147);
|
||||
insert into t1 values (0x0148),(0x0149),(0x014a),(0x014b);
|
||||
insert into t1 values (0x014c),(0x014d),(0x014e),(0x014f);
|
||||
insert into t1 values (0x0150),(0x0151),(0x0152),(0x0153);
|
||||
insert into t1 values (0x0154),(0x0155),(0x0156),(0x0157);
|
||||
insert into t1 values (0x0158),(0x0159),(0x015a),(0x015b);
|
||||
insert into t1 values (0x015c),(0x015d),(0x015e),(0x015f);
|
||||
insert into t1 values (0x0160),(0x0161),(0x0162),(0x0163);
|
||||
insert into t1 values (0x0164),(0x0165),(0x0166),(0x0167);
|
||||
insert into t1 values (0x0168),(0x0169),(0x016a),(0x016b);
|
||||
insert into t1 values (0x016c),(0x016d),(0x016e),(0x016f);
|
||||
insert into t1 values (0x0170),(0x0171),(0x0172),(0x0173);
|
||||
insert into t1 values (0x0174),(0x0175),(0x0176),(0x0177);
|
||||
insert into t1 values (0x0178),(0x0179),(0x017a),(0x017b);
|
||||
insert into t1 values (0x017c),(0x017d),(0x017e),(0x017f);
|
||||
|
||||
#
|
||||
# Latin extended-B, 0180-024F
|
||||
#
|
||||
insert into t1 values (0x0180),(0x0181),(0x0182),(0x0183);
|
||||
insert into t1 values (0x0184),(0x0185),(0x0186),(0x0187);
|
||||
insert into t1 values (0x0188),(0x0189),(0x018a),(0x018b);
|
||||
insert into t1 values (0x018c),(0x018d),(0x018e),(0x018f);
|
||||
insert into t1 values (0x0190),(0x0191),(0x0192),(0x0193);
|
||||
insert into t1 values (0x0194),(0x0195),(0x0196),(0x0197);
|
||||
insert into t1 values (0x0198),(0x0199),(0x019a),(0x019b);
|
||||
insert into t1 values (0x019c),(0x019d),(0x019e),(0x019f);
|
||||
insert into t1 values (0x01a0),(0x01a1),(0x01a2),(0x01a3);
|
||||
insert into t1 values (0x01a4),(0x01a5),(0x01a6),(0x01a7);
|
||||
insert into t1 values (0x01a8),(0x01a9),(0x01aa),(0x01ab);
|
||||
insert into t1 values (0x01ac),(0x01ad),(0x01ae),(0x01af);
|
||||
insert into t1 values (0x01b0),(0x01b1),(0x01b2),(0x01b3);
|
||||
insert into t1 values (0x01b4),(0x01b5),(0x01b6),(0x01b7);
|
||||
insert into t1 values (0x01b8),(0x01b9),(0x01ba),(0x01bb);
|
||||
insert into t1 values (0x01bc),(0x01bd),(0x01be),(0x01bf);
|
||||
insert into t1 values (0x01c0),(0x01c1),(0x01c2),(0x01c3);
|
||||
insert into t1 values (0x01c4),(0x01c5),(0x01c6),(0x01c7);
|
||||
insert into t1 values (0x01c8),(0x01c9),(0x01ca),(0x01cb);
|
||||
insert into t1 values (0x01cc),(0x01cd),(0x01ce),(0x01cf);
|
||||
insert into t1 values (0x01d0),(0x01d1),(0x01d2),(0x01d3);
|
||||
insert into t1 values (0x01d4),(0x01d5),(0x01d6),(0x01d7);
|
||||
insert into t1 values (0x01d8),(0x01d9),(0x01da),(0x01db);
|
||||
insert into t1 values (0x01dc),(0x01dd),(0x01de),(0x01df);
|
||||
insert into t1 values (0x01e0),(0x01e1),(0x01e2),(0x01e3);
|
||||
insert into t1 values (0x01e4),(0x01e5),(0x01e6),(0x01e7);
|
||||
insert into t1 values (0x01e8),(0x01e9),(0x01ea),(0x01eb);
|
||||
insert into t1 values (0x01ec),(0x01ed),(0x01ee),(0x01ef);
|
||||
insert into t1 values (0x01f0),(0x01f1),(0x01f2),(0x01f3);
|
||||
insert into t1 values (0x01f4),(0x01f5),(0x01f6),(0x01f7);
|
||||
insert into t1 values (0x01f8),(0x01f9),(0x01fa),(0x01fb);
|
||||
insert into t1 values (0x01fc),(0x01fd),(0x01fe),(0x01ff);
|
||||
|
||||
|
||||
insert into t1 values ('AA'),('Aa'),('aa'),('aA');
|
||||
insert into t1 values ('CH'),('Ch'),('ch'),('cH');
|
||||
insert into t1 values ('DZ'),('Dz'),('dz'),('dZ');
|
||||
insert into t1 values ('IJ'),('Ij'),('ij'),('iJ');
|
||||
insert into t1 values ('LJ'),('Lj'),('lj'),('lJ');
|
||||
insert into t1 values ('LL'),('Ll'),('ll'),('lL');
|
||||
insert into t1 values ('NJ'),('Nj'),('nj'),('nJ');
|
||||
insert into t1 values ('OE'),('Oe'),('oe'),('oE');
|
||||
insert into t1 values ('SS'),('Ss'),('ss'),('sS');
|
||||
insert into t1 values ('RR'),('Rr'),('rr'),('rR');
|
||||
|
||||
select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf16_unicode_ci;
|
||||
select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf16_icelandic_ci;
|
||||
select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf16_latvian_ci;
|
||||
select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf16_romanian_ci;
|
||||
select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf16_slovenian_ci;
|
||||
select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf16_polish_ci;
|
||||
select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf16_estonian_ci;
|
||||
select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf16_spanish_ci;
|
||||
select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf16_swedish_ci;
|
||||
select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf16_turkish_ci;
|
||||
select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf16_czech_ci;
|
||||
select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf16_danish_ci;
|
||||
select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf16_lithuanian_ci;
|
||||
select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf16_slovak_ci;
|
||||
select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf16_spanish2_ci;
|
||||
select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf16_roman_ci;
|
||||
select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf16_esperanto_ci;
|
||||
select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf16_hungarian_ci;
|
||||
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug#5324
|
||||
#
|
||||
SET NAMES utf8;
|
||||
|
||||
CREATE TABLE t1 (c varchar(200) CHARACTER SET utf16 COLLATE utf16_general_ci NOT NULL, INDEX (c));
|
||||
INSERT INTO t1 VALUES (0x039C03C903B403B11F770308);
|
||||
#Check one row
|
||||
SELECT * FROM t1 WHERE c LIKE _utf16 0x039C0025 COLLATE utf16_general_ci;
|
||||
INSERT INTO t1 VALUES (0x039C03C903B4);
|
||||
#Check two rows
|
||||
SELECT * FROM t1 WHERE c LIKE _utf16 0x039C0025
|
||||
COLLATE utf16_general_ci ORDER BY c;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 (c varchar(200) CHARACTER SET utf16 COLLATE utf16_unicode_ci NOT NULL, INDEX (c));
|
||||
INSERT INTO t1 VALUES (0x039C03C903B403B11F770308);
|
||||
#Check one row
|
||||
SELECT * FROM t1 WHERE c LIKE _utf16 0x039C0025 COLLATE utf16_unicode_ci;
|
||||
INSERT INTO t1 VALUES (0x039C03C903B4);
|
||||
#Check two rows
|
||||
SELECT * FROM t1 WHERE c LIKE _utf16 0x039C0025
|
||||
COLLATE utf16_unicode_ci ORDER BY c;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 (c varchar(200) CHARACTER SET utf16 COLLATE utf16_unicode_ci NOT NULL, INDEX (c));
|
||||
INSERT INTO t1 VALUES (0x039C03C903B403B11F770308);
|
||||
#Check one row row
|
||||
SELECT * FROM t1 WHERE c LIKE _utf16 0x039C0025 COLLATE utf16_unicode_ci;
|
||||
INSERT INTO t1 VALUES (0x039C03C903B4);
|
||||
#Check two rows
|
||||
SELECT * FROM t1 WHERE c LIKE _utf16 0x039C0025
|
||||
COLLATE utf16_unicode_ci ORDER BY c;
|
||||
DROP TABLE t1;
|
||||
|
||||
|
||||
SET NAMES utf8;
|
||||
SET @test_character_set='utf16';
|
||||
SET @test_collation='utf16_swedish_ci';
|
||||
-- source include/ctype_common.inc
|
||||
|
||||
|
||||
SET collation_connection='utf16_unicode_ci';
|
||||
-- source include/ctype_filesort.inc
|
||||
-- source include/ctype_like_escape.inc
|
||||
|
||||
--echo End of 4.1 tests
|
||||
|
||||
#
|
||||
# Check UPPER/LOWER changing length
|
||||
#
|
||||
# Result shorter than argument
|
||||
CREATE TABLE t1 (id int, a varchar(30) character set utf16);
|
||||
INSERT INTO t1 VALUES (1, 0x01310069), (2, 0x01310131);
|
||||
INSERT INTO t1 VALUES (3, 0x00690069), (4, 0x01300049);
|
||||
INSERT INTO t1 VALUES (5, 0x01300130), (6, 0x00490049);
|
||||
SELECT a, length(a) la, @l:=lower(a) l, length(@l) ll, @u:=upper(a) u, length(@u) lu
|
||||
FROM t1 ORDER BY id;
|
||||
ALTER TABLE t1 MODIFY a VARCHAR(30) character set utf16 collate utf16_turkish_ci;
|
||||
SELECT a, length(a) la, @l:=lower(a) l, length(@l) ll, @u:=upper(a) u, length(@u) lu
|
||||
FROM t1 ORDER BY id;
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Bug #27079 Crash while grouping empty ucs2 strings
|
||||
#
|
||||
CREATE TABLE t1 (
|
||||
c1 text character set utf16 collate utf16_polish_ci NOT NULL
|
||||
) ENGINE=MyISAM;
|
||||
insert into t1 values (''),('a');
|
||||
SELECT COUNT(*), c1 FROM t1 GROUP BY c1;
|
||||
DROP TABLE IF EXISTS t1;
|
||||
|
||||
|
||||
#
|
||||
# Test basic regex functionality
|
||||
#
|
||||
set collation_connection=utf16_unicode_ci;
|
||||
--source include/ctype_regex.inc
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # End of 5.5 tests
|
||||
--echo #
|
784
mysql-test/t/ctype_utf32.test
Normal file
784
mysql-test/t/ctype_utf32.test
Normal file
@ -0,0 +1,784 @@
|
||||
-- source include/have_utf32.inc
|
||||
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
--enable_warnings
|
||||
|
||||
--echo #
|
||||
--echo # Start of 5.5 tests
|
||||
--echo #
|
||||
|
||||
SET NAMES latin1;
|
||||
SET character_set_connection=utf32;
|
||||
select hex('a'), hex('a ');
|
||||
-- source include/endspace.inc
|
||||
|
||||
#
|
||||
# Check that incomplete utf32 characters in HEX notation
|
||||
# are left-padded with zeros
|
||||
#
|
||||
select hex(_utf32 0x44);
|
||||
select hex(_utf32 0x3344);
|
||||
select hex(_utf32 0x103344);
|
||||
|
||||
select hex(_utf32 X'44');
|
||||
select hex(_utf32 X'3344');
|
||||
select hex(_utf32 X'103344');
|
||||
|
||||
|
||||
#
|
||||
# Check that 0x20 is only trimmed when it is
|
||||
# a part of real SPACE character, not just a part
|
||||
# of a multibyte sequence.
|
||||
# Note, CYRILLIC LETTER ER is used as an example, which
|
||||
# is stored as 0x0420 in UCS2, thus contains 0x20 in the
|
||||
# low byte. The second character is THREE-PER-M, U+2004,
|
||||
# which contains 0x20 in the high byte.
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (word VARCHAR(64), word2 CHAR(64)) CHARACTER SET utf32;
|
||||
INSERT INTO t1 VALUES (_koi8r 0xF2, _koi8r 0xF2), (X'2004',X'2004');
|
||||
SELECT hex(word) FROM t1 ORDER BY word;
|
||||
SELECT hex(word2) FROM t1 ORDER BY word2;
|
||||
DELETE FROM t1;
|
||||
|
||||
#
|
||||
# Check that real spaces are correctly trimmed.
|
||||
#
|
||||
|
||||
INSERT INTO t1 VALUES
|
||||
(X'000004200000002000000020',X'000004200000002000000020'),
|
||||
(X'000020040000002000000020',X'000020040000002000000020');
|
||||
SELECT hex(word) FROM t1 ORDER BY word;
|
||||
SELECT hex(word2) FROM t1 ORDER BY word2;
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Check LPAD/RPAD
|
||||
#
|
||||
SELECT hex(LPAD(_utf32 X'0420',10,_utf32 X'0421'));
|
||||
SELECT hex(LPAD(_utf32 X'0420',10,_utf32 X'0000042100000422'));
|
||||
SELECT hex(LPAD(_utf32 X'0420',10,_utf32 X'000004210000042200000423'));
|
||||
SELECT hex(LPAD(_utf32 X'000004200000042100000422000004230000042400000425000004260000042700000428000004290000042A0000042B',10,_utf32 X'000004210000042200000423'));
|
||||
|
||||
SELECT hex(RPAD(_utf32 X'0420',10,_utf32 X'0421'));
|
||||
SELECT hex(RPAD(_utf32 X'0420',10,_utf32 X'0000042100000422'));
|
||||
SELECT hex(RPAD(_utf32 X'0420',10,_utf32 X'000004210000042200000423'));
|
||||
SELECT hex(RPAD(_utf32 X'000004200000042100000422000004230000042400000425000004260000042700000428000004290000042A0000042B',10,_utf32 X'000004210000042200000423'));
|
||||
|
||||
CREATE TABLE t1 SELECT
|
||||
LPAD(_utf32 X'0420',10,_utf32 X'0421') l,
|
||||
RPAD(_utf32 X'0420',10,_utf32 X'0421') r;
|
||||
SHOW CREATE TABLE t1;
|
||||
select hex(l), hex(r) from t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
create table t1 (f1 char(30));
|
||||
insert into t1 values ("103000"), ("22720000"), ("3401200"), ("78000");
|
||||
select lpad(f1, 12, "-o-/") from t1;
|
||||
drop table t1;
|
||||
|
||||
######################################################
|
||||
#
|
||||
# Test of like
|
||||
#
|
||||
|
||||
SET NAMES latin1;
|
||||
SET character_set_connection=utf32;
|
||||
--source include/ctype_like.inc
|
||||
|
||||
SET NAMES utf8;
|
||||
SET character_set_connection=utf32;
|
||||
CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf32);
|
||||
INSERT INTO t1 VALUES ('фыва'),('Фыва'),('фЫва'),('фыВа'),('фывА'),('ФЫВА');
|
||||
INSERT INTO t1 VALUES ('фывапролдж'),('Фывапролдж'),('фЫвапролдж'),('фыВапролдж');
|
||||
INSERT INTO t1 VALUES ('фывАпролдж'),('фываПролдж'),('фывапРолдж'),('фывапрОлдж');
|
||||
INSERT INTO t1 VALUES ('фывапроЛдж'),('фывапролДж'),('фывапролдЖ'),('ФЫВАПРОЛДЖ');
|
||||
SELECT * FROM t1 WHERE a LIKE '%фЫва%' ORDER BY BINARY a;
|
||||
SELECT * FROM t1 WHERE a LIKE '%фЫв%' ORDER BY BINARY a;
|
||||
SELECT * FROM t1 WHERE a LIKE 'фЫва%' ORDER BY BINARY a;
|
||||
SELECT * FROM t1 WHERE a LIKE 'фЫва%' COLLATE utf32_bin ORDER BY BINARY a;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 (word varchar(64) NOT NULL, PRIMARY KEY (word))
|
||||
ENGINE=MyISAM CHARACTER SET utf32;
|
||||
INSERT INTO t1 (word) VALUES ("cat");
|
||||
SELECT * FROM t1 WHERE word LIKE "c%";
|
||||
SELECT * FROM t1 WHERE word LIKE "ca_";
|
||||
SELECT * FROM t1 WHERE word LIKE "cat";
|
||||
SELECT * FROM t1 WHERE word LIKE _utf32 x'0000006300000025'; # "c%"
|
||||
SELECT * FROM t1 WHERE word LIKE _utf32 x'00000063000000610000005F'; # "ca_"
|
||||
DROP TABLE t1;
|
||||
|
||||
|
||||
#
|
||||
# Check that INSERT() works fine.
|
||||
# This invokes charpos() function.
|
||||
select insert(_utf32 0x000000610000006200000063,10,2,_utf32 0x000000640000006500000066);
|
||||
select insert(_utf32 0x000000610000006200000063,1,2,_utf32 0x000000640000006500000066);
|
||||
|
||||
#######################################################
|
||||
|
||||
#
|
||||
# Bug 1264
|
||||
#
|
||||
# Description:
|
||||
#
|
||||
# When using a ucs2 table in MySQL,
|
||||
# either with ucs2_general_ci or ucs2_bin collation,
|
||||
# words are returned in an incorrect order when using ORDER BY
|
||||
# on an _indexed_ CHAR or VARCHAR column. They are sorted with
|
||||
# the longest word *first* instead of last. I.E. The word "aardvark"
|
||||
# is in the results before the word "a".
|
||||
#
|
||||
# If there is no index for the column, the problem does not occur.
|
||||
#
|
||||
# Interestingly, if there is no second column, the words are returned
|
||||
# in the correct order.
|
||||
#
|
||||
# According to EXPLAIN, it looks like when the output includes columns that
|
||||
# are not part of the index sorted on, it does a filesort, which fails.
|
||||
# Using a straight index yields correct results.
|
||||
|
||||
SET NAMES latin1;
|
||||
|
||||
#
|
||||
# Two fields, index
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (
|
||||
word VARCHAR(64),
|
||||
bar INT(11) default 0,
|
||||
PRIMARY KEY (word))
|
||||
ENGINE=MyISAM
|
||||
CHARSET utf32
|
||||
COLLATE utf32_general_ci ;
|
||||
|
||||
INSERT INTO t1 (word) VALUES ("aar");
|
||||
INSERT INTO t1 (word) VALUES ("a");
|
||||
INSERT INTO t1 (word) VALUES ("aardvar");
|
||||
INSERT INTO t1 (word) VALUES ("aardvark");
|
||||
INSERT INTO t1 (word) VALUES ("aardvara");
|
||||
INSERT INTO t1 (word) VALUES ("aardvarz");
|
||||
EXPLAIN SELECT * FROM t1 ORDER BY word;
|
||||
SELECT * FROM t1 ORDER BY word;
|
||||
EXPLAIN SELECT word FROM t1 ORDER BY word;
|
||||
SELECT word FROM t1 ORDER by word;
|
||||
DROP TABLE t1;
|
||||
|
||||
|
||||
#
|
||||
# One field, index
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (
|
||||
word VARCHAR(64) ,
|
||||
PRIMARY KEY (word))
|
||||
ENGINE=MyISAM
|
||||
CHARSET utf32
|
||||
COLLATE utf32_general_ci;
|
||||
|
||||
INSERT INTO t1 (word) VALUES ("aar");
|
||||
INSERT INTO t1 (word) VALUES ("a");
|
||||
INSERT INTO t1 (word) VALUES ("aardvar");
|
||||
INSERT INTO t1 (word) VALUES ("aardvark");
|
||||
INSERT INTO t1 (word) VALUES ("aardvara");
|
||||
INSERT INTO t1 (word) VALUES ("aardvarz");
|
||||
EXPLAIN SELECT * FROM t1 ORDER BY WORD;
|
||||
SELECT * FROM t1 ORDER BY word;
|
||||
DROP TABLE t1;
|
||||
|
||||
|
||||
#
|
||||
# Two fields, no index
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (
|
||||
word TEXT,
|
||||
bar INT(11) AUTO_INCREMENT,
|
||||
PRIMARY KEY (bar))
|
||||
ENGINE=MyISAM
|
||||
CHARSET utf32
|
||||
COLLATE utf32_general_ci ;
|
||||
INSERT INTO t1 (word) VALUES ("aar");
|
||||
INSERT INTO t1 (word) VALUES ("a" );
|
||||
INSERT INTO t1 (word) VALUES ("aardvar");
|
||||
INSERT INTO t1 (word) VALUES ("aardvark");
|
||||
INSERT INTO t1 (word) VALUES ("aardvara");
|
||||
INSERT INTO t1 (word) VALUES ("aardvarz");
|
||||
EXPLAIN SELECT * FROM t1 ORDER BY word;
|
||||
SELECT * FROM t1 ORDER BY word;
|
||||
EXPLAIN SELECT word FROM t1 ORDER BY word;
|
||||
SELECT word FROM t1 ORDER BY word;
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# END OF Bug 1264 test
|
||||
#
|
||||
########################################################
|
||||
|
||||
|
||||
#
|
||||
# Check alignment for from-binary-conversion with CAST and CONVERT
|
||||
#
|
||||
SELECT hex(cast(0xAA as char character set utf32));
|
||||
SELECT hex(convert(0xAA using utf32));
|
||||
|
||||
#
|
||||
# Check alignment for string types
|
||||
#
|
||||
CREATE TABLE t1 (a char(10) character set utf32);
|
||||
INSERT INTO t1 VALUES (0x1),(0x11),(0x111),(0x1111),(0x11111);
|
||||
SELECT HEX(a) FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 (a varchar(10) character set utf32);
|
||||
INSERT INTO t1 VALUES (0x1),(0x11),(0x111),(0x1111),(0x11111);
|
||||
SELECT HEX(a) FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 (a text character set utf32);
|
||||
INSERT INTO t1 VALUES (0x1),(0x11),(0x111),(0x1111),(0x11111);
|
||||
SELECT HEX(a) FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 (a mediumtext character set utf32);
|
||||
INSERT INTO t1 VALUES (0x1),(0x11),(0x111),(0x1111),(0x11111);
|
||||
SELECT HEX(a) FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 (a longtext character set utf32);
|
||||
INSERT INTO t1 VALUES (0x1),(0x11),(0x111),(0x1111),(0x11111);
|
||||
SELECT HEX(a) FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
##
|
||||
## Bug #5024 Server crashes with queries on fields
|
||||
## with certain charset/collation settings
|
||||
##
|
||||
#
|
||||
#create table t1 (s1 char character set `ucs2` collate `ucs2_czech_ci`);
|
||||
#insert into t1 values ('0'),('1'),('2'),('a'),('b'),('c');
|
||||
#select s1 from t1 where s1 > 'a' order by s1;
|
||||
#drop table t1;
|
||||
|
||||
#
|
||||
# Bug #5081 : UCS2 fields are filled with '0x2020'
|
||||
# after extending field length
|
||||
#
|
||||
create table t1(a char(1)) default charset utf32;
|
||||
insert into t1 values ('a'),('b'),('c');
|
||||
alter table t1 modify a char(5);
|
||||
select a, hex(a) from t1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Check prepare statement from an UTF32 string
|
||||
#
|
||||
set @ivar= 1234;
|
||||
set @str1 = 'select ?';
|
||||
set @str2 = convert(@str1 using utf32);
|
||||
prepare stmt1 from @str2;
|
||||
execute stmt1 using @ivar;
|
||||
|
||||
#
|
||||
# Check that utf32 works with ENUM and SET type
|
||||
#
|
||||
set names utf8;
|
||||
create table t1 (a enum('x','y','z') character set utf32);
|
||||
show create table t1;
|
||||
insert into t1 values ('x');
|
||||
insert into t1 values ('y');
|
||||
insert into t1 values ('z');
|
||||
select a, hex(a) from t1 order by a;
|
||||
alter table t1 change a a enum('x','y','z','d','e','ä','ö','ü') character set utf32;
|
||||
show create table t1;
|
||||
insert into t1 values ('D');
|
||||
insert into t1 values ('E ');
|
||||
insert into t1 values ('ä');
|
||||
insert into t1 values ('ö');
|
||||
insert into t1 values ('ü');
|
||||
select a, hex(a) from t1 order by a;
|
||||
drop table t1;
|
||||
|
||||
create table t1 (a set ('x','y','z','ä','ö','ü') character set utf32);
|
||||
show create table t1;
|
||||
insert into t1 values ('x');
|
||||
insert into t1 values ('y');
|
||||
insert into t1 values ('z');
|
||||
insert into t1 values ('x,y');
|
||||
insert into t1 values ('x,y,z,ä,ö,ü');
|
||||
select a, hex(a) from t1 order by a;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug#7302 UCS2 data in ENUM fields get truncated when new column is added
|
||||
#
|
||||
create table t1(a enum('a','b','c')) default character set utf32;
|
||||
insert into t1 values('a'),('b'),('c');
|
||||
alter table t1 add b char(1);
|
||||
show warnings;
|
||||
select * from t1 order by a;
|
||||
drop table t1;
|
||||
|
||||
SET NAMES latin1;
|
||||
SET collation_connection='utf32_general_ci';
|
||||
-- source include/ctype_filesort.inc
|
||||
-- source include/ctype_like_escape.inc
|
||||
SET NAMES latin1;
|
||||
SET collation_connection='utf32_bin';
|
||||
-- source include/ctype_filesort.inc
|
||||
-- source include/ctype_like_escape.inc
|
||||
|
||||
#
|
||||
# Bug#10344 Some string functions fail for UCS2
|
||||
#
|
||||
select hex(substr(_utf32 0x000000e4000000e500000068,1));
|
||||
select hex(substr(_utf32 0x000000e4000000e500000068,2));
|
||||
select hex(substr(_utf32 0x000000e4000000e500000068,3));
|
||||
select hex(substr(_utf32 0x000000e4000000e500000068,-1));
|
||||
select hex(substr(_utf32 0x000000e4000000e500000068,-2));
|
||||
select hex(substr(_utf32 0x000000e4000000e500000068,-3));
|
||||
|
||||
#SET NAMES latin1;
|
||||
#
|
||||
# Bug#8235
|
||||
#
|
||||
# This bug also helped to find another problem that
|
||||
# INSERT of a UCS2 string containing a negative number
|
||||
# into a unsigned int column didn't produce warnings.
|
||||
# This test covers both problems.
|
||||
#
|
||||
#SET collation_connection='ucs2_swedish_ci';
|
||||
#CREATE TABLE t1 (Field1 int(10) default '0');
|
||||
## no warnings, negative numbers are allowed
|
||||
#INSERT INTO t1 VALUES ('-1');
|
||||
#SELECT * FROM t1;
|
||||
#DROP TABLE t1;
|
||||
#CREATE TABLE t1 (Field1 int(10) unsigned default '0');
|
||||
## this should generate a "Data truncated" warning
|
||||
#INSERT INTO t1 VALUES ('-1');
|
||||
#DROP TABLE t1;
|
||||
#SET NAMES latin1;
|
||||
|
||||
#
|
||||
##
|
||||
## Bug#18691 Converting number to UNICODE string returns invalid result
|
||||
##
|
||||
#SELECT CONVERT(103, CHAR(50) UNICODE);
|
||||
#SELECT CONVERT(103.0, CHAR(50) UNICODE);
|
||||
#SELECT CONVERT(-103, CHAR(50) UNICODE);
|
||||
#SELECT CONVERT(-103.0, CHAR(50) UNICODE);
|
||||
|
||||
#
|
||||
# Bug#9557 MyISAM utf8 table crash
|
||||
#
|
||||
CREATE TABLE t1 (
|
||||
a varchar(250) NOT NULL default '',
|
||||
KEY a (a)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf32 COLLATE utf32_general_ci;
|
||||
insert into t1 values (0x803d);
|
||||
insert into t1 values (0x005b);
|
||||
select hex(a) from t1;
|
||||
drop table t1;
|
||||
|
||||
##
|
||||
## Bug #14583 Bug on query using a LIKE on indexed field with ucs2_bin collation
|
||||
##
|
||||
#--disable_warnings
|
||||
#create table t1(f1 varchar(5) CHARACTER SET utf32 COLLATE utf32_bin NOT NULL) engine=InnoDB;
|
||||
#--enable_warnings
|
||||
#insert into t1 values('a');
|
||||
#create index t1f1 on t1(f1);
|
||||
#select f1 from t1 where f1 like 'a%';
|
||||
#drop table t1;
|
||||
|
||||
#
|
||||
# Bug#9442 Set parameter make query fail if column character set is UCS2
|
||||
#
|
||||
create table t1 (utext varchar(20) character set utf32);
|
||||
insert into t1 values ("lily");
|
||||
insert into t1 values ("river");
|
||||
prepare stmt from 'select utext from t1 where utext like ?';
|
||||
set @param1='%%';
|
||||
execute stmt using @param1;
|
||||
execute stmt using @param1;
|
||||
select utext from t1 where utext like '%%';
|
||||
drop table t1;
|
||||
deallocate prepare stmt;
|
||||
|
||||
#
|
||||
# Bug#22052 Trailing spaces are not removed from UNICODE fields in an index
|
||||
#
|
||||
create table t1 (
|
||||
a char(10) character set utf32 not null,
|
||||
index a (a)
|
||||
) engine=myisam;
|
||||
insert into t1 values (repeat(0x0000201f, 10));
|
||||
insert into t1 values (repeat(0x00002020, 10));
|
||||
insert into t1 values (repeat(0x00002021, 10));
|
||||
# make sure "index read" is used
|
||||
explain select hex(a) from t1 order by a;
|
||||
select hex(a) from t1 order by a;
|
||||
alter table t1 drop index a;
|
||||
select hex(a) from t1 order by a;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug #20076: server crashes for a query with GROUP BY if MIN/MAX aggregation
|
||||
# over a 'ucs2' field uses a temporary table
|
||||
#
|
||||
#CREATE TABLE t1 (id int, s char(5) CHARACTER SET ucs2 COLLATE ucs2_unicode_ci);
|
||||
#INSERT INTO t1 VALUES (1, 'ZZZZZ'), (1, 'ZZZ'), (2, 'ZZZ'), (2, 'ZZZZZ');
|
||||
#SELECT id, MIN(s) FROM t1 GROUP BY id;
|
||||
#DROP TABLE t1;
|
||||
|
||||
##
|
||||
## Bug #20536: md5() with GROUP BY and UCS2 return different results on myisam/innodb
|
||||
##
|
||||
#
|
||||
#--disable_warnings
|
||||
#drop table if exists bug20536;
|
||||
#--enable_warnings
|
||||
#
|
||||
#set names latin1;
|
||||
#create table bug20536 (id bigint not null auto_increment primary key, name
|
||||
#varchar(255) character set ucs2 not null);
|
||||
#insert into `bug20536` (`id`,`name`) values (1, _latin1 x'7465737431'), (2, "'test\\_2'");
|
||||
#select md5(name) from bug20536;
|
||||
#select sha1(name) from bug20536;
|
||||
#select make_set(3, name, upper(name)) from bug20536;
|
||||
#select export_set(5, name, upper(name)) from bug20536;
|
||||
#select export_set(5, name, upper(name), ",", 5) from bug20536;
|
||||
|
||||
#
|
||||
# Bug #20108: corrupted default enum value for a ucs2 field
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (
|
||||
status enum('active','passive') character set utf32 collate utf32_general_ci
|
||||
NOT NULL default 'passive'
|
||||
);
|
||||
SHOW CREATE TABLE t1;
|
||||
ALTER TABLE t1 ADD a int NOT NULL AFTER status;
|
||||
SHOW CREATE TABLE t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
#CREATE TABLE t2 (
|
||||
# status enum('active','passive') collate ucs2_turkish_ci
|
||||
# NOT NULL default 'passive'
|
||||
#);
|
||||
#SHOW CREATE TABLE t2;
|
||||
#ALTER TABLE t2 ADD a int NOT NULL AFTER status;
|
||||
#DROP TABLE t2;
|
||||
|
||||
|
||||
## Some broken functions: add these tests just to document current behavior.
|
||||
#
|
||||
## PASSWORD and OLD_PASSWORD don't work with UCS2 strings, but to fix it would
|
||||
## not be backwards compatible in all cases, so it's best to leave it alone
|
||||
#select password(name) from bug20536;
|
||||
#select old_password(name) from bug20536;
|
||||
#
|
||||
## Disable test case as encrypt relies on 'crypt' function.
|
||||
## "decrypt" is noramlly tested in func_crypt.test which have a
|
||||
## "have_crypt.inc" test
|
||||
#--disable_parsing
|
||||
## ENCRYPT relies on OS function crypt() which takes a NUL-terminated string; it
|
||||
## doesn't return good results for strings with embedded 0 bytes. It won't be
|
||||
## fixed unless we choose to re-implement the crypt() function ourselves to take
|
||||
## an extra size_t string_length argument.
|
||||
#select encrypt(name, 'SALT') from bug20536;
|
||||
#--enable_parsing
|
||||
#
|
||||
## QUOTE doesn't work with UCS2 data. It would require a total rewrite
|
||||
## of Item_func_quote::val_str(), which isn't worthwhile until UCS2 is
|
||||
## supported fully as a client character set.
|
||||
#select quote(name) from bug20536;
|
||||
#
|
||||
#drop table bug20536;
|
||||
#
|
||||
--echo End of 4.1 tests
|
||||
|
||||
|
||||
#
|
||||
# Conversion from an UTF32 string to a decimal column
|
||||
#
|
||||
CREATE TABLE t1 (a varchar(64) character set utf32, b decimal(10,3));
|
||||
INSERT INTO t1 VALUES ("1.1", 0), ("2.1", 0);
|
||||
update t1 set b=a;
|
||||
SELECT *, hex(a) FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Bug#9442 Set parameter make query fail if column character set is UCS2
|
||||
#
|
||||
create table t1 (utext varchar(20) character set utf32);
|
||||
insert into t1 values ("lily");
|
||||
insert into t1 values ("river");
|
||||
prepare stmt from 'select utext from t1 where utext like ?';
|
||||
set @param1='%%';
|
||||
execute stmt using @param1;
|
||||
execute stmt using @param1;
|
||||
select utext from t1 where utext like '%%';
|
||||
drop table t1;
|
||||
deallocate prepare stmt;
|
||||
|
||||
#
|
||||
# Bug#22638 SOUNDEX broken for international characters
|
||||
#
|
||||
set names latin1;
|
||||
set character_set_connection=utf32;
|
||||
select soundex(''),soundex('he'),soundex('hello all folks'),soundex('#3556 in bugdb');
|
||||
select hex(soundex('')),hex(soundex('he')),hex(soundex('hello all folks')),hex(soundex('#3556 in bugdb'));
|
||||
select 'mood' sounds like 'mud';
|
||||
# Cyrillic A, BE, VE
|
||||
select hex(soundex(_utf32 0x000004100000041100000412));
|
||||
# Make sure that "U+00BF INVERTED QUESTION MARK" is not considered as letter
|
||||
select hex(soundex(_utf32 0x000000BF000000C0));
|
||||
set names latin1;
|
||||
|
||||
#
|
||||
# Bug #14290: character_maximum_length for text fields
|
||||
#
|
||||
create table t1(a blob, b text charset utf32);
|
||||
select data_type, character_octet_length, character_maximum_length
|
||||
from information_schema.columns where table_name='t1';
|
||||
drop table t1;
|
||||
|
||||
|
||||
set names latin1;
|
||||
set collation_connection=utf32_general_ci;
|
||||
#
|
||||
# Testing cs->coll->instr()
|
||||
#
|
||||
select position('bb' in 'abba');
|
||||
|
||||
#
|
||||
# Testing cs->coll->hash_sort()
|
||||
#
|
||||
create table t1 (a varchar(10) character set utf32) engine=heap;
|
||||
insert into t1 values ('a'),('A'),('b'),('B');
|
||||
select * from t1 where a='a' order by binary a;
|
||||
select hex(min(binary a)),count(*) from t1 group by a;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Testing cs->cset->numchars()
|
||||
#
|
||||
select char_length('abcd'), octet_length('abcd');
|
||||
|
||||
#
|
||||
# Testing cs->cset->charpos()
|
||||
#
|
||||
select left('abcd',2);
|
||||
|
||||
#
|
||||
# Testing cs->cset->well_formed_length()
|
||||
#
|
||||
create table t1 (a varchar(10) character set utf32);
|
||||
insert into t1 values (_utf32 0x0010FFFF);
|
||||
--error ER_INVALID_CHARACTER_STRING
|
||||
insert into t1 values (_utf32 0x00110000);
|
||||
--error ER_INVALID_CHARACTER_STRING
|
||||
insert into t1 values (_utf32 0x00110101);
|
||||
--error ER_INVALID_CHARACTER_STRING
|
||||
insert into t1 values (_utf32 0x01000101);
|
||||
--error ER_INVALID_CHARACTER_STRING
|
||||
insert into t1 values (_utf32 0x11000101);
|
||||
select hex(a) from t1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug#32914 Character sets: illegal characters in utf8 and utf32 columns
|
||||
#
|
||||
create table t1 (utf32 varchar(2) character set utf32);
|
||||
--echo Wrong character with pad
|
||||
insert into t1 values (0x110000);
|
||||
--echo Wrong chsaracter without pad
|
||||
insert into t1 values (0x00110000);
|
||||
--echo Wrong character with pad followed by another wrong character
|
||||
insert into t1 values (0x11000000110000);
|
||||
--echo Good character with pad followed by bad character
|
||||
insert into t1 values (0x10000000110000);
|
||||
--echo Good character without pad followed by bad character
|
||||
insert into t1 values (0x0010000000110000);
|
||||
--echo Wrong character with the second byte higher than 0x10
|
||||
insert into t1 values (0x00800037);
|
||||
--echo Wrong character with pad with the second byte higher than 0x10
|
||||
insert into t1 values (0x00800037);
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug#32394 Character sets: crash if comparison with 0xfffd
|
||||
#
|
||||
select _utf32'a' collate utf32_general_ci = 0xfffd;
|
||||
select hex(concat(_utf32 0x0410 collate utf32_general_ci, 0x61));
|
||||
create table t1 (s1 varchar(5) character set utf32);
|
||||
insert into t1 values (0xfffd);
|
||||
select case when s1 = 0xfffd then 1 else 0 end from t1;
|
||||
select hex(s1) from t1 where s1 = 0xfffd;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Testing cs->cset->lengthsp()
|
||||
#
|
||||
create table t1 (a char(10)) character set utf32;
|
||||
insert into t1 values ('a ');
|
||||
select hex(a) from t1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Testing cs->cset->caseup() and cs->cset->casedn()
|
||||
#
|
||||
select upper('abcd'), lower('ABCD');
|
||||
|
||||
#
|
||||
# TODO: str_to_datetime() is broken and doesn't work with ucs2 and utf32
|
||||
# Testing cs->cset->snprintf()
|
||||
#
|
||||
#create table t1 (a date);
|
||||
#insert into t1 values ('2007-09-16');
|
||||
#select * from t1;
|
||||
#drop table t1;
|
||||
|
||||
#
|
||||
# Testing cs->cset->l10tostr
|
||||
# !!! Not used in the code
|
||||
|
||||
#
|
||||
# Testing cs->cset->ll10tostr
|
||||
#
|
||||
create table t1 (a varchar(10) character set utf32);
|
||||
insert into t1 values (123456);
|
||||
select a, hex(a) from t1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Testing cs->cset->fill
|
||||
# SOUNDEX fills strings with DIGIT ZERO up to four characters
|
||||
select hex(soundex('a'));
|
||||
|
||||
#
|
||||
# Testing cs->cset->strntol
|
||||
# !!! Not used in the code
|
||||
|
||||
#
|
||||
# Testing cs->cset->strntoul
|
||||
#
|
||||
create table t1 (a enum ('a','b','c')) character set utf32;
|
||||
insert into t1 values ('1');
|
||||
select * from t1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Testing cs->cset->strntoll and cs->cset->strntoull
|
||||
#
|
||||
set names latin1;
|
||||
select hex(conv(convert('123' using utf32), -10, 16));
|
||||
select hex(conv(convert('123' using utf32), 10, 16));
|
||||
|
||||
#
|
||||
# Testing cs->cset->strntod
|
||||
#
|
||||
set names latin1;
|
||||
set character_set_connection=utf32;
|
||||
select 1.1 + '1.2';
|
||||
select 1.1 + '1.2xxx';
|
||||
|
||||
# Testing strntoll10_utf32
|
||||
# Testing cs->cset->strtoll10
|
||||
select left('aaa','1');
|
||||
|
||||
#
|
||||
# Testing cs->cset->strntoull10rnd
|
||||
#
|
||||
create table t1 (a int);
|
||||
insert into t1 values ('-1234.1e2');
|
||||
insert into t1 values ('-1234.1e2xxxx');
|
||||
insert into t1 values ('-1234.1e2 ');
|
||||
select * from t1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Testing cs->cset->scan
|
||||
#
|
||||
create table t1 (a int);
|
||||
insert into t1 values ('1 ');
|
||||
insert into t1 values ('1 x');
|
||||
select * from t1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Testing auto-conversion to TEXT
|
||||
#
|
||||
create table t1 (a varchar(17000) character set utf32);
|
||||
show create table t1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Testing that maximim possible key length is 1332 bytes
|
||||
#
|
||||
create table t1 (a varchar(250) character set utf32 primary key);
|
||||
show create table t1;
|
||||
drop table t1;
|
||||
--error ER_TOO_LONG_KEY
|
||||
create table t1 (a varchar(334) character set utf32 primary key);
|
||||
|
||||
#
|
||||
# Testing mi_check with long key values
|
||||
#
|
||||
create table t1 (a varchar(333) character set utf32, key(a));
|
||||
insert into t1 values (repeat('a',333)), (repeat('b',333));
|
||||
flush tables;
|
||||
check table t1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Test how character set works with date/time
|
||||
#
|
||||
SET collation_connection=utf32_general_ci;
|
||||
--source include/ctype_datetime.inc
|
||||
SET NAMES latin1;
|
||||
|
||||
#
|
||||
# Test basic regex functionality
|
||||
#
|
||||
set collation_connection=utf32_general_ci;
|
||||
--source include/ctype_regex.inc
|
||||
set names latin1;
|
||||
|
||||
|
||||
# TODO: add tests for all engines
|
||||
|
||||
#
|
||||
# Bug #36418 Character sets: crash if char(256 using utf32)
|
||||
#
|
||||
select hex(char(0x01 using utf32));
|
||||
select hex(char(0x0102 using utf32));
|
||||
select hex(char(0x010203 using utf32));
|
||||
select hex(char(0x01020304 using utf32));
|
||||
create table t1 (s1 varchar(1) character set utf32, s2 text character set utf32);
|
||||
create index i on t1 (s1);
|
||||
insert into t1 values (char(256 using utf32), char(256 using utf32));
|
||||
select hex(s1), hex(s2) from t1;
|
||||
drop table t1;
|
||||
|
||||
|
||||
#
|
||||
# Bug#33073 Character sets: ordering fails with utf32
|
||||
#
|
||||
SET collation_connection=utf32_general_ci;
|
||||
CREATE TABLE t1 AS SELECT repeat('a',2) as s1 LIMIT 0;
|
||||
SHOW CREATE TABLE t1;
|
||||
INSERT INTO t1 VALUES ('ab'),('AE'),('ab'),('AE');
|
||||
SELECT * FROM t1 ORDER BY s1;
|
||||
SET max_sort_length=4;
|
||||
SELECT * FROM t1 ORDER BY s1;
|
||||
DROP TABLE t1;
|
||||
SET max_sort_length=DEFAULT;
|
||||
SET NAMES latin1;
|
||||
|
||||
--echo #
|
||||
--echo # End of 5.5 tests
|
||||
--echo #
|
291
mysql-test/t/ctype_utf32_uca.test
Normal file
291
mysql-test/t/ctype_utf32_uca.test
Normal file
@ -0,0 +1,291 @@
|
||||
-- source include/have_ucs2.inc
|
||||
-- source include/have_utf32.inc
|
||||
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
--enable_warnings
|
||||
|
||||
--echo #
|
||||
--echo # Start of 5.5 tests
|
||||
--echo #
|
||||
|
||||
set names utf8;
|
||||
set collation_connection=utf32_unicode_ci;
|
||||
select hex('a'), hex('a ');
|
||||
-- source include/endspace.inc
|
||||
|
||||
#
|
||||
# Bug #6787 LIKE not working properly with _ and utf8 data
|
||||
#
|
||||
select 'c' like '\_' as want0;
|
||||
|
||||
#
|
||||
# Bug #5679 utf8_unicode_ci LIKE--trailing % doesn't equal zero characters
|
||||
#
|
||||
CREATE TABLE t (
|
||||
c char(20) NOT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARACTER SET utf32 COLLATE=utf32_unicode_ci;
|
||||
INSERT INTO t VALUES ('a'),('ab'),('aba');
|
||||
ALTER TABLE t ADD INDEX (c);
|
||||
SELECT c FROM t WHERE c LIKE 'a%';
|
||||
DROP TABLE t;
|
||||
|
||||
|
||||
create table t1 (c1 char(10) character set utf32 collate utf32_bin);
|
||||
|
||||
#
|
||||
# Basic Latin
|
||||
#
|
||||
insert into t1 values ('A'),('a');
|
||||
insert into t1 values ('B'),('b');
|
||||
insert into t1 values ('C'),('c');
|
||||
insert into t1 values ('D'),('d');
|
||||
insert into t1 values ('E'),('e');
|
||||
insert into t1 values ('F'),('f');
|
||||
insert into t1 values ('G'),('g');
|
||||
insert into t1 values ('H'),('h');
|
||||
insert into t1 values ('I'),('i');
|
||||
insert into t1 values ('J'),('j');
|
||||
insert into t1 values ('K'),('k');
|
||||
insert into t1 values ('L'),('l');
|
||||
insert into t1 values ('M'),('m');
|
||||
insert into t1 values ('N'),('n');
|
||||
insert into t1 values ('O'),('o');
|
||||
insert into t1 values ('P'),('p');
|
||||
insert into t1 values ('Q'),('q');
|
||||
insert into t1 values ('R'),('r');
|
||||
insert into t1 values ('S'),('s');
|
||||
insert into t1 values ('T'),('t');
|
||||
insert into t1 values ('U'),('u');
|
||||
insert into t1 values ('V'),('v');
|
||||
insert into t1 values ('W'),('w');
|
||||
insert into t1 values ('X'),('x');
|
||||
insert into t1 values ('Y'),('y');
|
||||
insert into t1 values ('Z'),('z');
|
||||
|
||||
#
|
||||
# Latin1 suppliment
|
||||
#
|
||||
insert into t1 values (_ucs2 0x00e0),(_ucs2 0x00c0);
|
||||
insert into t1 values (_ucs2 0x00e1),(_ucs2 0x00c1);
|
||||
insert into t1 values (_ucs2 0x00e2),(_ucs2 0x00c2);
|
||||
insert into t1 values (_ucs2 0x00e3),(_ucs2 0x00c3);
|
||||
insert into t1 values (_ucs2 0x00e4),(_ucs2 0x00c4);
|
||||
insert into t1 values (_ucs2 0x00e5),(_ucs2 0x00c5);
|
||||
insert into t1 values (_ucs2 0x00e6),(_ucs2 0x00c6);
|
||||
insert into t1 values (_ucs2 0x00e7),(_ucs2 0x00c7);
|
||||
insert into t1 values (_ucs2 0x00e8),(_ucs2 0x00c8);
|
||||
insert into t1 values (_ucs2 0x00e9),(_ucs2 0x00c9);
|
||||
insert into t1 values (_ucs2 0x00ea),(_ucs2 0x00ca);
|
||||
insert into t1 values (_ucs2 0x00eb),(_ucs2 0x00cb);
|
||||
insert into t1 values (_ucs2 0x00ec),(_ucs2 0x00cc);
|
||||
insert into t1 values (_ucs2 0x00ed),(_ucs2 0x00cd);
|
||||
insert into t1 values (_ucs2 0x00ee),(_ucs2 0x00ce);
|
||||
insert into t1 values (_ucs2 0x00ef),(_ucs2 0x00cf);
|
||||
|
||||
insert into t1 values (_ucs2 0x00f0),(_ucs2 0x00d0);
|
||||
insert into t1 values (_ucs2 0x00f1),(_ucs2 0x00d1);
|
||||
insert into t1 values (_ucs2 0x00f2),(_ucs2 0x00d2);
|
||||
insert into t1 values (_ucs2 0x00f3),(_ucs2 0x00d3);
|
||||
insert into t1 values (_ucs2 0x00f4),(_ucs2 0x00d4);
|
||||
insert into t1 values (_ucs2 0x00f5),(_ucs2 0x00d5);
|
||||
insert into t1 values (_ucs2 0x00f6),(_ucs2 0x00d6);
|
||||
insert into t1 values (_ucs2 0x00f7),(_ucs2 0x00d7);
|
||||
insert into t1 values (_ucs2 0x00f8),(_ucs2 0x00d8);
|
||||
insert into t1 values (_ucs2 0x00f9),(_ucs2 0x00d9);
|
||||
insert into t1 values (_ucs2 0x00fa),(_ucs2 0x00da);
|
||||
insert into t1 values (_ucs2 0x00fb),(_ucs2 0x00db);
|
||||
insert into t1 values (_ucs2 0x00fc),(_ucs2 0x00dc);
|
||||
insert into t1 values (_ucs2 0x00fd),(_ucs2 0x00dd);
|
||||
insert into t1 values (_ucs2 0x00fe),(_ucs2 0x00de);
|
||||
insert into t1 values (_ucs2 0x00ff),(_ucs2 0x00df);
|
||||
|
||||
#
|
||||
# Latin extended-A, 0100-017F
|
||||
#
|
||||
insert into t1 values (_ucs2 0x0100),(_ucs2 0x0101),(_ucs2 0x0102),(_ucs2 0x0103);
|
||||
insert into t1 values (_ucs2 0x0104),(_ucs2 0x0105),(_ucs2 0x0106),(_ucs2 0x0107);
|
||||
insert into t1 values (_ucs2 0x0108),(_ucs2 0x0109),(_ucs2 0x010a),(_ucs2 0x010b);
|
||||
insert into t1 values (_ucs2 0x010c),(_ucs2 0x010d),(_ucs2 0x010e),(_ucs2 0x010f);
|
||||
insert into t1 values (_ucs2 0x0110),(_ucs2 0x0111),(_ucs2 0x0112),(_ucs2 0x0113);
|
||||
insert into t1 values (_ucs2 0x0114),(_ucs2 0x0115),(_ucs2 0x0116),(_ucs2 0x0117);
|
||||
insert into t1 values (_ucs2 0x0118),(_ucs2 0x0119),(_ucs2 0x011a),(_ucs2 0x011b);
|
||||
insert into t1 values (_ucs2 0x011c),(_ucs2 0x011d),(_ucs2 0x011e),(_ucs2 0x011f);
|
||||
insert into t1 values (_ucs2 0x0120),(_ucs2 0x0121),(_ucs2 0x0122),(_ucs2 0x0123);
|
||||
insert into t1 values (_ucs2 0x0124),(_ucs2 0x0125),(_ucs2 0x0126),(_ucs2 0x0127);
|
||||
insert into t1 values (_ucs2 0x0128),(_ucs2 0x0129),(_ucs2 0x012a),(_ucs2 0x012b);
|
||||
insert into t1 values (_ucs2 0x012c),(_ucs2 0x012d),(_ucs2 0x012e),(_ucs2 0x012f);
|
||||
insert into t1 values (_ucs2 0x0130),(_ucs2 0x0131),(_ucs2 0x0132),(_ucs2 0x0133);
|
||||
insert into t1 values (_ucs2 0x0134),(_ucs2 0x0135),(_ucs2 0x0136),(_ucs2 0x0137);
|
||||
insert into t1 values (_ucs2 0x0138),(_ucs2 0x0139),(_ucs2 0x013a),(_ucs2 0x013b);
|
||||
insert into t1 values (_ucs2 0x013c),(_ucs2 0x013d),(_ucs2 0x013e),(_ucs2 0x013f);
|
||||
insert into t1 values (_ucs2 0x0140),(_ucs2 0x0141),(_ucs2 0x0142),(_ucs2 0x0143);
|
||||
insert into t1 values (_ucs2 0x0144),(_ucs2 0x0145),(_ucs2 0x0146),(_ucs2 0x0147);
|
||||
insert into t1 values (_ucs2 0x0148),(_ucs2 0x0149),(_ucs2 0x014a),(_ucs2 0x014b);
|
||||
insert into t1 values (_ucs2 0x014c),(_ucs2 0x014d),(_ucs2 0x014e),(_ucs2 0x014f);
|
||||
insert into t1 values (_ucs2 0x0150),(_ucs2 0x0151),(_ucs2 0x0152),(_ucs2 0x0153);
|
||||
insert into t1 values (_ucs2 0x0154),(_ucs2 0x0155),(_ucs2 0x0156),(_ucs2 0x0157);
|
||||
insert into t1 values (_ucs2 0x0158),(_ucs2 0x0159),(_ucs2 0x015a),(_ucs2 0x015b);
|
||||
insert into t1 values (_ucs2 0x015c),(_ucs2 0x015d),(_ucs2 0x015e),(_ucs2 0x015f);
|
||||
insert into t1 values (_ucs2 0x0160),(_ucs2 0x0161),(_ucs2 0x0162),(_ucs2 0x0163);
|
||||
insert into t1 values (_ucs2 0x0164),(_ucs2 0x0165),(_ucs2 0x0166),(_ucs2 0x0167);
|
||||
insert into t1 values (_ucs2 0x0168),(_ucs2 0x0169),(_ucs2 0x016a),(_ucs2 0x016b);
|
||||
insert into t1 values (_ucs2 0x016c),(_ucs2 0x016d),(_ucs2 0x016e),(_ucs2 0x016f);
|
||||
insert into t1 values (_ucs2 0x0170),(_ucs2 0x0171),(_ucs2 0x0172),(_ucs2 0x0173);
|
||||
insert into t1 values (_ucs2 0x0174),(_ucs2 0x0175),(_ucs2 0x0176),(_ucs2 0x0177);
|
||||
insert into t1 values (_ucs2 0x0178),(_ucs2 0x0179),(_ucs2 0x017a),(_ucs2 0x017b);
|
||||
insert into t1 values (_ucs2 0x017c),(_ucs2 0x017d),(_ucs2 0x017e),(_ucs2 0x017f);
|
||||
|
||||
#
|
||||
# Latin extended-B, 0180-024F
|
||||
#
|
||||
insert into t1 values (_ucs2 0x0180),(_ucs2 0x0181),(_ucs2 0x0182),(_ucs2 0x0183);
|
||||
insert into t1 values (_ucs2 0x0184),(_ucs2 0x0185),(_ucs2 0x0186),(_ucs2 0x0187);
|
||||
insert into t1 values (_ucs2 0x0188),(_ucs2 0x0189),(_ucs2 0x018a),(_ucs2 0x018b);
|
||||
insert into t1 values (_ucs2 0x018c),(_ucs2 0x018d),(_ucs2 0x018e),(_ucs2 0x018f);
|
||||
insert into t1 values (_ucs2 0x0190),(_ucs2 0x0191),(_ucs2 0x0192),(_ucs2 0x0193);
|
||||
insert into t1 values (_ucs2 0x0194),(_ucs2 0x0195),(_ucs2 0x0196),(_ucs2 0x0197);
|
||||
insert into t1 values (_ucs2 0x0198),(_ucs2 0x0199),(_ucs2 0x019a),(_ucs2 0x019b);
|
||||
insert into t1 values (_ucs2 0x019c),(_ucs2 0x019d),(_ucs2 0x019e),(_ucs2 0x019f);
|
||||
insert into t1 values (_ucs2 0x01a0),(_ucs2 0x01a1),(_ucs2 0x01a2),(_ucs2 0x01a3);
|
||||
insert into t1 values (_ucs2 0x01a4),(_ucs2 0x01a5),(_ucs2 0x01a6),(_ucs2 0x01a7);
|
||||
insert into t1 values (_ucs2 0x01a8),(_ucs2 0x01a9),(_ucs2 0x01aa),(_ucs2 0x01ab);
|
||||
insert into t1 values (_ucs2 0x01ac),(_ucs2 0x01ad),(_ucs2 0x01ae),(_ucs2 0x01af);
|
||||
insert into t1 values (_ucs2 0x01b0),(_ucs2 0x01b1),(_ucs2 0x01b2),(_ucs2 0x01b3);
|
||||
insert into t1 values (_ucs2 0x01b4),(_ucs2 0x01b5),(_ucs2 0x01b6),(_ucs2 0x01b7);
|
||||
insert into t1 values (_ucs2 0x01b8),(_ucs2 0x01b9),(_ucs2 0x01ba),(_ucs2 0x01bb);
|
||||
insert into t1 values (_ucs2 0x01bc),(_ucs2 0x01bd),(_ucs2 0x01be),(_ucs2 0x01bf);
|
||||
insert into t1 values (_ucs2 0x01c0),(_ucs2 0x01c1),(_ucs2 0x01c2),(_ucs2 0x01c3);
|
||||
insert into t1 values (_ucs2 0x01c4),(_ucs2 0x01c5),(_ucs2 0x01c6),(_ucs2 0x01c7);
|
||||
insert into t1 values (_ucs2 0x01c8),(_ucs2 0x01c9),(_ucs2 0x01ca),(_ucs2 0x01cb);
|
||||
insert into t1 values (_ucs2 0x01cc),(_ucs2 0x01cd),(_ucs2 0x01ce),(_ucs2 0x01cf);
|
||||
insert into t1 values (_ucs2 0x01d0),(_ucs2 0x01d1),(_ucs2 0x01d2),(_ucs2 0x01d3);
|
||||
insert into t1 values (_ucs2 0x01d4),(_ucs2 0x01d5),(_ucs2 0x01d6),(_ucs2 0x01d7);
|
||||
insert into t1 values (_ucs2 0x01d8),(_ucs2 0x01d9),(_ucs2 0x01da),(_ucs2 0x01db);
|
||||
insert into t1 values (_ucs2 0x01dc),(_ucs2 0x01dd),(_ucs2 0x01de),(_ucs2 0x01df);
|
||||
insert into t1 values (_ucs2 0x01e0),(_ucs2 0x01e1),(_ucs2 0x01e2),(_ucs2 0x01e3);
|
||||
insert into t1 values (_ucs2 0x01e4),(_ucs2 0x01e5),(_ucs2 0x01e6),(_ucs2 0x01e7);
|
||||
insert into t1 values (_ucs2 0x01e8),(_ucs2 0x01e9),(_ucs2 0x01ea),(_ucs2 0x01eb);
|
||||
insert into t1 values (_ucs2 0x01ec),(_ucs2 0x01ed),(_ucs2 0x01ee),(_ucs2 0x01ef);
|
||||
insert into t1 values (_ucs2 0x01f0),(_ucs2 0x01f1),(_ucs2 0x01f2),(_ucs2 0x01f3);
|
||||
insert into t1 values (_ucs2 0x01f4),(_ucs2 0x01f5),(_ucs2 0x01f6),(_ucs2 0x01f7);
|
||||
insert into t1 values (_ucs2 0x01f8),(_ucs2 0x01f9),(_ucs2 0x01fa),(_ucs2 0x01fb);
|
||||
insert into t1 values (_ucs2 0x01fc),(_ucs2 0x01fd),(_ucs2 0x01fe),(_ucs2 0x01ff);
|
||||
|
||||
|
||||
insert into t1 values ('AA'),('Aa'),('aa'),('aA');
|
||||
insert into t1 values ('CH'),('Ch'),('ch'),('cH');
|
||||
insert into t1 values ('DZ'),('Dz'),('dz'),('dZ');
|
||||
insert into t1 values ('IJ'),('Ij'),('ij'),('iJ');
|
||||
insert into t1 values ('LJ'),('Lj'),('lj'),('lJ');
|
||||
insert into t1 values ('LL'),('Ll'),('ll'),('lL');
|
||||
insert into t1 values ('NJ'),('Nj'),('nj'),('nJ');
|
||||
insert into t1 values ('OE'),('Oe'),('oe'),('oE');
|
||||
insert into t1 values ('SS'),('Ss'),('ss'),('sS');
|
||||
insert into t1 values ('RR'),('Rr'),('rr'),('rR');
|
||||
|
||||
select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf32_unicode_ci;
|
||||
select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf32_icelandic_ci;
|
||||
select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf32_latvian_ci;
|
||||
select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf32_romanian_ci;
|
||||
select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf32_slovenian_ci;
|
||||
select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf32_polish_ci;
|
||||
select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf32_estonian_ci;
|
||||
select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf32_spanish_ci;
|
||||
select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf32_swedish_ci;
|
||||
select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf32_turkish_ci;
|
||||
select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf32_czech_ci;
|
||||
select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf32_danish_ci;
|
||||
select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf32_lithuanian_ci;
|
||||
select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf32_slovak_ci;
|
||||
select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf32_spanish2_ci;
|
||||
select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf32_roman_ci;
|
||||
select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf32_esperanto_ci;
|
||||
select group_concat(c1 order by binary c1 separator '') from t1 group by c1 collate utf32_hungarian_ci;
|
||||
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug#5324
|
||||
#
|
||||
SET NAMES utf8;
|
||||
#test1
|
||||
CREATE TABLE t1 (c varchar(200) CHARACTER SET utf32 COLLATE utf32_general_ci NOT NULL, INDEX (c));
|
||||
INSERT INTO t1 VALUES (_ucs2 0x039C03C903B403B11F770308);
|
||||
#Check one row
|
||||
SELECT * FROM t1 WHERE c LIKE _utf32 0x0000039C00000025 COLLATE utf32_general_ci;
|
||||
INSERT INTO t1 VALUES (CONVERT(_ucs2 0x039C03C903B4 USING utf8));
|
||||
#Check two rows
|
||||
SELECT * FROM t1 WHERE c LIKE _utf32 0x0000039C00000025
|
||||
COLLATE utf32_general_ci ORDER BY c;
|
||||
DROP TABLE t1;
|
||||
#test2
|
||||
CREATE TABLE t1 (c varchar(200) CHARACTER SET utf32 COLLATE utf32_unicode_ci NOT NULL, INDEX (c));
|
||||
INSERT INTO t1 VALUES (_ucs2 0x039C03C903B403B11F770308);
|
||||
#Check one row
|
||||
SELECT * FROM t1 WHERE c LIKE _utf32 0x0000039C00000025 COLLATE utf32_unicode_ci;
|
||||
INSERT INTO t1 VALUES (_ucs2 0x039C03C903B4);
|
||||
#Check two rows
|
||||
SELECT * FROM t1 WHERE c LIKE _utf32 0x0000039C00000025
|
||||
COLLATE utf32_unicode_ci ORDER BY c;
|
||||
DROP TABLE t1;
|
||||
#test 3
|
||||
CREATE TABLE t1 (c varchar(200) CHARACTER SET utf32 COLLATE utf32_unicode_ci NOT NULL, INDEX (c));
|
||||
INSERT INTO t1 VALUES (_ucs2 0x039C03C903B403B11F770308);
|
||||
#Check one row row
|
||||
SELECT * FROM t1 WHERE c LIKE CONVERT(_ucs2 0x039C0025 USING utf32) COLLATE utf32_unicode_ci;
|
||||
INSERT INTO t1 VALUES (CONVERT(_ucs2 0x039C03C903B4 USING utf8));
|
||||
#Check two rows
|
||||
SELECT * FROM t1 WHERE c LIKE CONVERT(_ucs2 0x039C0025 USING utf32)
|
||||
COLLATE utf32_unicode_ci ORDER BY c;
|
||||
DROP TABLE t1;
|
||||
|
||||
|
||||
SET NAMES utf8;
|
||||
SET @test_character_set='utf32';
|
||||
SET @test_collation='utf32_swedish_ci';
|
||||
-- source include/ctype_common.inc
|
||||
|
||||
|
||||
SET collation_connection='utf32_unicode_ci';
|
||||
-- source include/ctype_filesort.inc
|
||||
-- source include/ctype_like_escape.inc
|
||||
|
||||
--echo End of 4.1 tests
|
||||
|
||||
#
|
||||
# Check UPPER/LOWER changing length
|
||||
#
|
||||
# Result shorter than argument
|
||||
CREATE TABLE t1 (id int, a varchar(30) character set utf32);
|
||||
INSERT INTO t1 VALUES (1, _ucs2 0x01310069), (2, _ucs2 0x01310131);
|
||||
INSERT INTO t1 VALUES (3, _ucs2 0x00690069), (4, _ucs2 0x01300049);
|
||||
INSERT INTO t1 VALUES (5, _ucs2 0x01300130), (6, _ucs2 0x00490049);
|
||||
SELECT a, length(a) la, @l:=lower(a) l, length(@l) ll, @u:=upper(a) u, length(@u) lu
|
||||
FROM t1 ORDER BY id;
|
||||
ALTER TABLE t1 MODIFY a VARCHAR(30) character set utf32 collate utf32_turkish_ci;
|
||||
SELECT a, length(a) la, @l:=lower(a) l, length(@l) ll, @u:=upper(a) u, length(@u) lu
|
||||
FROM t1 ORDER BY id;
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Bug #27079 Crash while grouping empty ucs2 strings
|
||||
#
|
||||
CREATE TABLE t1 (
|
||||
c1 text character set utf32 collate utf32_polish_ci NOT NULL
|
||||
) ENGINE=MyISAM;
|
||||
insert into t1 values (''),('a');
|
||||
SELECT COUNT(*), c1 FROM t1 GROUP BY c1;
|
||||
DROP TABLE IF EXISTS t1;
|
||||
|
||||
|
||||
#
|
||||
# Test basic regex functionality
|
||||
#
|
||||
set collation_connection=utf32_unicode_ci;
|
||||
--source include/ctype_regex.inc
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # End of 5.5 tests
|
||||
--echo #
|
@ -1440,6 +1440,17 @@ DROP TABLE t1;
|
||||
|
||||
|
||||
--echo Start of 5.4 tests
|
||||
|
||||
#
|
||||
# WL#1213: utf8mb3 is an alias for utf8
|
||||
#
|
||||
SET NAMES utf8mb3;
|
||||
SHOW VARIABLES LIKE 'character_set_results%';
|
||||
CREATE TABLE t1 (a CHAR CHARACTER SET utf8mb3 COLLATE utf8mb3_bin);
|
||||
SHOW CREATE TABLE t1;
|
||||
DROP TABLE t1;
|
||||
SELECT _utf8mb3'test';
|
||||
|
||||
#
|
||||
# Bug#26180: Can't add columns to tables created with utf8 text indexes
|
||||
#
|
||||
|
1671
mysql-test/t/ctype_utf8mb4.test
Normal file
1671
mysql-test/t/ctype_utf8mb4.test
Normal file
File diff suppressed because it is too large
Load Diff
@ -442,7 +442,7 @@ where collation(t2.a) = _utf8'binary' order by t1.a,t2.a;
|
||||
select t1.*,t2.* from t1 left join t2 on (t1.b=t2.b)
|
||||
where charset(t2.a) = _utf8'binary' order by t1.a,t2.a;
|
||||
select t1.*,t2.* from t1 left join t2 on (t1.b=t2.b)
|
||||
where coercibility(t2.a) = 2 order by t1.a,t2.a;
|
||||
where coercibility(t2.a) = 5 order by t1.a,t2.a;
|
||||
DROP TABLE t1, t2;
|
||||
|
||||
#
|
||||
|
@ -45,6 +45,53 @@ extern CHARSET_INFO my_charset_ucs2_hungarian_uca_ci;
|
||||
extern CHARSET_INFO my_charset_ucs2_sinhala_uca_ci;
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef HAVE_CHARSET_utf32
|
||||
extern CHARSET_INFO my_charset_utf32_icelandic_uca_ci;
|
||||
extern CHARSET_INFO my_charset_utf32_latvian_uca_ci;
|
||||
extern CHARSET_INFO my_charset_utf32_romanian_uca_ci;
|
||||
extern CHARSET_INFO my_charset_utf32_slovenian_uca_ci;
|
||||
extern CHARSET_INFO my_charset_utf32_polish_uca_ci;
|
||||
extern CHARSET_INFO my_charset_utf32_estonian_uca_ci;
|
||||
extern CHARSET_INFO my_charset_utf32_spanish_uca_ci;
|
||||
extern CHARSET_INFO my_charset_utf32_swedish_uca_ci;
|
||||
extern CHARSET_INFO my_charset_utf32_turkish_uca_ci;
|
||||
extern CHARSET_INFO my_charset_utf32_czech_uca_ci;
|
||||
extern CHARSET_INFO my_charset_utf32_danish_uca_ci;
|
||||
extern CHARSET_INFO my_charset_utf32_lithuanian_uca_ci;
|
||||
extern CHARSET_INFO my_charset_utf32_slovak_uca_ci;
|
||||
extern CHARSET_INFO my_charset_utf32_spanish2_uca_ci;
|
||||
extern CHARSET_INFO my_charset_utf32_roman_uca_ci;
|
||||
extern CHARSET_INFO my_charset_utf32_persian_uca_ci;
|
||||
extern CHARSET_INFO my_charset_utf32_esperanto_uca_ci;
|
||||
extern CHARSET_INFO my_charset_utf32_hungarian_uca_ci;
|
||||
extern CHARSET_INFO my_charset_utf32_sinhala_uca_ci;
|
||||
#endif /* HAVE_CHARSET_utf32 */
|
||||
|
||||
|
||||
#ifdef HAVE_CHARSET_utf16
|
||||
extern CHARSET_INFO my_charset_utf16_icelandic_uca_ci;
|
||||
extern CHARSET_INFO my_charset_utf16_latvian_uca_ci;
|
||||
extern CHARSET_INFO my_charset_utf16_romanian_uca_ci;
|
||||
extern CHARSET_INFO my_charset_utf16_slovenian_uca_ci;
|
||||
extern CHARSET_INFO my_charset_utf16_polish_uca_ci;
|
||||
extern CHARSET_INFO my_charset_utf16_estonian_uca_ci;
|
||||
extern CHARSET_INFO my_charset_utf16_spanish_uca_ci;
|
||||
extern CHARSET_INFO my_charset_utf16_swedish_uca_ci;
|
||||
extern CHARSET_INFO my_charset_utf16_turkish_uca_ci;
|
||||
extern CHARSET_INFO my_charset_utf16_czech_uca_ci;
|
||||
extern CHARSET_INFO my_charset_utf16_danish_uca_ci;
|
||||
extern CHARSET_INFO my_charset_utf16_lithuanian_uca_ci;
|
||||
extern CHARSET_INFO my_charset_utf16_slovak_uca_ci;
|
||||
extern CHARSET_INFO my_charset_utf16_spanish2_uca_ci;
|
||||
extern CHARSET_INFO my_charset_utf16_roman_uca_ci;
|
||||
extern CHARSET_INFO my_charset_utf16_persian_uca_ci;
|
||||
extern CHARSET_INFO my_charset_utf16_esperanto_uca_ci;
|
||||
extern CHARSET_INFO my_charset_utf16_hungarian_uca_ci;
|
||||
extern CHARSET_INFO my_charset_utf16_sinhala_uca_ci;
|
||||
#endif /* HAVE_CHARSET_utf16 */
|
||||
|
||||
|
||||
#ifdef HAVE_CHARSET_utf8
|
||||
extern CHARSET_INFO my_charset_utf8_icelandic_uca_ci;
|
||||
extern CHARSET_INFO my_charset_utf8_latvian_uca_ci;
|
||||
@ -70,6 +117,28 @@ extern CHARSET_INFO my_charset_utf8_general_cs;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CHARSET_utf8mb4
|
||||
extern CHARSET_INFO my_charset_utf8mb4_icelandic_uca_ci;
|
||||
extern CHARSET_INFO my_charset_utf8mb4_latvian_uca_ci;
|
||||
extern CHARSET_INFO my_charset_utf8mb4_romanian_uca_ci;
|
||||
extern CHARSET_INFO my_charset_utf8mb4_slovenian_uca_ci;
|
||||
extern CHARSET_INFO my_charset_utf8mb4_polish_uca_ci;
|
||||
extern CHARSET_INFO my_charset_utf8mb4_estonian_uca_ci;
|
||||
extern CHARSET_INFO my_charset_utf8mb4_spanish_uca_ci;
|
||||
extern CHARSET_INFO my_charset_utf8mb4_swedish_uca_ci;
|
||||
extern CHARSET_INFO my_charset_utf8mb4_turkish_uca_ci;
|
||||
extern CHARSET_INFO my_charset_utf8mb4_czech_uca_ci;
|
||||
extern CHARSET_INFO my_charset_utf8mb4_danish_uca_ci;
|
||||
extern CHARSET_INFO my_charset_utf8mb4_lithuanian_uca_ci;
|
||||
extern CHARSET_INFO my_charset_utf8mb4_slovak_uca_ci;
|
||||
extern CHARSET_INFO my_charset_utf8mb4_spanish2_uca_ci;
|
||||
extern CHARSET_INFO my_charset_utf8mb4_roman_uca_ci;
|
||||
extern CHARSET_INFO my_charset_utf8mb4_persian_uca_ci;
|
||||
extern CHARSET_INFO my_charset_utf8mb4_esperanto_uca_ci;
|
||||
extern CHARSET_INFO my_charset_utf8mb4_hungarian_uca_ci;
|
||||
extern CHARSET_INFO my_charset_utf8mb4_sinhala_uca_ci;
|
||||
#endif /* HAVE_CHARSET_utf8mb4 */
|
||||
|
||||
#endif /* HAVE_UCA_COLLATIONS */
|
||||
|
||||
my_bool init_compiled_charsets(myf flags __attribute__((unused)))
|
||||
@ -191,7 +260,91 @@ my_bool init_compiled_charsets(myf flags __attribute__((unused)))
|
||||
add_compiled_collation(&my_charset_utf8_hungarian_uca_ci);
|
||||
add_compiled_collation(&my_charset_utf8_sinhala_uca_ci);
|
||||
#endif
|
||||
#endif
|
||||
#endif /* HAVE_CHARSET_utf8 */
|
||||
|
||||
|
||||
#ifdef HAVE_CHARSET_utf8mb4
|
||||
add_compiled_collation(&my_charset_utf8mb4_general_ci);
|
||||
add_compiled_collation(&my_charset_utf8mb4_bin);
|
||||
#ifdef HAVE_UCA_COLLATIONS
|
||||
add_compiled_collation(&my_charset_utf8mb4_unicode_ci);
|
||||
add_compiled_collation(&my_charset_utf8mb4_icelandic_uca_ci);
|
||||
add_compiled_collation(&my_charset_utf8mb4_latvian_uca_ci);
|
||||
add_compiled_collation(&my_charset_utf8mb4_romanian_uca_ci);
|
||||
add_compiled_collation(&my_charset_utf8mb4_slovenian_uca_ci);
|
||||
add_compiled_collation(&my_charset_utf8mb4_polish_uca_ci);
|
||||
add_compiled_collation(&my_charset_utf8mb4_estonian_uca_ci);
|
||||
add_compiled_collation(&my_charset_utf8mb4_spanish_uca_ci);
|
||||
add_compiled_collation(&my_charset_utf8mb4_swedish_uca_ci);
|
||||
add_compiled_collation(&my_charset_utf8mb4_turkish_uca_ci);
|
||||
add_compiled_collation(&my_charset_utf8mb4_czech_uca_ci);
|
||||
add_compiled_collation(&my_charset_utf8mb4_danish_uca_ci);
|
||||
add_compiled_collation(&my_charset_utf8mb4_lithuanian_uca_ci);
|
||||
add_compiled_collation(&my_charset_utf8mb4_slovak_uca_ci);
|
||||
add_compiled_collation(&my_charset_utf8mb4_spanish2_uca_ci);
|
||||
add_compiled_collation(&my_charset_utf8mb4_roman_uca_ci);
|
||||
add_compiled_collation(&my_charset_utf8mb4_persian_uca_ci);
|
||||
add_compiled_collation(&my_charset_utf8mb4_esperanto_uca_ci);
|
||||
add_compiled_collation(&my_charset_utf8mb4_hungarian_uca_ci);
|
||||
add_compiled_collation(&my_charset_utf8mb4_sinhala_uca_ci);
|
||||
#endif /* HAVE_UCA_COLLATIONS */
|
||||
#endif /* HAVE_CHARSET_utf8mb4 */
|
||||
|
||||
|
||||
#ifdef HAVE_CHARSET_utf16
|
||||
add_compiled_collation(&my_charset_utf16_general_ci);
|
||||
add_compiled_collation(&my_charset_utf16_bin);
|
||||
#ifdef HAVE_UCA_COLLATIONS
|
||||
add_compiled_collation(&my_charset_utf16_unicode_ci);
|
||||
add_compiled_collation(&my_charset_utf16_icelandic_uca_ci);
|
||||
add_compiled_collation(&my_charset_utf16_latvian_uca_ci);
|
||||
add_compiled_collation(&my_charset_utf16_romanian_uca_ci);
|
||||
add_compiled_collation(&my_charset_utf16_slovenian_uca_ci);
|
||||
add_compiled_collation(&my_charset_utf16_polish_uca_ci);
|
||||
add_compiled_collation(&my_charset_utf16_estonian_uca_ci);
|
||||
add_compiled_collation(&my_charset_utf16_spanish_uca_ci);
|
||||
add_compiled_collation(&my_charset_utf16_swedish_uca_ci);
|
||||
add_compiled_collation(&my_charset_utf16_turkish_uca_ci);
|
||||
add_compiled_collation(&my_charset_utf16_czech_uca_ci);
|
||||
add_compiled_collation(&my_charset_utf16_danish_uca_ci);
|
||||
add_compiled_collation(&my_charset_utf16_lithuanian_uca_ci);
|
||||
add_compiled_collation(&my_charset_utf16_slovak_uca_ci);
|
||||
add_compiled_collation(&my_charset_utf16_spanish2_uca_ci);
|
||||
add_compiled_collation(&my_charset_utf16_roman_uca_ci);
|
||||
add_compiled_collation(&my_charset_utf16_persian_uca_ci);
|
||||
add_compiled_collation(&my_charset_utf16_esperanto_uca_ci);
|
||||
add_compiled_collation(&my_charset_utf16_hungarian_uca_ci);
|
||||
add_compiled_collation(&my_charset_utf16_sinhala_uca_ci);
|
||||
#endif /* HAVE_UCA_COLLATIOINS */
|
||||
#endif /* HAVE_CHARSET_utf16 */
|
||||
|
||||
|
||||
#ifdef HAVE_CHARSET_utf32
|
||||
add_compiled_collation(&my_charset_utf32_general_ci);
|
||||
add_compiled_collation(&my_charset_utf32_bin);
|
||||
#ifdef HAVE_UCA_COLLATIONS
|
||||
add_compiled_collation(&my_charset_utf32_unicode_ci);
|
||||
add_compiled_collation(&my_charset_utf32_icelandic_uca_ci);
|
||||
add_compiled_collation(&my_charset_utf32_latvian_uca_ci);
|
||||
add_compiled_collation(&my_charset_utf32_romanian_uca_ci);
|
||||
add_compiled_collation(&my_charset_utf32_slovenian_uca_ci);
|
||||
add_compiled_collation(&my_charset_utf32_polish_uca_ci);
|
||||
add_compiled_collation(&my_charset_utf32_estonian_uca_ci);
|
||||
add_compiled_collation(&my_charset_utf32_spanish_uca_ci);
|
||||
add_compiled_collation(&my_charset_utf32_swedish_uca_ci);
|
||||
add_compiled_collation(&my_charset_utf32_turkish_uca_ci);
|
||||
add_compiled_collation(&my_charset_utf32_czech_uca_ci);
|
||||
add_compiled_collation(&my_charset_utf32_danish_uca_ci);
|
||||
add_compiled_collation(&my_charset_utf32_lithuanian_uca_ci);
|
||||
add_compiled_collation(&my_charset_utf32_slovak_uca_ci);
|
||||
add_compiled_collation(&my_charset_utf32_spanish2_uca_ci);
|
||||
add_compiled_collation(&my_charset_utf32_roman_uca_ci);
|
||||
add_compiled_collation(&my_charset_utf32_persian_uca_ci);
|
||||
add_compiled_collation(&my_charset_utf32_esperanto_uca_ci);
|
||||
add_compiled_collation(&my_charset_utf32_hungarian_uca_ci);
|
||||
add_compiled_collation(&my_charset_utf32_sinhala_uca_ci);
|
||||
#endif /* HAVE_UCA_COLLATIONS */
|
||||
#endif /* HAVE_CHARSET_utf32 */
|
||||
|
||||
/* Copy compiled charsets */
|
||||
for (cs=compiled_charsets; cs->name; cs++)
|
||||
|
@ -252,13 +252,35 @@ static int add_collation(CHARSET_INFO *cs)
|
||||
newcs->state|= MY_CS_AVAILABLE | MY_CS_LOADED | MY_CS_NONASCII;
|
||||
#endif
|
||||
}
|
||||
else if (!strcmp(cs->csname, "utf8"))
|
||||
else if (!strcmp(cs->csname, "utf8") || !strcmp(cs->csname, "utf8mb3"))
|
||||
{
|
||||
#if defined (HAVE_CHARSET_utf8) && defined(HAVE_UCA_COLLATIONS)
|
||||
copy_uca_collation(newcs, &my_charset_utf8_unicode_ci);
|
||||
newcs->ctype= my_charset_utf8_unicode_ci.ctype;
|
||||
if (init_state_maps(newcs))
|
||||
return MY_XML_ERROR;
|
||||
#endif
|
||||
}
|
||||
else if (!strcmp(cs->csname, "utf8mb4"))
|
||||
{
|
||||
#if defined (HAVE_CHARSET_utf8mb4) && defined(HAVE_UCA_COLLATIONS)
|
||||
copy_uca_collation(newcs, &my_charset_utf8mb4_unicode_ci);
|
||||
newcs->ctype= my_charset_utf8mb4_unicode_ci.ctype;
|
||||
newcs->state|= MY_CS_AVAILABLE | MY_CS_LOADED;
|
||||
#endif
|
||||
}
|
||||
else if (!strcmp(cs->csname, "utf16"))
|
||||
{
|
||||
#if defined (HAVE_CHARSET_utf16) && defined(HAVE_UCA_COLLATIONS)
|
||||
copy_uca_collation(newcs, &my_charset_utf16_unicode_ci);
|
||||
newcs->state|= MY_CS_AVAILABLE | MY_CS_LOADED | MY_CS_NONASCII;
|
||||
#endif
|
||||
}
|
||||
else if (!strcmp(cs->csname, "utf32"))
|
||||
{
|
||||
#if defined (HAVE_CHARSET_utf32) && defined(HAVE_UCA_COLLATIONS)
|
||||
copy_uca_collation(newcs, &my_charset_utf32_unicode_ci);
|
||||
newcs->state|= MY_CS_AVAILABLE | MY_CS_LOADED | MY_CS_NONASCII;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
@ -433,17 +455,35 @@ static void init_available_charsets(void)
|
||||
}
|
||||
|
||||
|
||||
uint get_collation_number(const char *name)
|
||||
static const char*
|
||||
get_collation_name_alias(const char *name, char *buf, size_t bufsize)
|
||||
{
|
||||
my_pthread_once(&charsets_initialized, init_available_charsets);
|
||||
return get_collation_number_internal(name);
|
||||
if (!strncasecmp(name, "utf8mb3_", 8))
|
||||
{
|
||||
my_snprintf(buf, bufsize, "utf8_%s", name + 8);
|
||||
return buf;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
uint get_charset_number(const char *charset_name, uint cs_flags)
|
||||
uint get_collation_number(const char *name)
|
||||
{
|
||||
uint id;
|
||||
char alias[64];
|
||||
my_pthread_once(&charsets_initialized, init_available_charsets);
|
||||
if ((id= get_collation_number_internal(name)))
|
||||
return id;
|
||||
if ((name= get_collation_name_alias(name, alias, sizeof(alias))))
|
||||
return get_collation_number_internal(name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static uint
|
||||
get_charset_number_internal(const char *charset_name, uint cs_flags)
|
||||
{
|
||||
CHARSET_INFO **cs;
|
||||
my_pthread_once(&charsets_initialized, init_available_charsets);
|
||||
|
||||
for (cs= all_charsets;
|
||||
cs < all_charsets + array_elements(all_charsets);
|
||||
@ -457,6 +497,27 @@ uint get_charset_number(const char *charset_name, uint cs_flags)
|
||||
}
|
||||
|
||||
|
||||
static const char*
|
||||
get_charset_name_alias(const char *name)
|
||||
{
|
||||
if (!my_strcasecmp(&my_charset_latin1, name, "utf8mb3"))
|
||||
return "utf8";
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
uint get_charset_number(const char *charset_name, uint cs_flags)
|
||||
{
|
||||
uint id;
|
||||
my_pthread_once(&charsets_initialized, init_available_charsets);
|
||||
if ((id= get_charset_number_internal(charset_name, cs_flags)))
|
||||
return id;
|
||||
if ((charset_name= get_charset_name_alias(charset_name)))
|
||||
return get_charset_number_internal(charset_name, cs_flags);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
const char *get_charset_name(uint charset_number)
|
||||
{
|
||||
CHARSET_INFO *cs;
|
||||
|
64
sql/field.cc
64
sql/field.cc
@ -1807,7 +1807,7 @@ bool Field::get_date(MYSQL_TIME *ltime,uint fuzzydate)
|
||||
char buff[40];
|
||||
String tmp(buff,sizeof(buff),&my_charset_bin),*res;
|
||||
if (!(res=val_str(&tmp)) ||
|
||||
str_to_datetime_with_warn(res->ptr(), res->length(),
|
||||
str_to_datetime_with_warn(res->charset(), res->ptr(), res->length(),
|
||||
ltime, fuzzydate) <= MYSQL_TIMESTAMP_ERROR)
|
||||
return 1;
|
||||
return 0;
|
||||
@ -1818,7 +1818,7 @@ bool Field::get_time(MYSQL_TIME *ltime)
|
||||
char buff[40];
|
||||
String tmp(buff,sizeof(buff),&my_charset_bin),*res;
|
||||
if (!(res=val_str(&tmp)) ||
|
||||
str_to_time_with_warn(res->ptr(), res->length(), ltime))
|
||||
str_to_time_with_warn(res->charset(), res->ptr(), res->length(), ltime))
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
@ -1835,7 +1835,9 @@ int Field::store_time(MYSQL_TIME *ltime, timestamp_type type_arg)
|
||||
ASSERT_COLUMN_MARKED_FOR_WRITE;
|
||||
char buff[MAX_DATE_STRING_REP_LENGTH];
|
||||
uint length= (uint) my_TIME_to_str(ltime, buff);
|
||||
return store(buff, length, &my_charset_bin);
|
||||
/* Avoid conversion when field character set is ASCII compatible */
|
||||
return store(buff, length, (charset()->state & MY_CS_NONASCII) ?
|
||||
&my_charset_latin1 : charset());
|
||||
}
|
||||
|
||||
|
||||
@ -2427,7 +2429,7 @@ String *Field_decimal::val_str(String *val_buffer __attribute__((unused)),
|
||||
size_t tmp_length;
|
||||
|
||||
for (str=ptr ; *str == ' ' ; str++) ;
|
||||
val_ptr->set_charset(&my_charset_bin);
|
||||
val_ptr->set_charset(&my_charset_numeric);
|
||||
tmp_length= (size_t) (str-ptr);
|
||||
if (field_length < tmp_length) // Error in data
|
||||
val_ptr->length(0);
|
||||
@ -2557,7 +2559,7 @@ Field *Field_new_decimal::create_from_item (Item *item)
|
||||
{
|
||||
uint8 dec= item->decimals;
|
||||
uint8 intg= item->decimal_precision() - dec;
|
||||
uint32 len= item->max_length;
|
||||
uint32 len= item->max_char_length();
|
||||
|
||||
DBUG_ASSERT (item->result_type() == DECIMAL_RESULT);
|
||||
|
||||
@ -2849,6 +2851,7 @@ String *Field_new_decimal::val_str(String *val_buffer,
|
||||
uint fixed_precision= zerofill ? precision : 0;
|
||||
my_decimal2string(E_DEC_FATAL_ERROR, val_decimal(&decimal_value),
|
||||
fixed_precision, dec, '0', val_buffer);
|
||||
val_buffer->set_charset(&my_charset_numeric);
|
||||
return val_buffer;
|
||||
}
|
||||
|
||||
@ -3120,7 +3123,7 @@ String *Field_tiny::val_str(String *val_buffer,
|
||||
String *val_ptr __attribute__((unused)))
|
||||
{
|
||||
ASSERT_COLUMN_MARKED_FOR_READ;
|
||||
CHARSET_INFO *cs= &my_charset_bin;
|
||||
CHARSET_INFO *cs= &my_charset_numeric;
|
||||
uint length;
|
||||
uint mlength=max(field_length+1,5*cs->mbmaxlen);
|
||||
val_buffer->alloc(mlength);
|
||||
@ -3136,6 +3139,7 @@ String *Field_tiny::val_str(String *val_buffer,
|
||||
val_buffer->length(length);
|
||||
if (zerofill)
|
||||
prepend_zeros(val_buffer);
|
||||
val_buffer->set_charset(cs);
|
||||
return val_buffer;
|
||||
}
|
||||
|
||||
@ -3332,7 +3336,7 @@ String *Field_short::val_str(String *val_buffer,
|
||||
String *val_ptr __attribute__((unused)))
|
||||
{
|
||||
ASSERT_COLUMN_MARKED_FOR_READ;
|
||||
CHARSET_INFO *cs= &my_charset_bin;
|
||||
CHARSET_INFO *cs= &my_charset_numeric;
|
||||
uint length;
|
||||
uint mlength=max(field_length+1,7*cs->mbmaxlen);
|
||||
val_buffer->alloc(mlength);
|
||||
@ -3353,6 +3357,7 @@ String *Field_short::val_str(String *val_buffer,
|
||||
val_buffer->length(length);
|
||||
if (zerofill)
|
||||
prepend_zeros(val_buffer);
|
||||
val_buffer->set_charset(cs);
|
||||
return val_buffer;
|
||||
}
|
||||
|
||||
@ -3549,7 +3554,7 @@ String *Field_medium::val_str(String *val_buffer,
|
||||
String *val_ptr __attribute__((unused)))
|
||||
{
|
||||
ASSERT_COLUMN_MARKED_FOR_READ;
|
||||
CHARSET_INFO *cs= &my_charset_bin;
|
||||
CHARSET_INFO *cs= &my_charset_numeric;
|
||||
uint length;
|
||||
uint mlength=max(field_length+1,10*cs->mbmaxlen);
|
||||
val_buffer->alloc(mlength);
|
||||
@ -3560,6 +3565,7 @@ String *Field_medium::val_str(String *val_buffer,
|
||||
val_buffer->length(length);
|
||||
if (zerofill)
|
||||
prepend_zeros(val_buffer); /* purecov: inspected */
|
||||
val_buffer->set_charset(cs);
|
||||
return val_buffer;
|
||||
}
|
||||
|
||||
@ -3768,7 +3774,7 @@ String *Field_long::val_str(String *val_buffer,
|
||||
String *val_ptr __attribute__((unused)))
|
||||
{
|
||||
ASSERT_COLUMN_MARKED_FOR_READ;
|
||||
CHARSET_INFO *cs= &my_charset_bin;
|
||||
CHARSET_INFO *cs= &my_charset_numeric;
|
||||
uint length;
|
||||
uint mlength=max(field_length+1,12*cs->mbmaxlen);
|
||||
val_buffer->alloc(mlength);
|
||||
@ -3788,6 +3794,7 @@ String *Field_long::val_str(String *val_buffer,
|
||||
val_buffer->length(length);
|
||||
if (zerofill)
|
||||
prepend_zeros(val_buffer);
|
||||
val_buffer->set_charset(cs);
|
||||
return val_buffer;
|
||||
}
|
||||
|
||||
@ -4009,7 +4016,7 @@ longlong Field_longlong::val_int(void)
|
||||
String *Field_longlong::val_str(String *val_buffer,
|
||||
String *val_ptr __attribute__((unused)))
|
||||
{
|
||||
CHARSET_INFO *cs= &my_charset_bin;
|
||||
CHARSET_INFO *cs= &my_charset_numeric;
|
||||
uint length;
|
||||
uint mlength=max(field_length+1,22*cs->mbmaxlen);
|
||||
val_buffer->alloc(mlength);
|
||||
@ -4027,6 +4034,7 @@ String *Field_longlong::val_str(String *val_buffer,
|
||||
val_buffer->length(length);
|
||||
if (zerofill)
|
||||
prepend_zeros(val_buffer);
|
||||
val_buffer->set_charset(cs);
|
||||
return val_buffer;
|
||||
}
|
||||
|
||||
@ -4253,6 +4261,7 @@ String *Field_float::val_str(String *val_buffer,
|
||||
val_buffer->length((uint) len);
|
||||
if (zerofill)
|
||||
prepend_zeros(val_buffer);
|
||||
val_buffer->set_charset(&my_charset_numeric);
|
||||
return val_buffer;
|
||||
}
|
||||
|
||||
@ -4563,6 +4572,7 @@ String *Field_double::val_str(String *val_buffer,
|
||||
val_buffer->length((uint) len);
|
||||
if (zerofill)
|
||||
prepend_zeros(val_buffer);
|
||||
val_buffer->set_charset(&my_charset_numeric);
|
||||
return val_buffer;
|
||||
}
|
||||
|
||||
@ -4697,7 +4707,7 @@ Field_timestamp::Field_timestamp(uchar *ptr_arg, uint32 len_arg,
|
||||
unireg_check_arg, field_name_arg, cs)
|
||||
{
|
||||
/* For 4.0 MYD and 4.0 InnoDB compatibility */
|
||||
flags|= ZEROFILL_FLAG | UNSIGNED_FLAG;
|
||||
flags|= ZEROFILL_FLAG | UNSIGNED_FLAG | BINARY_FLAG;
|
||||
if (!share->timestamp_field && unireg_check != NONE)
|
||||
{
|
||||
/* This timestamp has auto-update */
|
||||
@ -4717,7 +4727,7 @@ Field_timestamp::Field_timestamp(bool maybe_null_arg,
|
||||
NONE, field_name_arg, cs)
|
||||
{
|
||||
/* For 4.0 MYD and 4.0 InnoDB compatibility */
|
||||
flags|= ZEROFILL_FLAG | UNSIGNED_FLAG;
|
||||
flags|= ZEROFILL_FLAG | UNSIGNED_FLAG | BINARY_FLAG;
|
||||
if (unireg_check != TIMESTAMP_DN_FIELD)
|
||||
flags|= ON_UPDATE_NOW_FLAG;
|
||||
}
|
||||
@ -4769,7 +4779,7 @@ int Field_timestamp::store(const char *from,uint len,CHARSET_INFO *cs)
|
||||
THD *thd= table ? table->in_use : current_thd;
|
||||
|
||||
/* We don't want to store invalid or fuzzy datetime values in TIMESTAMP */
|
||||
have_smth_to_conv= (str_to_datetime(from, len, &l_time,
|
||||
have_smth_to_conv= (str_to_datetime(cs, from, len, &l_time,
|
||||
(thd->variables.sql_mode &
|
||||
MODE_NO_ZERO_DATE) |
|
||||
MODE_NO_ZERO_IN_DATE, &error) >
|
||||
@ -4918,10 +4928,10 @@ String *Field_timestamp::val_str(String *val_buffer, String *val_ptr)
|
||||
|
||||
if (temp == 0L)
|
||||
{ /* Zero time is "000000" */
|
||||
val_ptr->set(STRING_WITH_LEN("0000-00-00 00:00:00"), &my_charset_bin);
|
||||
val_ptr->set(STRING_WITH_LEN("0000-00-00 00:00:00"), &my_charset_numeric);
|
||||
return val_ptr;
|
||||
}
|
||||
val_buffer->set_charset(&my_charset_bin); // Safety
|
||||
val_buffer->set_charset(&my_charset_numeric); // Safety
|
||||
|
||||
thd->variables.time_zone->gmt_sec_to_TIME(&time_tmp,(my_time_t)temp);
|
||||
|
||||
@ -4965,6 +4975,7 @@ String *Field_timestamp::val_str(String *val_buffer, String *val_ptr)
|
||||
*to++= (char) ('0'+(char) (temp2));
|
||||
*to++= (char) ('0'+(char) (temp));
|
||||
*to= 0;
|
||||
val_buffer->set_charset(&my_charset_numeric);
|
||||
return val_buffer;
|
||||
}
|
||||
|
||||
@ -5075,7 +5086,7 @@ int Field_time::store(const char *from,uint len,CHARSET_INFO *cs)
|
||||
int error= 0;
|
||||
int warning;
|
||||
|
||||
if (str_to_time(from, len, <ime, &warning))
|
||||
if (str_to_time(cs, from, len, <ime, &warning))
|
||||
{
|
||||
tmp=0L;
|
||||
error= 2;
|
||||
@ -5234,6 +5245,7 @@ String *Field_time::val_str(String *val_buffer,
|
||||
ltime.minute= (uint) (tmp/100 % 100);
|
||||
ltime.second= (uint) (tmp % 100);
|
||||
make_time((DATE_TIME_FORMAT*) 0, <ime, val_buffer);
|
||||
val_buffer->set_charset(&my_charset_numeric);
|
||||
return val_buffer;
|
||||
}
|
||||
|
||||
@ -5431,6 +5443,7 @@ String *Field_year::val_str(String *val_buffer,
|
||||
val_buffer->length(field_length);
|
||||
char *to=(char*) val_buffer->ptr();
|
||||
sprintf(to,field_length == 2 ? "%02d" : "%04d",(int) Field_year::val_int());
|
||||
val_buffer->set_charset(&my_charset_numeric);
|
||||
return val_buffer;
|
||||
}
|
||||
|
||||
@ -5458,7 +5471,7 @@ int Field_date::store(const char *from, uint len,CHARSET_INFO *cs)
|
||||
int error;
|
||||
THD *thd= table ? table->in_use : current_thd;
|
||||
|
||||
if (str_to_datetime(from, len, &l_time, TIME_FUZZY_DATE |
|
||||
if (str_to_datetime(cs, from, len, &l_time, TIME_FUZZY_DATE |
|
||||
(thd->variables.sql_mode &
|
||||
(MODE_NO_ZERO_IN_DATE | MODE_NO_ZERO_DATE |
|
||||
MODE_INVALID_DATES)),
|
||||
@ -5605,6 +5618,7 @@ String *Field_date::val_str(String *val_buffer,
|
||||
ltime.month= (int) ((uint32) tmp/100 % 100);
|
||||
ltime.day= (int) ((uint32) tmp % 100);
|
||||
make_date((DATE_TIME_FORMAT *) 0, <ime, val_buffer);
|
||||
val_buffer->set_charset(&my_charset_numeric);
|
||||
return val_buffer;
|
||||
}
|
||||
|
||||
@ -5694,7 +5708,7 @@ int Field_newdate::store(const char *from,uint len,CHARSET_INFO *cs)
|
||||
int error;
|
||||
THD *thd= table ? table->in_use : current_thd;
|
||||
enum enum_mysql_timestamp_type ret;
|
||||
if ((ret= str_to_datetime(from, len, &l_time,
|
||||
if ((ret= str_to_datetime(cs, from, len, &l_time,
|
||||
(TIME_FUZZY_DATE |
|
||||
(thd->variables.sql_mode &
|
||||
(MODE_NO_ZERO_IN_DATE | MODE_NO_ZERO_DATE |
|
||||
@ -5866,6 +5880,7 @@ String *Field_newdate::val_str(String *val_buffer,
|
||||
*pos--= (char) ('0'+part%10); part/=10;
|
||||
*pos--= (char) ('0'+part%10); part/=10;
|
||||
*pos= (char) ('0'+part);
|
||||
val_buffer->set_charset(&my_charset_numeric);
|
||||
return val_buffer;
|
||||
}
|
||||
|
||||
@ -5928,7 +5943,7 @@ int Field_datetime::store(const char *from,uint len,CHARSET_INFO *cs)
|
||||
enum enum_mysql_timestamp_type func_res;
|
||||
THD *thd= table ? table->in_use : current_thd;
|
||||
|
||||
func_res= str_to_datetime(from, len, &time_tmp,
|
||||
func_res= str_to_datetime(cs, from, len, &time_tmp,
|
||||
(TIME_FUZZY_DATE |
|
||||
(thd->variables.sql_mode &
|
||||
(MODE_NO_ZERO_IN_DATE | MODE_NO_ZERO_DATE |
|
||||
@ -6128,6 +6143,7 @@ String *Field_datetime::val_str(String *val_buffer,
|
||||
*pos--= (char) ('0'+(char) (part3%10)); part3/=10;
|
||||
*pos--= (char) ('0'+(char) (part3%10)); part3/=10;
|
||||
*pos=(char) ('0'+(char) part3);
|
||||
val_buffer->set_charset(&my_charset_numeric);
|
||||
return val_buffer;
|
||||
}
|
||||
|
||||
@ -6369,7 +6385,7 @@ int Field_str::store(double nr)
|
||||
else
|
||||
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, WARN_DATA_TRUNCATED, 1);
|
||||
}
|
||||
return store(buff, length, charset());
|
||||
return store(buff, length, &my_charset_numeric);
|
||||
}
|
||||
|
||||
|
||||
@ -6404,7 +6420,7 @@ int Field_string::store(longlong nr, bool unsigned_val)
|
||||
int Field_longstr::store_decimal(const my_decimal *d)
|
||||
{
|
||||
char buff[DECIMAL_MAX_STR_LENGTH+1];
|
||||
String str(buff, sizeof(buff), &my_charset_bin);
|
||||
String str(buff, sizeof(buff), &my_charset_numeric);
|
||||
my_decimal2string(E_DEC_FATAL_ERROR, d, 0, 0, 0, &str);
|
||||
return store(str.ptr(), str.length(), str.charset());
|
||||
}
|
||||
@ -9564,8 +9580,8 @@ bool Create_field::init(THD *thd, char *fld_name, enum_field_types fld_type,
|
||||
case MYSQL_TYPE_TIME:
|
||||
case MYSQL_TYPE_DATETIME:
|
||||
case MYSQL_TYPE_TIMESTAMP:
|
||||
charset= &my_charset_bin;
|
||||
flags|= BINCMP_FLAG;
|
||||
charset= &my_charset_numeric;
|
||||
flags|= BINARY_FLAG;
|
||||
default: break;
|
||||
}
|
||||
|
||||
@ -9681,7 +9697,7 @@ Field *make_field(TABLE_SHARE *share, uchar *ptr, uint32 field_length,
|
||||
case MYSQL_TYPE_TIME:
|
||||
case MYSQL_TYPE_DATETIME:
|
||||
case MYSQL_TYPE_TIMESTAMP:
|
||||
field_charset= &my_charset_bin;
|
||||
field_charset= &my_charset_numeric;
|
||||
default: break;
|
||||
}
|
||||
|
||||
|
42
sql/field.h
42
sql/field.h
@ -414,11 +414,14 @@ public:
|
||||
virtual bool get_date(MYSQL_TIME *ltime,uint fuzzydate);
|
||||
virtual bool get_time(MYSQL_TIME *ltime);
|
||||
virtual CHARSET_INFO *charset(void) const { return &my_charset_bin; }
|
||||
virtual CHARSET_INFO *charset_for_protocol(void) const
|
||||
{ return binary() ? &my_charset_bin : charset(); }
|
||||
virtual CHARSET_INFO *sort_charset(void) const { return charset(); }
|
||||
virtual bool has_charset(void) const { return FALSE; }
|
||||
virtual void set_charset(CHARSET_INFO *charset_arg) { }
|
||||
virtual enum Derivation derivation(void) const
|
||||
{ return DERIVATION_IMPLICIT; }
|
||||
virtual uint repertoire(void) const { return MY_REPERTOIRE_UNICODE30; }
|
||||
virtual void set_derivation(enum Derivation derivation_arg) { }
|
||||
bool set_warning(MYSQL_ERROR::enum_warning_level, unsigned int code,
|
||||
int cuted_increment);
|
||||
@ -599,6 +602,9 @@ public:
|
||||
const char *field_name_arg,
|
||||
uint8 dec_arg, bool zero_arg, bool unsigned_arg);
|
||||
Item_result result_type () const { return REAL_RESULT; }
|
||||
enum Derivation derivation(void) const { return DERIVATION_NUMERIC; }
|
||||
uint repertoire(void) const { return MY_REPERTOIRE_NUMERIC; }
|
||||
CHARSET_INFO *charset(void) const { return &my_charset_numeric; }
|
||||
void prepend_zeros(String *value);
|
||||
void add_zerofill_and_unsigned(String &res) const;
|
||||
friend class Create_field;
|
||||
@ -1169,6 +1175,10 @@ public:
|
||||
enum_field_types type() const { return MYSQL_TYPE_TIMESTAMP;}
|
||||
enum ha_base_keytype key_type() const { return HA_KEYTYPE_ULONG_INT; }
|
||||
enum Item_result cmp_type () const { return INT_RESULT; }
|
||||
enum Derivation derivation(void) const { return DERIVATION_NUMERIC; }
|
||||
uint repertoire(void) const { return MY_REPERTOIRE_NUMERIC; }
|
||||
CHARSET_INFO *charset(void) const { return &my_charset_numeric; }
|
||||
bool binary() const { return 1; }
|
||||
int store(const char *to,uint length,CHARSET_INFO *charset);
|
||||
int store(double nr);
|
||||
int store(longlong nr, bool unsigned_val);
|
||||
@ -1261,14 +1271,18 @@ public:
|
||||
CHARSET_INFO *cs)
|
||||
:Field_str(ptr_arg, MAX_DATE_WIDTH, null_ptr_arg, null_bit_arg,
|
||||
unireg_check_arg, field_name_arg, cs)
|
||||
{}
|
||||
{ flags|= BINARY_FLAG; }
|
||||
Field_date(bool maybe_null_arg, const char *field_name_arg,
|
||||
CHARSET_INFO *cs)
|
||||
:Field_str((uchar*) 0, MAX_DATE_WIDTH, maybe_null_arg ? (uchar*) "": 0,0,
|
||||
NONE, field_name_arg, cs) {}
|
||||
NONE, field_name_arg, cs) { flags|= BINARY_FLAG; }
|
||||
enum_field_types type() const { return MYSQL_TYPE_DATE;}
|
||||
enum ha_base_keytype key_type() const { return HA_KEYTYPE_ULONG_INT; }
|
||||
enum Item_result cmp_type () const { return INT_RESULT; }
|
||||
enum Derivation derivation(void) const { return DERIVATION_NUMERIC; }
|
||||
uint repertoire(void) const { return MY_REPERTOIRE_NUMERIC; }
|
||||
CHARSET_INFO *charset(void) const { return &my_charset_numeric; }
|
||||
bool binary() const { return 1; }
|
||||
int store(const char *to,uint length,CHARSET_INFO *charset);
|
||||
int store(double nr);
|
||||
int store(longlong nr, bool unsigned_val);
|
||||
@ -1305,15 +1319,19 @@ public:
|
||||
CHARSET_INFO *cs)
|
||||
:Field_str(ptr_arg, 10, null_ptr_arg, null_bit_arg,
|
||||
unireg_check_arg, field_name_arg, cs)
|
||||
{}
|
||||
{ flags|= BINARY_FLAG; }
|
||||
Field_newdate(bool maybe_null_arg, const char *field_name_arg,
|
||||
CHARSET_INFO *cs)
|
||||
:Field_str((uchar*) 0,10, maybe_null_arg ? (uchar*) "": 0,0,
|
||||
NONE, field_name_arg, cs) {}
|
||||
NONE, field_name_arg, cs) { flags|= BINARY_FLAG; }
|
||||
enum_field_types type() const { return MYSQL_TYPE_DATE;}
|
||||
enum_field_types real_type() const { return MYSQL_TYPE_NEWDATE; }
|
||||
enum ha_base_keytype key_type() const { return HA_KEYTYPE_UINT24; }
|
||||
enum Item_result cmp_type () const { return INT_RESULT; }
|
||||
enum Derivation derivation(void) const { return DERIVATION_NUMERIC; }
|
||||
uint repertoire(void) const { return MY_REPERTOIRE_NUMERIC; }
|
||||
CHARSET_INFO *charset(void) const { return &my_charset_numeric; }
|
||||
bool binary() const { return 1; }
|
||||
int store(const char *to,uint length,CHARSET_INFO *charset);
|
||||
int store(double nr);
|
||||
int store(longlong nr, bool unsigned_val);
|
||||
@ -1341,14 +1359,18 @@ public:
|
||||
CHARSET_INFO *cs)
|
||||
:Field_str(ptr_arg, 8, null_ptr_arg, null_bit_arg,
|
||||
unireg_check_arg, field_name_arg, cs)
|
||||
{}
|
||||
{ flags|= BINARY_FLAG; }
|
||||
Field_time(bool maybe_null_arg, const char *field_name_arg,
|
||||
CHARSET_INFO *cs)
|
||||
:Field_str((uchar*) 0,8, maybe_null_arg ? (uchar*) "": 0,0,
|
||||
NONE, field_name_arg, cs) {}
|
||||
NONE, field_name_arg, cs) { flags|= BINARY_FLAG; }
|
||||
enum_field_types type() const { return MYSQL_TYPE_TIME;}
|
||||
enum ha_base_keytype key_type() const { return HA_KEYTYPE_INT24; }
|
||||
enum Item_result cmp_type () const { return INT_RESULT; }
|
||||
enum Derivation derivation(void) const { return DERIVATION_NUMERIC; }
|
||||
uint repertoire(void) const { return MY_REPERTOIRE_NUMERIC; }
|
||||
CHARSET_INFO *charset(void) const { return &my_charset_numeric; }
|
||||
bool binary() const { return 1; }
|
||||
int store_time(MYSQL_TIME *ltime, timestamp_type type);
|
||||
int store(const char *to,uint length,CHARSET_INFO *charset);
|
||||
int store(double nr);
|
||||
@ -1376,16 +1398,20 @@ public:
|
||||
CHARSET_INFO *cs)
|
||||
:Field_str(ptr_arg, MAX_DATETIME_WIDTH, null_ptr_arg, null_bit_arg,
|
||||
unireg_check_arg, field_name_arg, cs)
|
||||
{}
|
||||
{ flags|= BINARY_FLAG; }
|
||||
Field_datetime(bool maybe_null_arg, const char *field_name_arg,
|
||||
CHARSET_INFO *cs)
|
||||
:Field_str((uchar*) 0, MAX_DATETIME_WIDTH, maybe_null_arg ? (uchar*) "": 0,0,
|
||||
NONE, field_name_arg, cs) {}
|
||||
NONE, field_name_arg, cs) { flags|= BINARY_FLAG; }
|
||||
enum_field_types type() const { return MYSQL_TYPE_DATETIME;}
|
||||
#ifdef HAVE_LONG_LONG
|
||||
enum ha_base_keytype key_type() const { return HA_KEYTYPE_ULONGLONG; }
|
||||
#endif
|
||||
enum Item_result cmp_type () const { return INT_RESULT; }
|
||||
enum Derivation derivation(void) const { return DERIVATION_NUMERIC; }
|
||||
uint repertoire(void) const { return MY_REPERTOIRE_NUMERIC; }
|
||||
CHARSET_INFO *charset(void) const { return &my_charset_numeric; }
|
||||
bool binary() const { return 1; }
|
||||
uint decimals() const { return DATETIME_DEC; }
|
||||
int store(const char *to,uint length,CHARSET_INFO *charset);
|
||||
int store(double nr);
|
||||
|
108
sql/item.cc
108
sql/item.cc
@ -201,6 +201,37 @@ bool Item::val_bool()
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
For the items which don't have its own fast val_str_ascii()
|
||||
implementation we provide a generic slower version,
|
||||
which converts from the Item character set to ASCII.
|
||||
For better performance conversion happens only in
|
||||
case of a "tricky" Item character set (e.g. UCS2).
|
||||
Normally conversion does not happen.
|
||||
*/
|
||||
String *Item::val_str_ascii(String *str)
|
||||
{
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
|
||||
if (!(collation.collation->state & MY_CS_NONASCII))
|
||||
return val_str(str);
|
||||
|
||||
DBUG_ASSERT(str != &str_value);
|
||||
|
||||
uint errors;
|
||||
String *res= val_str(&str_value);
|
||||
if (!res)
|
||||
return 0;
|
||||
|
||||
if ((null_value= str->copy(res->ptr(), res->length(),
|
||||
collation.collation, &my_charset_latin1,
|
||||
&errors)))
|
||||
return 0;
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
|
||||
String *Item::val_string_from_real(String *str)
|
||||
{
|
||||
double nr= val_real();
|
||||
@ -443,10 +474,11 @@ uint Item::decimal_precision() const
|
||||
if ((restype == DECIMAL_RESULT) || (restype == INT_RESULT))
|
||||
{
|
||||
uint prec=
|
||||
my_decimal_length_to_precision(max_length, decimals, unsigned_flag);
|
||||
my_decimal_length_to_precision(max_char_length(), decimals,
|
||||
unsigned_flag);
|
||||
return min(prec, DECIMAL_MAX_PRECISION);
|
||||
}
|
||||
return min(max_length, DECIMAL_MAX_PRECISION);
|
||||
return min(max_char_length(), DECIMAL_MAX_PRECISION);
|
||||
}
|
||||
|
||||
|
||||
@ -783,15 +815,40 @@ Item *Item::safe_charset_converter(CHARSET_INFO *tocs)
|
||||
*/
|
||||
Item *Item_num::safe_charset_converter(CHARSET_INFO *tocs)
|
||||
{
|
||||
/*
|
||||
Item_num returns pure ASCII result,
|
||||
so conversion is needed only in case of "tricky" character
|
||||
sets like UCS2. If tocs is not "tricky", return the item itself.
|
||||
*/
|
||||
if (!(tocs->state & MY_CS_NONASCII))
|
||||
return this;
|
||||
|
||||
Item_string *conv;
|
||||
char buf[64];
|
||||
String *s, tmp(buf, sizeof(buf), &my_charset_bin);
|
||||
s= val_str(&tmp);
|
||||
if ((conv= new Item_string(s->ptr(), s->length(), s->charset())))
|
||||
uint conv_errors;
|
||||
char buf[64], buf2[64];
|
||||
String tmp(buf, sizeof(buf), &my_charset_bin);
|
||||
String cstr(buf2, sizeof(buf2), &my_charset_bin);
|
||||
String *ostr= val_str(&tmp);
|
||||
char *ptr;
|
||||
cstr.copy(ostr->ptr(), ostr->length(), ostr->charset(), tocs, &conv_errors);
|
||||
if (conv_errors || !(conv= new Item_string(cstr.ptr(), cstr.length(),
|
||||
cstr.charset(),
|
||||
collation.derivation)))
|
||||
{
|
||||
conv->str_value.copy();
|
||||
conv->str_value.mark_as_const();
|
||||
/*
|
||||
Safe conversion is not possible (or EOM).
|
||||
We could not convert a string into the requested character set
|
||||
without data loss. The target charset does not cover all the
|
||||
characters from the string. Operation cannot be done correctly.
|
||||
*/
|
||||
return NULL;
|
||||
}
|
||||
if (!(ptr= current_thd->strmake(cstr.ptr(), cstr.length())))
|
||||
return NULL;
|
||||
conv->str_value.set(ptr, cstr.length(), cstr.charset());
|
||||
/* Ensure that no one is going to change the result string */
|
||||
conv->str_value.mark_as_const();
|
||||
conv->fix_char_length(max_char_length());
|
||||
return conv;
|
||||
}
|
||||
|
||||
@ -854,7 +911,7 @@ Item *Item_param::safe_charset_converter(CHARSET_INFO *tocs)
|
||||
cnvitem->max_length= cnvitem->str_value.numchars() * tocs->mbmaxlen;
|
||||
return cnvitem;
|
||||
}
|
||||
return NULL;
|
||||
return Item::safe_charset_converter(tocs);
|
||||
}
|
||||
|
||||
|
||||
@ -910,7 +967,7 @@ bool Item::get_date(MYSQL_TIME *ltime,uint fuzzydate)
|
||||
char buff[40];
|
||||
String tmp(buff,sizeof(buff), &my_charset_bin),*res;
|
||||
if (!(res=val_str(&tmp)) ||
|
||||
str_to_datetime_with_warn(res->ptr(), res->length(),
|
||||
str_to_datetime_with_warn(res->charset(), res->ptr(), res->length(),
|
||||
ltime, fuzzydate) <= MYSQL_TIMESTAMP_ERROR)
|
||||
goto err;
|
||||
}
|
||||
@ -945,8 +1002,8 @@ bool Item::get_time(MYSQL_TIME *ltime)
|
||||
{
|
||||
char buff[40];
|
||||
String tmp(buff,sizeof(buff),&my_charset_bin),*res;
|
||||
if (!(res=val_str(&tmp)) ||
|
||||
str_to_time_with_warn(res->ptr(), res->length(), ltime))
|
||||
if (!(res=val_str_ascii(&tmp)) ||
|
||||
str_to_time_with_warn(res->charset(), res->ptr(), res->length(), ltime))
|
||||
{
|
||||
bzero((char*) ltime,sizeof(*ltime));
|
||||
return 1;
|
||||
@ -1436,7 +1493,12 @@ left_is_superset(DTCollation *left, DTCollation *right)
|
||||
if (left->collation->state & MY_CS_UNICODE &&
|
||||
(left->derivation < right->derivation ||
|
||||
(left->derivation == right->derivation &&
|
||||
!(right->collation->state & MY_CS_UNICODE))))
|
||||
(!(right->collation->state & MY_CS_UNICODE) ||
|
||||
/* The code below makes 4-byte utf8 a superset over 3-byte utf8 */
|
||||
(left->collation->state & MY_CS_UNICODE_SUPPLEMENT &&
|
||||
!(right->collation->state & MY_CS_UNICODE_SUPPLEMENT) &&
|
||||
left->collation->mbmaxlen > right->collation->mbmaxlen &&
|
||||
left->collation->mbminlen == right->collation->mbminlen)))))
|
||||
return TRUE;
|
||||
/* Allow convert from ASCII */
|
||||
if (right->repertoire == MY_REPERTOIRE_ASCII &&
|
||||
@ -1650,6 +1712,11 @@ bool agg_item_collations(DTCollation &c, const char *fname,
|
||||
my_coll_agg_error(av, count, fname, item_sep);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* If all arguments where numbers, reset to @@collation_connection */
|
||||
if (c.derivation == DERIVATION_NUMERIC)
|
||||
c.set(Item::default_charset(), DERIVATION_COERCIBLE, MY_REPERTOIRE_NUMERIC);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -1695,7 +1762,7 @@ bool agg_item_set_converter(DTCollation &coll, const char *fname,
|
||||
{
|
||||
Item* conv;
|
||||
uint32 dummy_offset;
|
||||
if (!String::needs_conversion(0, (*arg)->collation.collation,
|
||||
if (!String::needs_conversion(1, (*arg)->collation.collation,
|
||||
coll.collation,
|
||||
&dummy_offset))
|
||||
continue;
|
||||
@ -1895,13 +1962,14 @@ void Item_field::set_field(Field *field_par)
|
||||
field=result_field=field_par; // for easy coding with fields
|
||||
maybe_null=field->maybe_null();
|
||||
decimals= field->decimals();
|
||||
max_length= field_par->max_display_length();
|
||||
table_name= *field_par->table_name;
|
||||
field_name= field_par->field_name;
|
||||
db_name= field_par->table->s->db.str;
|
||||
alias_name_used= field_par->table->alias_name_used;
|
||||
unsigned_flag=test(field_par->flags & UNSIGNED_FLAG);
|
||||
collation.set(field_par->charset(), field_par->derivation());
|
||||
collation.set(field_par->charset(), field_par->derivation(),
|
||||
field_par->repertoire());
|
||||
fix_char_length(field_par->char_length());
|
||||
fixed= 1;
|
||||
if (field->table->s->tmp_table == SYSTEM_TMP_TABLE)
|
||||
any_privileges= 0;
|
||||
@ -2210,7 +2278,7 @@ String *Item_int::val_str(String *str)
|
||||
{
|
||||
// following assert is redundant, because fixed=1 assigned in constructor
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
str->set_int(value, unsigned_flag, &my_charset_bin);
|
||||
str->set_int(value, unsigned_flag, collation.collation);
|
||||
return str;
|
||||
}
|
||||
|
||||
@ -2240,7 +2308,7 @@ String *Item_uint::val_str(String *str)
|
||||
{
|
||||
// following assert is redundant, because fixed=1 assigned in constructor
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
str->set((ulonglong) value, &my_charset_bin);
|
||||
str->set((ulonglong) value, collation.collation);
|
||||
return str;
|
||||
}
|
||||
|
||||
@ -2340,7 +2408,7 @@ double Item_decimal::val_real()
|
||||
|
||||
String *Item_decimal::val_str(String *result)
|
||||
{
|
||||
result->set_charset(&my_charset_bin);
|
||||
result->set_charset(&my_charset_numeric);
|
||||
my_decimal2string(E_DEC_FATAL_ERROR, &decimal_value, 0, 0, 0, result);
|
||||
return result;
|
||||
}
|
||||
@ -4882,7 +4950,7 @@ void Item::init_make_field(Send_field *tmp_field,
|
||||
tmp_field->col_name= name;
|
||||
tmp_field->charsetnr= collation.collation->number;
|
||||
tmp_field->flags= (maybe_null ? 0 : NOT_NULL_FLAG) |
|
||||
(my_binary_compare(collation.collation) ?
|
||||
(my_binary_compare(charset_for_protocol()) ?
|
||||
BINARY_FLAG : 0);
|
||||
tmp_field->type= field_type_arg;
|
||||
tmp_field->length=max_length;
|
||||
|
131
sql/item.h
131
sql/item.h
@ -44,9 +44,10 @@ class Item_field;
|
||||
|
||||
#define MY_COLL_ALLOW_SUPERSET_CONV 1
|
||||
#define MY_COLL_ALLOW_COERCIBLE_CONV 2
|
||||
#define MY_COLL_ALLOW_CONV 3
|
||||
#define MY_COLL_DISALLOW_NONE 4
|
||||
#define MY_COLL_CMP_CONV 7
|
||||
|
||||
#define MY_COLL_ALLOW_CONV (MY_COLL_ALLOW_SUPERSET_CONV | MY_COLL_ALLOW_COERCIBLE_CONV)
|
||||
#define MY_COLL_CMP_CONV (MY_COLL_ALLOW_CONV | MY_COLL_DISALLOW_NONE)
|
||||
|
||||
class DTCollation {
|
||||
public:
|
||||
@ -91,6 +92,12 @@ public:
|
||||
derivation= derivation_arg;
|
||||
repertoire= repertoire_arg;
|
||||
}
|
||||
void set_numeric()
|
||||
{
|
||||
collation= &my_charset_numeric;
|
||||
derivation= DERIVATION_NUMERIC;
|
||||
repertoire= MY_REPERTOIRE_NUMERIC;
|
||||
}
|
||||
void set(CHARSET_INFO *collation_arg)
|
||||
{
|
||||
collation= collation_arg;
|
||||
@ -105,6 +112,7 @@ public:
|
||||
{
|
||||
switch(derivation)
|
||||
{
|
||||
case DERIVATION_NUMERIC: return "NUMERIC";
|
||||
case DERIVATION_IGNORABLE: return "IGNORABLE";
|
||||
case DERIVATION_COERCIBLE: return "COERCIBLE";
|
||||
case DERIVATION_IMPLICIT: return "IMPLICIT";
|
||||
@ -690,6 +698,77 @@ public:
|
||||
If value is not null null_value flag will be reset to FALSE.
|
||||
*/
|
||||
virtual String *val_str(String *str)=0;
|
||||
|
||||
/*
|
||||
Returns string representation of this item in ASCII format.
|
||||
|
||||
SYNOPSIS
|
||||
val_str_ascii()
|
||||
str - similar to val_str();
|
||||
|
||||
NOTE
|
||||
This method is introduced for performance optimization purposes.
|
||||
|
||||
1. val_str() result of some Items in string context
|
||||
depends on @@character_set_results.
|
||||
@@character_set_results can be set to a "real multibyte" character
|
||||
set like UCS2, UTF16, UTF32. (We'll use only UTF32 in the examples
|
||||
below for convenience.)
|
||||
|
||||
So the default string result of such functions
|
||||
in these circumstances is real multi-byte character set, like UTF32.
|
||||
|
||||
For example, all numbers in string context
|
||||
return result in @@character_set_results:
|
||||
|
||||
SELECT CONCAT(20010101); -> UTF32
|
||||
|
||||
We do sprintf() first (to get ASCII representation)
|
||||
and then convert to UTF32;
|
||||
|
||||
So these kind "data sources" can use ASCII representation
|
||||
internally, but return multi-byte data only because
|
||||
@@character_set_results wants so.
|
||||
Therefore, conversion from ASCII to UTF32 is applied internally.
|
||||
|
||||
|
||||
2. Some other functions need in fact ASCII input.
|
||||
|
||||
For example,
|
||||
inet_aton(), GeometryFromText(), Convert_TZ(), GET_FORMAT().
|
||||
|
||||
Similar, fields of certain type, like DATE, TIME,
|
||||
when you insert string data into them, expect in fact ASCII input.
|
||||
If they get non-ASCII input, for example UTF32, they
|
||||
convert input from UTF32 to ASCII, and then use ASCII
|
||||
representation to do further processing.
|
||||
|
||||
|
||||
3. Now imagine we pass result of a data source of the first type
|
||||
to a data destination of the second type.
|
||||
|
||||
What happens:
|
||||
a. data source converts data from ASCII to UTF32, because
|
||||
@@character_set_results wants so and passes the result to
|
||||
data destination.
|
||||
b. data destination gets UTF32 string.
|
||||
c. data destination converts UTF32 string to ASCII,
|
||||
because it needs ASCII representation to be able to handle data
|
||||
correctly.
|
||||
|
||||
As a result we get two steps of unnecessary conversion:
|
||||
From ASCII to UTF32, then from UTF32 to ASCII.
|
||||
|
||||
A better way to handle these situations is to pass ASCII
|
||||
representation directly from the source to the destination.
|
||||
|
||||
This is why val_str_ascii() introduced.
|
||||
|
||||
RETURN
|
||||
Similar to val_str()
|
||||
*/
|
||||
virtual String *val_str_ascii(String *str);
|
||||
|
||||
/*
|
||||
Return decimal representation of item with fixed point.
|
||||
|
||||
@ -864,6 +943,16 @@ public:
|
||||
static CHARSET_INFO *default_charset();
|
||||
virtual CHARSET_INFO *compare_collation() { return NULL; }
|
||||
|
||||
/*
|
||||
For backward compatibility, to make numeric
|
||||
data types return "binary" charset in client-side metadata.
|
||||
*/
|
||||
virtual CHARSET_INFO *charset_for_protocol(void) const
|
||||
{
|
||||
return result_type() == STRING_RESULT ? collation.collation :
|
||||
&my_charset_bin;
|
||||
};
|
||||
|
||||
virtual bool walk(Item_processor processor, bool walk_subquery, uchar *arg)
|
||||
{
|
||||
return (this->*processor)(arg);
|
||||
@ -1070,6 +1159,20 @@ public:
|
||||
{ return Field::GEOM_GEOMETRY; };
|
||||
String *check_well_formed_result(String *str, bool send_error= 0);
|
||||
bool eq_by_collation(Item *item, bool binary_cmp, CHARSET_INFO *cs);
|
||||
uint32 max_char_length() const
|
||||
{ return max_length / collation.collation->mbmaxlen; }
|
||||
void fix_length_and_charset(uint32 max_char_length_arg, CHARSET_INFO *cs)
|
||||
{
|
||||
max_length= max_char_length_arg * cs->mbmaxlen;
|
||||
collation.collation= cs;
|
||||
}
|
||||
void fix_char_length(uint32 max_char_length_arg)
|
||||
{ max_length= max_char_length_arg * collation.collation->mbmaxlen; }
|
||||
void fix_length_and_charset_datetime(uint32 max_char_length_arg)
|
||||
{
|
||||
collation.set(&my_charset_numeric, DERIVATION_NUMERIC, MY_REPERTOIRE_ASCII);
|
||||
fix_char_length(max_char_length_arg);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -1372,12 +1475,30 @@ bool agg_item_set_converter(DTCollation &coll, const char *fname,
|
||||
Item **args, uint nargs, uint flags, int item_sep);
|
||||
bool agg_item_charsets(DTCollation &c, const char *name,
|
||||
Item **items, uint nitems, uint flags, int item_sep);
|
||||
|
||||
inline bool
|
||||
agg_item_charsets_for_string_result(DTCollation &c, const char *name,
|
||||
Item **items, uint nitems,
|
||||
int item_sep= 1)
|
||||
{
|
||||
uint flags= MY_COLL_ALLOW_SUPERSET_CONV |
|
||||
MY_COLL_ALLOW_COERCIBLE_CONV;
|
||||
return agg_item_charsets(c, name, items, nitems, flags, item_sep);
|
||||
}
|
||||
inline bool
|
||||
agg_item_charsets_for_comparison(DTCollation &c, const char *name,
|
||||
Item **items, uint nitems,
|
||||
int item_sep= 1)
|
||||
{
|
||||
uint flags= MY_COLL_ALLOW_SUPERSET_CONV |
|
||||
MY_COLL_ALLOW_COERCIBLE_CONV |
|
||||
MY_COLL_DISALLOW_NONE;
|
||||
return agg_item_charsets(c, name, items, nitems, flags, item_sep);
|
||||
}
|
||||
|
||||
class Item_num: public Item_basic_constant
|
||||
{
|
||||
public:
|
||||
Item_num() {} /* Remove gcc warning */
|
||||
Item_num() { collation.set_numeric(); } /* Remove gcc warning */
|
||||
virtual Item_num *neg()= 0;
|
||||
Item *safe_charset_converter(CHARSET_INFO *tocs);
|
||||
bool check_partition_func_processor(uchar *int_arg) { return FALSE;}
|
||||
@ -1562,6 +1683,8 @@ public:
|
||||
DBUG_ASSERT(field_type() == MYSQL_TYPE_GEOMETRY);
|
||||
return field->get_geometry_type();
|
||||
}
|
||||
CHARSET_INFO *charset_for_protocol(void) const
|
||||
{ return field->charset_for_protocol(); }
|
||||
friend class Item_default_value;
|
||||
friend class Item_insert_value;
|
||||
friend class st_select_lex_unit;
|
||||
|
@ -483,7 +483,7 @@ void Item_bool_func2::fix_length_and_dec()
|
||||
DTCollation coll;
|
||||
if (args[0]->result_type() == STRING_RESULT &&
|
||||
args[1]->result_type() == STRING_RESULT &&
|
||||
agg_arg_charsets(coll, args, 2, MY_COLL_CMP_CONV, 1))
|
||||
agg_arg_charsets_for_comparison(coll, args, 2))
|
||||
return;
|
||||
|
||||
args[0]->cmp_context= args[1]->cmp_context=
|
||||
@ -934,6 +934,7 @@ int Arg_comparator::set_cmp_func(Item_result_field *owner_arg,
|
||||
func= &Arg_comparator::compare_datetime;
|
||||
get_value_a_func= &get_datetime_value;
|
||||
get_value_b_func= &get_datetime_value;
|
||||
cmp_collation.set(&my_charset_numeric);
|
||||
return 0;
|
||||
}
|
||||
else if (type == STRING_RESULT && (*a)->field_type() == MYSQL_TYPE_TIME &&
|
||||
@ -2173,7 +2174,7 @@ void Item_func_between::fix_length_and_dec()
|
||||
if ( agg_cmp_type(&cmp_type, args, 3))
|
||||
return;
|
||||
if (cmp_type == STRING_RESULT &&
|
||||
agg_arg_charsets(cmp_collation, args, 3, MY_COLL_CMP_CONV, 1))
|
||||
agg_arg_charsets_for_comparison(cmp_collation, args, 3))
|
||||
return;
|
||||
|
||||
/*
|
||||
@ -2374,7 +2375,7 @@ Item_func_ifnull::fix_length_and_dec()
|
||||
|
||||
switch (hybrid_type) {
|
||||
case STRING_RESULT:
|
||||
agg_arg_charsets(collation, args, arg_count, MY_COLL_CMP_CONV, 1);
|
||||
agg_arg_charsets_for_comparison(collation, args, arg_count);
|
||||
break;
|
||||
case DECIMAL_RESULT:
|
||||
case REAL_RESULT:
|
||||
@ -2549,12 +2550,12 @@ Item_func_if::fix_length_and_dec()
|
||||
agg_result_type(&cached_result_type, args+1, 2);
|
||||
if (cached_result_type == STRING_RESULT)
|
||||
{
|
||||
if (agg_arg_charsets(collation, args+1, 2, MY_COLL_ALLOW_CONV, 1))
|
||||
if (agg_arg_charsets_for_string_result(collation, args + 1, 2))
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
collation.set(&my_charset_bin); // Number
|
||||
collation.set_numeric(); // Number
|
||||
}
|
||||
cached_field_type= agg_field_type(args + 1, 2);
|
||||
}
|
||||
@ -2640,7 +2641,7 @@ Item_func_nullif::fix_length_and_dec()
|
||||
unsigned_flag= args[0]->unsigned_flag;
|
||||
cached_result_type= args[0]->result_type();
|
||||
if (cached_result_type == STRING_RESULT &&
|
||||
agg_arg_charsets(collation, args, arg_count, MY_COLL_CMP_CONV, 1))
|
||||
agg_arg_charsets_for_comparison(collation, args, arg_count))
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -2915,9 +2916,13 @@ void Item_func_case::fix_length_and_dec()
|
||||
agg[nagg++]= args[else_expr_num];
|
||||
|
||||
agg_result_type(&cached_result_type, agg, nagg);
|
||||
if ((cached_result_type == STRING_RESULT) &&
|
||||
agg_arg_charsets(collation, agg, nagg, MY_COLL_ALLOW_CONV, 1))
|
||||
return;
|
||||
if (cached_result_type == STRING_RESULT)
|
||||
{
|
||||
if (agg_arg_charsets_for_string_result(collation, agg, nagg))
|
||||
return;
|
||||
}
|
||||
else
|
||||
collation.set_numeric();
|
||||
|
||||
cached_field_type= agg_field_type(agg, nagg);
|
||||
/*
|
||||
@ -2942,7 +2947,7 @@ void Item_func_case::fix_length_and_dec()
|
||||
{
|
||||
DBUG_ASSERT((Item_result)i != ROW_RESULT);
|
||||
if ((Item_result)i == STRING_RESULT &&
|
||||
agg_arg_charsets(cmp_collation, agg, nagg, MY_COLL_CMP_CONV, 1))
|
||||
agg_arg_charsets_for_comparison(cmp_collation, agg, nagg))
|
||||
return;
|
||||
if (!(cmp_items[i]=
|
||||
cmp_item::get_comparator((Item_result)i,
|
||||
@ -3105,7 +3110,7 @@ void Item_func_coalesce::fix_length_and_dec()
|
||||
case STRING_RESULT:
|
||||
count_only_length();
|
||||
decimals= NOT_FIXED_DEC;
|
||||
agg_arg_charsets(collation, args, arg_count, MY_COLL_ALLOW_CONV, 1);
|
||||
agg_arg_charsets_for_string_result(collation, args, arg_count);
|
||||
break;
|
||||
case DECIMAL_RESULT:
|
||||
count_decimal_length();
|
||||
@ -3750,7 +3755,7 @@ void Item_func_in::fix_length_and_dec()
|
||||
if (type_cnt == 1)
|
||||
{
|
||||
if (cmp_type == STRING_RESULT &&
|
||||
agg_arg_charsets(cmp_collation, args, arg_count, MY_COLL_CMP_CONV, 1))
|
||||
agg_arg_charsets_for_comparison(cmp_collation, args, arg_count))
|
||||
return;
|
||||
arg_types_compatible= TRUE;
|
||||
}
|
||||
@ -3928,8 +3933,7 @@ void Item_func_in::fix_length_and_dec()
|
||||
if (found_types & (1 << i) && !cmp_items[i])
|
||||
{
|
||||
if ((Item_result)i == STRING_RESULT &&
|
||||
agg_arg_charsets(cmp_collation, args, arg_count,
|
||||
MY_COLL_CMP_CONV, 1))
|
||||
agg_arg_charsets_for_comparison(cmp_collation, args, arg_count))
|
||||
return;
|
||||
if (!cmp_items[i] && !(cmp_items[i]=
|
||||
cmp_item::get_comparator((Item_result)i,
|
||||
@ -4758,7 +4762,7 @@ Item_func_regex::fix_fields(THD *thd, Item **ref)
|
||||
max_length= 1;
|
||||
decimals= 0;
|
||||
|
||||
if (agg_arg_charsets(cmp_collation, args, 2, MY_COLL_CMP_CONV, 1))
|
||||
if (agg_arg_charsets_for_comparison(cmp_collation, args, 2))
|
||||
return TRUE;
|
||||
|
||||
regex_lib_flags= (cmp_collation.collation->state &
|
||||
|
@ -637,6 +637,11 @@ public:
|
||||
{
|
||||
Item_func::print(str, query_type);
|
||||
}
|
||||
void fix_length_and_dec()
|
||||
{
|
||||
Item_bool_func2::fix_length_and_dec();
|
||||
fix_char_length(2); // returns "1" or "0" or "-1"
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
101
sql/item_func.cc
101
sql/item_func.cc
@ -438,13 +438,15 @@ Field *Item_func::tmp_table_field(TABLE *table)
|
||||
|
||||
switch (result_type()) {
|
||||
case INT_RESULT:
|
||||
if (max_length > MY_INT32_NUM_DECIMAL_DIGITS)
|
||||
field= new Field_longlong(max_length, maybe_null, name, unsigned_flag);
|
||||
if (max_char_length() > MY_INT32_NUM_DECIMAL_DIGITS)
|
||||
field= new Field_longlong(max_char_length(), maybe_null, name,
|
||||
unsigned_flag);
|
||||
else
|
||||
field= new Field_long(max_length, maybe_null, name, unsigned_flag);
|
||||
field= new Field_long(max_char_length(), maybe_null, name,
|
||||
unsigned_flag);
|
||||
break;
|
||||
case REAL_RESULT:
|
||||
field= new Field_double(max_length, maybe_null, name, decimals);
|
||||
field= new Field_double(max_char_length(), maybe_null, name, decimals);
|
||||
break;
|
||||
case STRING_RESULT:
|
||||
return make_string_field(table);
|
||||
@ -485,7 +487,7 @@ String *Item_real_func::val_str(String *str)
|
||||
double nr= val_real();
|
||||
if (null_value)
|
||||
return 0; /* purecov: inspected */
|
||||
str->set_real(nr,decimals, &my_charset_bin);
|
||||
str->set_real(nr, decimals, collation.collation);
|
||||
return str;
|
||||
}
|
||||
|
||||
@ -624,7 +626,7 @@ String *Item_int_func::val_str(String *str)
|
||||
longlong nr=val_int();
|
||||
if (null_value)
|
||||
return 0;
|
||||
str->set_int(nr, unsigned_flag, &my_charset_bin);
|
||||
str->set_int(nr, unsigned_flag, collation.collation);
|
||||
return str;
|
||||
}
|
||||
|
||||
@ -744,6 +746,7 @@ String *Item_func_numhybrid::val_str(String *str)
|
||||
if (!(val= decimal_op(&decimal_value)))
|
||||
return 0; // null is set
|
||||
my_decimal_round(E_DEC_FATAL_ERROR, val, decimals, FALSE, val);
|
||||
str->set_charset(collation.collation);
|
||||
my_decimal2string(E_DEC_FATAL_ERROR, val, 0, 0, 0, str);
|
||||
break;
|
||||
}
|
||||
@ -752,7 +755,7 @@ String *Item_func_numhybrid::val_str(String *str)
|
||||
longlong nr= int_op();
|
||||
if (null_value)
|
||||
return 0; /* purecov: inspected */
|
||||
str->set_int(nr, unsigned_flag, &my_charset_bin);
|
||||
str->set_int(nr, unsigned_flag, collation.collation);
|
||||
break;
|
||||
}
|
||||
case REAL_RESULT:
|
||||
@ -760,7 +763,7 @@ String *Item_func_numhybrid::val_str(String *str)
|
||||
double nr= real_op();
|
||||
if (null_value)
|
||||
return 0; /* purecov: inspected */
|
||||
str->set_real(nr,decimals,&my_charset_bin);
|
||||
str->set_real(nr, decimals, collation.collation);
|
||||
break;
|
||||
}
|
||||
case STRING_RESULT:
|
||||
@ -895,6 +898,7 @@ longlong Item_func_signed::val_int_from_str(int *error)
|
||||
uint32 length;
|
||||
String tmp(buff,sizeof(buff), &my_charset_bin), *res;
|
||||
longlong value;
|
||||
CHARSET_INFO *cs;
|
||||
|
||||
/*
|
||||
For a string result, we must first get the string and then convert it
|
||||
@ -910,9 +914,10 @@ longlong Item_func_signed::val_int_from_str(int *error)
|
||||
null_value= 0;
|
||||
start= (char *)res->ptr();
|
||||
length= res->length();
|
||||
cs= res->charset();
|
||||
|
||||
end= start + length;
|
||||
value= my_strtoll10(start, &end, error);
|
||||
value= cs->cset->strtoll10(cs, start, &end, error);
|
||||
if (*error > 0 || end != start+ length)
|
||||
{
|
||||
char err_buff[128];
|
||||
@ -2263,7 +2268,7 @@ void Item_func_min_max::fix_length_and_dec()
|
||||
}
|
||||
if (cmp_type == STRING_RESULT)
|
||||
{
|
||||
agg_arg_charsets(collation, args, arg_count, MY_COLL_CMP_CONV, 1);
|
||||
agg_arg_charsets_for_comparison(collation, args, arg_count);
|
||||
if (datetime_found)
|
||||
{
|
||||
thd= current_thd;
|
||||
@ -2271,9 +2276,13 @@ void Item_func_min_max::fix_length_and_dec()
|
||||
}
|
||||
}
|
||||
else if ((cmp_type == DECIMAL_RESULT) || (cmp_type == INT_RESULT))
|
||||
max_length= my_decimal_precision_to_length_no_truncation(max_int_part +
|
||||
decimals, decimals,
|
||||
unsigned_flag);
|
||||
{
|
||||
collation.set_numeric();
|
||||
fix_char_length(my_decimal_precision_to_length_no_truncation(max_int_part +
|
||||
decimals,
|
||||
decimals,
|
||||
unsigned_flag));
|
||||
}
|
||||
cached_field_type= agg_field_type(args, arg_count);
|
||||
}
|
||||
|
||||
@ -2343,7 +2352,7 @@ String *Item_func_min_max::val_str(String *str)
|
||||
longlong nr=val_int();
|
||||
if (null_value)
|
||||
return 0;
|
||||
str->set_int(nr, unsigned_flag, &my_charset_bin);
|
||||
str->set_int(nr, unsigned_flag, collation.collation);
|
||||
return str;
|
||||
}
|
||||
case DECIMAL_RESULT:
|
||||
@ -2359,7 +2368,7 @@ String *Item_func_min_max::val_str(String *str)
|
||||
double nr= val_real();
|
||||
if (null_value)
|
||||
return 0; /* purecov: inspected */
|
||||
str->set_real(nr,decimals,&my_charset_bin);
|
||||
str->set_real(nr, decimals, collation.collation);
|
||||
return str;
|
||||
}
|
||||
case STRING_RESULT:
|
||||
@ -2530,7 +2539,7 @@ longlong Item_func_coercibility::val_int()
|
||||
void Item_func_locate::fix_length_and_dec()
|
||||
{
|
||||
max_length= MY_INT32_NUM_DECIMAL_DIGITS;
|
||||
agg_arg_charsets(cmp_collation, args, 2, MY_COLL_CMP_CONV, 1);
|
||||
agg_arg_charsets_for_comparison(cmp_collation, args, 2);
|
||||
}
|
||||
|
||||
|
||||
@ -2654,7 +2663,7 @@ void Item_func_field::fix_length_and_dec()
|
||||
for (uint i=1; i < arg_count ; i++)
|
||||
cmp_type= item_cmp_type(cmp_type, args[i]->result_type());
|
||||
if (cmp_type == STRING_RESULT)
|
||||
agg_arg_charsets(cmp_collation, args, arg_count, MY_COLL_CMP_CONV, 1);
|
||||
agg_arg_charsets_for_comparison(cmp_collation, args, arg_count);
|
||||
}
|
||||
|
||||
|
||||
@ -2721,7 +2730,7 @@ void Item_func_find_in_set::fix_length_and_dec()
|
||||
}
|
||||
}
|
||||
}
|
||||
agg_arg_charsets(cmp_collation, args, 2, MY_COLL_CMP_CONV, 1);
|
||||
agg_arg_charsets_for_comparison(cmp_collation, args, 2);
|
||||
}
|
||||
|
||||
static const char separator=',';
|
||||
@ -3960,7 +3969,9 @@ bool Item_func_set_user_var::fix_fields(THD *thd, Item **ref)
|
||||
*/
|
||||
null_item= (args[0]->type() == NULL_ITEM);
|
||||
if (!entry->collation.collation || !null_item)
|
||||
entry->collation.set(args[0]->collation.collation, DERIVATION_IMPLICIT);
|
||||
entry->collation.set(args[0]->collation.derivation == DERIVATION_NUMERIC ?
|
||||
default_charset() : args[0]->collation.collation,
|
||||
DERIVATION_IMPLICIT);
|
||||
collation.set(entry->collation.collation, DERIVATION_IMPLICIT);
|
||||
cached_result_type= args[0]->result_type();
|
||||
return FALSE;
|
||||
@ -3971,9 +3982,15 @@ void
|
||||
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.collation, DERIVATION_IMPLICIT);
|
||||
collation.set(DERIVATION_IMPLICIT);
|
||||
if (args[0]->collation.derivation == DERIVATION_NUMERIC)
|
||||
fix_length_and_charset(args[0]->max_char_length(), default_charset());
|
||||
else
|
||||
{
|
||||
fix_length_and_charset(args[0]->max_char_length(),
|
||||
args[0]->collation.collation);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -4168,16 +4185,16 @@ String *user_var_entry::val_str(my_bool *null_value, String *str,
|
||||
|
||||
switch (type) {
|
||||
case REAL_RESULT:
|
||||
str->set_real(*(double*) value, decimals, &my_charset_bin);
|
||||
str->set_real(*(double*) value, decimals, collation.collation);
|
||||
break;
|
||||
case INT_RESULT:
|
||||
if (!unsigned_flag)
|
||||
str->set(*(longlong*) value, &my_charset_bin);
|
||||
str->set(*(longlong*) value, collation.collation);
|
||||
else
|
||||
str->set(*(ulonglong*) value, &my_charset_bin);
|
||||
str->set(*(ulonglong*) value, collation.collation);
|
||||
break;
|
||||
case DECIMAL_RESULT:
|
||||
my_decimal2string(E_DEC_FATAL_ERROR, (my_decimal *)value, 0, 0, 0, str);
|
||||
str_set_decimal((my_decimal *) value, str, collation.collation);
|
||||
break;
|
||||
case STRING_RESULT:
|
||||
if (str->copy(value, length, collation.collation))
|
||||
@ -4335,13 +4352,13 @@ Item_func_set_user_var::update()
|
||||
case REAL_RESULT:
|
||||
{
|
||||
res= update_hash((void*) &save_result.vreal,sizeof(save_result.vreal),
|
||||
REAL_RESULT, &my_charset_bin, DERIVATION_IMPLICIT, 0);
|
||||
REAL_RESULT, default_charset(), DERIVATION_IMPLICIT, 0);
|
||||
break;
|
||||
}
|
||||
case INT_RESULT:
|
||||
{
|
||||
res= update_hash((void*) &save_result.vint, sizeof(save_result.vint),
|
||||
INT_RESULT, &my_charset_bin, DERIVATION_IMPLICIT,
|
||||
INT_RESULT, default_charset(), DERIVATION_IMPLICIT,
|
||||
unsigned_flag);
|
||||
break;
|
||||
}
|
||||
@ -4365,7 +4382,7 @@ Item_func_set_user_var::update()
|
||||
else
|
||||
res= update_hash((void*) save_result.vdec,
|
||||
sizeof(my_decimal), DECIMAL_RESULT,
|
||||
&my_charset_bin, DERIVATION_IMPLICIT, 0);
|
||||
default_charset(), DERIVATION_IMPLICIT, 0);
|
||||
break;
|
||||
}
|
||||
case ROW_RESULT:
|
||||
@ -4798,17 +4815,17 @@ void Item_func_get_user_var::fix_length_and_dec()
|
||||
collation.set(var_entry->collation);
|
||||
switch(m_cached_result_type) {
|
||||
case REAL_RESULT:
|
||||
max_length= DBL_DIG + 8;
|
||||
fix_char_length(DBL_DIG + 8);
|
||||
break;
|
||||
case INT_RESULT:
|
||||
max_length= MAX_BIGINT_WIDTH;
|
||||
fix_char_length(MAX_BIGINT_WIDTH);
|
||||
decimals=0;
|
||||
break;
|
||||
case STRING_RESULT:
|
||||
max_length= MAX_BLOB_WIDTH;
|
||||
break;
|
||||
case DECIMAL_RESULT:
|
||||
max_length= DECIMAL_MAX_STR_LENGTH;
|
||||
fix_char_length(DECIMAL_MAX_STR_LENGTH);
|
||||
decimals= DECIMAL_MAX_SCALE;
|
||||
break;
|
||||
case ROW_RESULT: // Keep compiler happy
|
||||
@ -4994,12 +5011,14 @@ void Item_func_get_system_var::fix_length_and_dec()
|
||||
case SHOW_INT:
|
||||
case SHOW_HA_ROWS:
|
||||
unsigned_flag= TRUE;
|
||||
max_length= MY_INT64_NUM_DECIMAL_DIGITS;
|
||||
collation.set_numeric();
|
||||
fix_char_length(MY_INT64_NUM_DECIMAL_DIGITS);
|
||||
decimals=0;
|
||||
break;
|
||||
case SHOW_LONGLONG:
|
||||
unsigned_flag= TRUE;
|
||||
max_length= MY_INT64_NUM_DECIMAL_DIGITS;
|
||||
collation.set_numeric();
|
||||
fix_char_length(MY_INT64_NUM_DECIMAL_DIGITS);
|
||||
decimals=0;
|
||||
break;
|
||||
case SHOW_CHAR:
|
||||
@ -5033,13 +5052,15 @@ void Item_func_get_system_var::fix_length_and_dec()
|
||||
case SHOW_BOOL:
|
||||
case SHOW_MY_BOOL:
|
||||
unsigned_flag= FALSE;
|
||||
max_length= 1;
|
||||
collation.set_numeric();
|
||||
fix_char_length(1);
|
||||
decimals=0;
|
||||
break;
|
||||
case SHOW_DOUBLE:
|
||||
unsigned_flag= FALSE;
|
||||
decimals= 6;
|
||||
max_length= DBL_DIG + 6;
|
||||
collation.set_numeric();
|
||||
fix_char_length(DBL_DIG + 6);
|
||||
break;
|
||||
default:
|
||||
my_error(ER_VAR_CANT_BE_READ, MYF(0), var->name.str);
|
||||
@ -5401,8 +5422,8 @@ longlong Item_func_inet_aton::val_int()
|
||||
char buff[36];
|
||||
int dot_count= 0;
|
||||
|
||||
String *s,tmp(buff,sizeof(buff),&my_charset_bin);
|
||||
if (!(s = args[0]->val_str(&tmp))) // If null value
|
||||
String *s, tmp(buff, sizeof(buff), &my_charset_latin1);
|
||||
if (!(s = args[0]->val_str_ascii(&tmp))) // If null value
|
||||
goto err;
|
||||
null_value=0;
|
||||
|
||||
@ -5410,7 +5431,7 @@ longlong Item_func_inet_aton::val_int()
|
||||
while (p < end)
|
||||
{
|
||||
c = *p++;
|
||||
int digit = (int) (c - '0'); // Assume ascii
|
||||
int digit = (int) (c - '0');
|
||||
if (digit >= 0 && digit <= 9)
|
||||
{
|
||||
if ((byte_result = byte_result * 10 + digit) > 255)
|
||||
@ -5560,8 +5581,8 @@ bool Item_func_match::fix_fields(THD *thd, Item **ref)
|
||||
return 1;
|
||||
}
|
||||
table->fulltext_searched=1;
|
||||
return agg_arg_collations_for_comparison(cmp_collation,
|
||||
args+1, arg_count-1, 0);
|
||||
return agg_item_collations_for_comparison(cmp_collation, func_name(),
|
||||
args+1, arg_count-1, 0);
|
||||
}
|
||||
|
||||
bool Item_func_match::fix_index()
|
||||
|
@ -160,23 +160,25 @@ public:
|
||||
|
||||
my_decimal *val_decimal(my_decimal *);
|
||||
|
||||
bool agg_arg_collations(DTCollation &c, Item **items, uint nitems,
|
||||
uint flags)
|
||||
{
|
||||
return agg_item_collations(c, func_name(), items, nitems, flags, 1);
|
||||
}
|
||||
bool agg_arg_collations_for_comparison(DTCollation &c,
|
||||
Item **items, uint nitems,
|
||||
uint flags)
|
||||
{
|
||||
return agg_item_collations_for_comparison(c, func_name(),
|
||||
items, nitems, flags);
|
||||
}
|
||||
bool agg_arg_charsets(DTCollation &c, Item **items, uint nitems,
|
||||
uint flags, int item_sep)
|
||||
{
|
||||
return agg_item_charsets(c, func_name(), items, nitems, flags, item_sep);
|
||||
}
|
||||
bool agg_arg_charsets_for_string_result(DTCollation &c,
|
||||
Item **items, uint nitems,
|
||||
int item_sep= 1)
|
||||
{
|
||||
return agg_item_charsets_for_string_result(c, func_name(),
|
||||
items, nitems, item_sep);
|
||||
}
|
||||
bool agg_arg_charsets_for_comparison(DTCollation &c,
|
||||
Item **items, uint nitems,
|
||||
int item_sep= 1)
|
||||
{
|
||||
return agg_item_charsets_for_comparison(c, func_name(),
|
||||
items, nitems, item_sep);
|
||||
}
|
||||
bool walk(Item_processor processor, bool walk_subquery, uchar *arg);
|
||||
Item *transform(Item_transformer transformer, uchar *arg);
|
||||
Item* compile(Item_analyzer analyzer, uchar **arg_p,
|
||||
@ -226,10 +228,10 @@ public:
|
||||
class Item_real_func :public Item_func
|
||||
{
|
||||
public:
|
||||
Item_real_func() :Item_func() {}
|
||||
Item_real_func(Item *a) :Item_func(a) {}
|
||||
Item_real_func(Item *a,Item *b) :Item_func(a,b) {}
|
||||
Item_real_func(List<Item> &list) :Item_func(list) {}
|
||||
Item_real_func() :Item_func() { collation.set_numeric(); }
|
||||
Item_real_func(Item *a) :Item_func(a) { collation.set_numeric(); }
|
||||
Item_real_func(Item *a,Item *b) :Item_func(a,b) { collation.set_numeric(); }
|
||||
Item_real_func(List<Item> &list) :Item_func(list) { collation.set_numeric(); }
|
||||
String *val_str(String*str);
|
||||
my_decimal *val_decimal(my_decimal *decimal_value);
|
||||
longlong val_int()
|
||||
@ -246,13 +248,13 @@ protected:
|
||||
Item_result hybrid_type;
|
||||
public:
|
||||
Item_func_numhybrid(Item *a) :Item_func(a), hybrid_type(REAL_RESULT)
|
||||
{}
|
||||
{ collation.set_numeric(); }
|
||||
Item_func_numhybrid(Item *a,Item *b)
|
||||
:Item_func(a,b), hybrid_type(REAL_RESULT)
|
||||
{}
|
||||
{ collation.set_numeric(); }
|
||||
Item_func_numhybrid(List<Item> &list)
|
||||
:Item_func(list), hybrid_type(REAL_RESULT)
|
||||
{}
|
||||
{ collation.set_numeric(); }
|
||||
|
||||
enum Item_result result_type () const { return hybrid_type; }
|
||||
void fix_length_and_dec();
|
||||
@ -335,13 +337,18 @@ class Item_num_op :public Item_func_numhybrid
|
||||
class Item_int_func :public Item_func
|
||||
{
|
||||
public:
|
||||
Item_int_func() :Item_func() { max_length= 21; }
|
||||
Item_int_func(Item *a) :Item_func(a) { max_length= 21; }
|
||||
Item_int_func(Item *a,Item *b) :Item_func(a,b) { max_length= 21; }
|
||||
Item_int_func() :Item_func()
|
||||
{ collation.set_numeric(); fix_char_length(21); }
|
||||
Item_int_func(Item *a) :Item_func(a)
|
||||
{ collation.set_numeric(); fix_char_length(21); }
|
||||
Item_int_func(Item *a,Item *b) :Item_func(a,b)
|
||||
{ collation.set_numeric(); fix_char_length(21); }
|
||||
Item_int_func(Item *a,Item *b,Item *c) :Item_func(a,b,c)
|
||||
{ max_length= 21; }
|
||||
Item_int_func(List<Item> &list) :Item_func(list) { max_length= 21; }
|
||||
Item_int_func(THD *thd, Item_int_func *item) :Item_func(thd, item) {}
|
||||
{ collation.set_numeric(); fix_char_length(21); }
|
||||
Item_int_func(List<Item> &list) :Item_func(list)
|
||||
{ collation.set_numeric(); fix_char_length(21); }
|
||||
Item_int_func(THD *thd, Item_int_func *item) :Item_func(thd, item)
|
||||
{ collation.set_numeric(); }
|
||||
double val_real();
|
||||
String *val_str(String*str);
|
||||
enum Item_result result_type () const { return INT_RESULT; }
|
||||
@ -370,7 +377,7 @@ public:
|
||||
longlong val_int();
|
||||
longlong val_int_from_str(int *error);
|
||||
void fix_length_and_dec()
|
||||
{ max_length=args[0]->max_length; unsigned_flag=0; }
|
||||
{ fix_char_length(args[0]->max_char_length()); unsigned_flag=0; }
|
||||
virtual void print(String *str, enum_query_type query_type);
|
||||
uint decimal_precision() const { return args[0]->decimal_precision(); }
|
||||
};
|
||||
@ -383,7 +390,8 @@ public:
|
||||
const char *func_name() const { return "cast_as_unsigned"; }
|
||||
void fix_length_and_dec()
|
||||
{
|
||||
max_length= min(args[0]->max_length, DECIMAL_MAX_PRECISION + 2);
|
||||
fix_char_length(min(args[0]->max_char_length(),
|
||||
DECIMAL_MAX_PRECISION + 2));
|
||||
unsigned_flag=1;
|
||||
}
|
||||
longlong val_int();
|
||||
@ -398,8 +406,9 @@ public:
|
||||
Item_decimal_typecast(Item *a, int len, int dec) :Item_func(a)
|
||||
{
|
||||
decimals= dec;
|
||||
max_length= my_decimal_precision_to_length_no_truncation(len, dec,
|
||||
unsigned_flag);
|
||||
collation.set_numeric();
|
||||
fix_char_length(my_decimal_precision_to_length_no_truncation(len, dec,
|
||||
unsigned_flag));
|
||||
}
|
||||
String *val_str(String *str);
|
||||
double val_real();
|
||||
|
@ -52,7 +52,7 @@ String *Item_func_geometry_from_text::val_str(String *str)
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
Geometry_buffer buffer;
|
||||
String arg_val;
|
||||
String *wkt= args[0]->val_str(&arg_val);
|
||||
String *wkt= args[0]->val_str_ascii(&arg_val);
|
||||
|
||||
if ((null_value= args[0]->null_value))
|
||||
return 0;
|
||||
@ -110,7 +110,7 @@ String *Item_func_geometry_from_wkb::val_str(String *str)
|
||||
}
|
||||
|
||||
|
||||
String *Item_func_as_wkt::val_str(String *str)
|
||||
String *Item_func_as_wkt::val_str_ascii(String *str)
|
||||
{
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
String arg_val;
|
||||
@ -134,6 +134,7 @@ String *Item_func_as_wkt::val_str(String *str)
|
||||
|
||||
void Item_func_as_wkt::fix_length_and_dec()
|
||||
{
|
||||
collation.set(default_charset(), DERIVATION_COERCIBLE, MY_REPERTOIRE_ASCII);
|
||||
max_length=MAX_BLOB_WIDTH;
|
||||
maybe_null= 1;
|
||||
}
|
||||
@ -157,7 +158,7 @@ String *Item_func_as_wkb::val_str(String *str)
|
||||
}
|
||||
|
||||
|
||||
String *Item_func_geometry_type::val_str(String *str)
|
||||
String *Item_func_geometry_type::val_str_ascii(String *str)
|
||||
{
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
String *swkb= args[0]->val_str(str);
|
||||
|
@ -57,12 +57,12 @@ public:
|
||||
String *val_str(String *);
|
||||
};
|
||||
|
||||
class Item_func_as_wkt: public Item_str_func
|
||||
class Item_func_as_wkt: public Item_str_ascii_func
|
||||
{
|
||||
public:
|
||||
Item_func_as_wkt(Item *a): Item_str_func(a) {}
|
||||
Item_func_as_wkt(Item *a): Item_str_ascii_func(a) {}
|
||||
const char *func_name() const { return "astext"; }
|
||||
String *val_str(String *);
|
||||
String *val_str_ascii(String *);
|
||||
void fix_length_and_dec();
|
||||
};
|
||||
|
||||
@ -75,16 +75,17 @@ public:
|
||||
enum_field_types field_type() const { return MYSQL_TYPE_BLOB; }
|
||||
};
|
||||
|
||||
class Item_func_geometry_type: public Item_str_func
|
||||
class Item_func_geometry_type: public Item_str_ascii_func
|
||||
{
|
||||
public:
|
||||
Item_func_geometry_type(Item *a): Item_str_func(a) {}
|
||||
String *val_str(String *);
|
||||
Item_func_geometry_type(Item *a): Item_str_ascii_func(a) {}
|
||||
String *val_str_ascii(String *);
|
||||
const char *func_name() const { return "geometrytype"; }
|
||||
void fix_length_and_dec()
|
||||
{
|
||||
max_length=20; // "GeometryCollection" is the most long
|
||||
maybe_null= 1;
|
||||
// "GeometryCollection" is the longest
|
||||
fix_length_and_charset(20, default_charset());
|
||||
maybe_null= 1;
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -41,6 +41,38 @@ C_MODE_END
|
||||
|
||||
String my_empty_string("",default_charset_info);
|
||||
|
||||
/*
|
||||
For the Items which have only val_str_ascii() method
|
||||
and don't have their own "native" val_str(),
|
||||
we provide a "wrapper" method to convert from ASCII
|
||||
to Item character set when it's necessary.
|
||||
Conversion happens only in case of "tricky" Item character set (e.g. UCS2).
|
||||
Normally conversion does not happen, and val_str_ascii() is immediately
|
||||
returned instead.
|
||||
*/
|
||||
String *Item_str_ascii_func::val_str(String *str)
|
||||
{
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
|
||||
if (!(collation.collation->state & MY_CS_NONASCII))
|
||||
return val_str_ascii(str);
|
||||
|
||||
DBUG_ASSERT(str != &ascii_buf);
|
||||
|
||||
uint errors;
|
||||
String *res= val_str_ascii(&ascii_buf);
|
||||
if (!res)
|
||||
return 0;
|
||||
|
||||
if ((null_value= str->copy(res->ptr(), res->length(),
|
||||
&my_charset_latin1, collation.collation,
|
||||
&errors)))
|
||||
return 0;
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
Convert an array of bytes to a hexadecimal representation.
|
||||
@ -112,7 +144,7 @@ longlong Item_str_func::val_int()
|
||||
}
|
||||
|
||||
|
||||
String *Item_func_md5::val_str(String *str)
|
||||
String *Item_func_md5::val_str_ascii(String *str)
|
||||
{
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
String * sptr= args[0]->val_str(str);
|
||||
@ -139,7 +171,6 @@ String *Item_func_md5::val_str(String *str)
|
||||
|
||||
void Item_func_md5::fix_length_and_dec()
|
||||
{
|
||||
max_length=32;
|
||||
/*
|
||||
The MD5() function treats its parameter as being a case sensitive. Thus
|
||||
we set binary collation on it so different instances of MD5() will be
|
||||
@ -148,10 +179,11 @@ void Item_func_md5::fix_length_and_dec()
|
||||
args[0]->collation.set(
|
||||
get_charset_by_csname(args[0]->collation.collation->csname,
|
||||
MY_CS_BINSORT,MYF(0)), DERIVATION_COERCIBLE);
|
||||
fix_length_and_charset(32, default_charset());
|
||||
}
|
||||
|
||||
|
||||
String *Item_func_sha::val_str(String *str)
|
||||
String *Item_func_sha::val_str_ascii(String *str)
|
||||
{
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
String * sptr= args[0]->val_str(str);
|
||||
@ -181,7 +213,6 @@ String *Item_func_sha::val_str(String *str)
|
||||
|
||||
void Item_func_sha::fix_length_and_dec()
|
||||
{
|
||||
max_length=SHA1_HASH_SIZE*2; // size of hex representation of hash
|
||||
/*
|
||||
The SHA() function treats its parameter as being a case sensitive. Thus
|
||||
we set binary collation on it so different instances of MD5() will be
|
||||
@ -190,6 +221,8 @@ void Item_func_sha::fix_length_and_dec()
|
||||
args[0]->collation.set(
|
||||
get_charset_by_csname(args[0]->collation.collation->csname,
|
||||
MY_CS_BINSORT,MYF(0)), DERIVATION_COERCIBLE);
|
||||
// size of hex representation of hash
|
||||
fix_length_and_charset(SHA1_HASH_SIZE * 2, default_charset());
|
||||
}
|
||||
|
||||
|
||||
@ -414,7 +447,7 @@ void Item_func_concat::fix_length_and_dec()
|
||||
{
|
||||
ulonglong max_result_length= 0;
|
||||
|
||||
if (agg_arg_charsets(collation, args, arg_count, MY_COLL_ALLOW_CONV, 1))
|
||||
if (agg_arg_charsets_for_string_result(collation, args, arg_count))
|
||||
return;
|
||||
|
||||
for (uint i=0 ; i < arg_count ; i++)
|
||||
@ -772,7 +805,7 @@ void Item_func_concat_ws::fix_length_and_dec()
|
||||
{
|
||||
ulonglong max_result_length;
|
||||
|
||||
if (agg_arg_charsets(collation, args, arg_count, MY_COLL_ALLOW_CONV, 1))
|
||||
if (agg_arg_charsets_for_string_result(collation, args, arg_count))
|
||||
return;
|
||||
|
||||
/*
|
||||
@ -843,8 +876,8 @@ String *Item_func_reverse::val_str(String *str)
|
||||
|
||||
void Item_func_reverse::fix_length_and_dec()
|
||||
{
|
||||
collation.set(args[0]->collation);
|
||||
max_length = args[0]->max_length;
|
||||
agg_arg_charsets_for_string_result(collation, args, 1);
|
||||
fix_char_length(args[0]->max_char_length());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -987,7 +1020,7 @@ void Item_func_replace::fix_length_and_dec()
|
||||
}
|
||||
max_length= (ulong) max_result_length;
|
||||
|
||||
if (agg_arg_charsets(collation, args, 3, MY_COLL_CMP_CONV, 1))
|
||||
if (agg_arg_charsets_for_comparison(collation, args, 3))
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1046,7 +1079,7 @@ void Item_func_insert::fix_length_and_dec()
|
||||
ulonglong max_result_length;
|
||||
|
||||
// Handle character set for args[0] and args[3].
|
||||
if (agg_arg_charsets(collation, &args[0], 2, MY_COLL_ALLOW_CONV, 3))
|
||||
if (agg_arg_charsets_for_string_result(collation, args, 2, 3))
|
||||
return;
|
||||
max_result_length= ((ulonglong) args[0]->max_length+
|
||||
(ulonglong) args[3]->max_length);
|
||||
@ -1094,7 +1127,7 @@ String *Item_str_conv::val_str(String *str)
|
||||
|
||||
void Item_func_lcase::fix_length_and_dec()
|
||||
{
|
||||
collation.set(args[0]->collation);
|
||||
agg_arg_charsets_for_string_result(collation, args, 1);
|
||||
multiply= collation.collation->casedn_multiply;
|
||||
converter= collation.collation->cset->casedn;
|
||||
max_length= args[0]->max_length * multiply;
|
||||
@ -1102,7 +1135,7 @@ void Item_func_lcase::fix_length_and_dec()
|
||||
|
||||
void Item_func_ucase::fix_length_and_dec()
|
||||
{
|
||||
collation.set(args[0]->collation);
|
||||
agg_arg_charsets_for_string_result(collation, args, 1);
|
||||
multiply= collation.collation->caseup_multiply;
|
||||
converter= collation.collation->cset->caseup;
|
||||
max_length= args[0]->max_length * multiply;
|
||||
@ -1150,7 +1183,7 @@ void Item_str_func::left_right_max_length()
|
||||
|
||||
void Item_func_left::fix_length_and_dec()
|
||||
{
|
||||
collation.set(args[0]->collation);
|
||||
agg_arg_charsets_for_string_result(collation, args, 1);
|
||||
left_right_max_length();
|
||||
}
|
||||
|
||||
@ -1183,7 +1216,7 @@ String *Item_func_right::val_str(String *str)
|
||||
|
||||
void Item_func_right::fix_length_and_dec()
|
||||
{
|
||||
collation.set(args[0]->collation);
|
||||
agg_arg_charsets_for_string_result(collation, args, 1);
|
||||
left_right_max_length();
|
||||
}
|
||||
|
||||
@ -1239,7 +1272,7 @@ void Item_func_substr::fix_length_and_dec()
|
||||
{
|
||||
max_length=args[0]->max_length;
|
||||
|
||||
collation.set(args[0]->collation);
|
||||
agg_arg_charsets_for_string_result(collation, args, 1);
|
||||
if (args[1]->const_item())
|
||||
{
|
||||
int32 start= (int32) args[1]->val_int();
|
||||
@ -1264,7 +1297,7 @@ void Item_func_substr_index::fix_length_and_dec()
|
||||
{
|
||||
max_length= args[0]->max_length;
|
||||
|
||||
if (agg_arg_charsets(collation, args, 2, MY_COLL_CMP_CONV, 1))
|
||||
if (agg_arg_charsets_for_comparison(collation, args, 2))
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1594,7 +1627,7 @@ void Item_func_trim::fix_length_and_dec()
|
||||
max_length= args[0]->max_length;
|
||||
if (arg_count == 1)
|
||||
{
|
||||
collation.set(args[0]->collation);
|
||||
agg_arg_charsets_for_string_result(collation, args, 1);
|
||||
remove.set_charset(collation.collation);
|
||||
remove.set_ascii(" ",1);
|
||||
}
|
||||
@ -1602,7 +1635,7 @@ void Item_func_trim::fix_length_and_dec()
|
||||
{
|
||||
// Handle character set for args[1] and args[0].
|
||||
// Note that we pass args[1] as the first item, and args[0] as the second.
|
||||
if (agg_arg_charsets(collation, &args[1], 2, MY_COLL_CMP_CONV, -1))
|
||||
if (agg_arg_charsets_for_comparison(collation, &args[1], 2, -1))
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -1627,7 +1660,7 @@ void Item_func_trim::print(String *str, enum_query_type query_type)
|
||||
|
||||
/* Item_func_password */
|
||||
|
||||
String *Item_func_password::val_str(String *str)
|
||||
String *Item_func_password::val_str_ascii(String *str)
|
||||
{
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
String *res= args[0]->val_str(str);
|
||||
@ -1636,7 +1669,7 @@ String *Item_func_password::val_str(String *str)
|
||||
if (res->length() == 0)
|
||||
return &my_empty_string;
|
||||
my_make_scrambled_password(tmp_value, res->ptr(), res->length());
|
||||
str->set(tmp_value, SCRAMBLED_PASSWORD_CHAR_LENGTH, res->charset());
|
||||
str->set(tmp_value, SCRAMBLED_PASSWORD_CHAR_LENGTH, &my_charset_latin1);
|
||||
return str;
|
||||
}
|
||||
|
||||
@ -1651,7 +1684,7 @@ char *Item_func_password::alloc(THD *thd, const char *password,
|
||||
|
||||
/* Item_func_old_password */
|
||||
|
||||
String *Item_func_old_password::val_str(String *str)
|
||||
String *Item_func_old_password::val_str_ascii(String *str)
|
||||
{
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
String *res= args[0]->val_str(str);
|
||||
@ -1660,7 +1693,7 @@ String *Item_func_old_password::val_str(String *str)
|
||||
if (res->length() == 0)
|
||||
return &my_empty_string;
|
||||
my_make_scrambled_password_323(tmp_value, res->ptr(), res->length());
|
||||
str->set(tmp_value, SCRAMBLED_PASSWORD_CHAR_LENGTH_323, res->charset());
|
||||
str->set(tmp_value, SCRAMBLED_PASSWORD_CHAR_LENGTH_323, &my_charset_latin1);
|
||||
return str;
|
||||
}
|
||||
|
||||
@ -1880,7 +1913,7 @@ bool Item_func_current_user::fix_fields(THD *thd, Item **ref)
|
||||
|
||||
void Item_func_soundex::fix_length_and_dec()
|
||||
{
|
||||
collation.set(args[0]->collation);
|
||||
agg_arg_charsets_for_string_result(collation, args, 1);
|
||||
max_length=args[0]->max_length;
|
||||
set_if_bigger(max_length, 4 * collation.collation->mbminlen);
|
||||
tmp_value.set_charset(collation.collation);
|
||||
@ -2186,7 +2219,7 @@ void Item_func_elt::fix_length_and_dec()
|
||||
max_length=0;
|
||||
decimals=0;
|
||||
|
||||
if (agg_arg_charsets(collation, args+1, arg_count-1, MY_COLL_ALLOW_CONV, 1))
|
||||
if (agg_arg_charsets_for_string_result(collation, args + 1, arg_count - 1))
|
||||
return;
|
||||
|
||||
for (uint i= 1 ; i < arg_count ; i++)
|
||||
@ -2253,7 +2286,7 @@ void Item_func_make_set::fix_length_and_dec()
|
||||
{
|
||||
max_length=arg_count-1;
|
||||
|
||||
if (agg_arg_charsets(collation, args, arg_count, MY_COLL_ALLOW_CONV, 1))
|
||||
if (agg_arg_charsets_for_string_result(collation, args, arg_count))
|
||||
return;
|
||||
|
||||
for (uint i=0 ; i < arg_count ; i++)
|
||||
@ -2371,17 +2404,27 @@ String *Item_func_char::val_str(String *str)
|
||||
int32 num=(int32) args[i]->val_int();
|
||||
if (!args[i]->null_value)
|
||||
{
|
||||
char char_num= (char) num;
|
||||
if (num&0xFF000000L) {
|
||||
str->append((char)(num>>24));
|
||||
goto b2;
|
||||
} else if (num&0xFF0000L) {
|
||||
b2: str->append((char)(num>>16));
|
||||
goto b1;
|
||||
} else if (num&0xFF00L) {
|
||||
b1: str->append((char)(num>>8));
|
||||
char tmp[4];
|
||||
if (num & 0xFF000000L)
|
||||
{
|
||||
mi_int4store(tmp, num);
|
||||
str->append(tmp, 4, &my_charset_bin);
|
||||
}
|
||||
else if (num & 0xFF0000L)
|
||||
{
|
||||
mi_int3store(tmp, num);
|
||||
str->append(tmp, 3, &my_charset_bin);
|
||||
}
|
||||
else if (num & 0xFF00L)
|
||||
{
|
||||
mi_int2store(tmp, num);
|
||||
str->append(tmp, 2, &my_charset_bin);
|
||||
}
|
||||
else
|
||||
{
|
||||
tmp[0]= (char) num;
|
||||
str->append(tmp, 1, &my_charset_bin);
|
||||
}
|
||||
str->append(&char_num, 1);
|
||||
}
|
||||
}
|
||||
str->realloc(str->length()); // Add end 0 (for Purify)
|
||||
@ -2413,7 +2456,7 @@ inline String* alloc_buffer(String *res,String *str,String *tmp_value,
|
||||
|
||||
void Item_func_repeat::fix_length_and_dec()
|
||||
{
|
||||
collation.set(args[0]->collation);
|
||||
agg_arg_charsets_for_string_result(collation, args, 1);
|
||||
if (args[1]->const_item())
|
||||
{
|
||||
/* must be longlong to avoid truncation */
|
||||
@ -2497,7 +2540,7 @@ err:
|
||||
void Item_func_rpad::fix_length_and_dec()
|
||||
{
|
||||
// Handle character set for args[0] and args[2].
|
||||
if (agg_arg_charsets(collation, &args[0], 2, MY_COLL_ALLOW_CONV, 2))
|
||||
if (agg_arg_charsets_for_string_result(collation, &args[0], 2, 2))
|
||||
return;
|
||||
if (args[1]->const_item())
|
||||
{
|
||||
@ -2599,7 +2642,7 @@ String *Item_func_rpad::val_str(String *str)
|
||||
void Item_func_lpad::fix_length_and_dec()
|
||||
{
|
||||
// Handle character set for args[0] and args[2].
|
||||
if (agg_arg_charsets(collation, &args[0], 2, MY_COLL_ALLOW_CONV, 2))
|
||||
if (agg_arg_charsets_for_string_result(collation, &args[0], 2, 2))
|
||||
return;
|
||||
|
||||
if (args[1]->const_item())
|
||||
@ -2769,7 +2812,7 @@ String *Item_func_conv_charset::val_str(String *str)
|
||||
void Item_func_conv_charset::fix_length_and_dec()
|
||||
{
|
||||
collation.set(conv_charset, DERIVATION_IMPLICIT);
|
||||
max_length = args[0]->max_length*conv_charset->mbmaxlen;
|
||||
fix_char_length(args[0]->max_char_length());
|
||||
}
|
||||
|
||||
void Item_func_conv_charset::print(String *str, enum_query_type query_type)
|
||||
@ -2859,7 +2902,7 @@ String *Item_func_charset::val_str(String *str)
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
uint dummy_errors;
|
||||
|
||||
CHARSET_INFO *cs= args[0]->collation.collation;
|
||||
CHARSET_INFO *cs= args[0]->charset_for_protocol();
|
||||
null_value= 0;
|
||||
str->copy(cs->csname, (uint) strlen(cs->csname),
|
||||
&my_charset_latin1, collation.collation, &dummy_errors);
|
||||
@ -2870,7 +2913,7 @@ String *Item_func_collation::val_str(String *str)
|
||||
{
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
uint dummy_errors;
|
||||
CHARSET_INFO *cs= args[0]->collation.collation;
|
||||
CHARSET_INFO *cs= args[0]->charset_for_protocol();
|
||||
|
||||
null_value= 0;
|
||||
str->copy(cs->name, (uint) strlen(cs->name),
|
||||
@ -2904,7 +2947,7 @@ String *Item_func_hex::val_str(String *str)
|
||||
if ((null_value= args[0]->null_value))
|
||||
return 0;
|
||||
ptr= longlong2str(dec,ans,16);
|
||||
if (str->copy(ans,(uint32) (ptr-ans),default_charset()))
|
||||
if (str->copy(ans,(uint32) (ptr-ans), &my_charset_numeric))
|
||||
return &my_empty_string; // End of memory
|
||||
return str;
|
||||
}
|
||||
@ -3109,11 +3152,11 @@ void Item_func_export_set::fix_length_and_dec()
|
||||
{
|
||||
uint length=max(args[1]->max_length,args[2]->max_length);
|
||||
uint sep_length=(arg_count > 3 ? args[3]->max_length : 1);
|
||||
max_length=length*64+sep_length*63;
|
||||
|
||||
if (agg_arg_charsets(collation, args+1, min(4,arg_count)-1,
|
||||
MY_COLL_ALLOW_CONV, 1))
|
||||
if (agg_arg_charsets_for_string_result(collation,
|
||||
args + 1, min(4, arg_count) - 1))
|
||||
return;
|
||||
fix_char_length(length * 64 + sep_length * 63);
|
||||
}
|
||||
|
||||
String* Item_func_inet_ntoa::val_str(String* str)
|
||||
@ -3132,6 +3175,7 @@ String* Item_func_inet_ntoa::val_str(String* str)
|
||||
if ((null_value= (args[0]->null_value || n > (ulonglong) LL(4294967295))))
|
||||
return 0; // Null value
|
||||
|
||||
str->set_charset(collation.collation);
|
||||
str->length(0);
|
||||
int4store(buf,n);
|
||||
|
||||
@ -3149,11 +3193,11 @@ String* Item_func_inet_ntoa::val_str(String* str)
|
||||
num[0]=(char) n1+'0';
|
||||
num[1]=(char) n2+'0';
|
||||
num[2]=(char) c+'0';
|
||||
uint length=(n1 ? 4 : n2 ? 3 : 2); // Remove pre-zero
|
||||
|
||||
(void) str->append(num+4-length,length);
|
||||
uint length= (n1 ? 4 : n2 ? 3 : 2); // Remove pre-zero
|
||||
uint dot_length= (p <= buf) ? 1 : 0;
|
||||
(void) str->append(num + 4 - length, length - dot_length,
|
||||
&my_charset_latin1);
|
||||
}
|
||||
str->length(str->length()-1); // Remove last '.';
|
||||
return str;
|
||||
}
|
||||
|
||||
|
@ -41,28 +41,41 @@ public:
|
||||
bool fix_fields(THD *thd, Item **ref);
|
||||
};
|
||||
|
||||
class Item_func_md5 :public Item_str_func
|
||||
|
||||
|
||||
/*
|
||||
Functions that return values with ASCII repertoire
|
||||
*/
|
||||
class Item_str_ascii_func :public Item_str_func
|
||||
{
|
||||
String ascii_buf;
|
||||
public:
|
||||
Item_str_ascii_func() :Item_str_func() {}
|
||||
Item_str_ascii_func(Item *a) :Item_str_func(a) {}
|
||||
Item_str_ascii_func(Item *a,Item *b) :Item_str_func(a,b) {}
|
||||
Item_str_ascii_func(Item *a,Item *b,Item *c) :Item_str_func(a,b,c) {}
|
||||
String *val_str_convert_from_ascii(String *str, String *ascii_buf);
|
||||
String *val_str(String *str);
|
||||
virtual String *val_str_ascii(String *)= 0;
|
||||
};
|
||||
|
||||
|
||||
class Item_func_md5 :public Item_str_ascii_func
|
||||
{
|
||||
String tmp_value;
|
||||
public:
|
||||
Item_func_md5(Item *a) :Item_str_func(a)
|
||||
{
|
||||
collation.set(&my_charset_bin);
|
||||
}
|
||||
String *val_str(String *);
|
||||
Item_func_md5(Item *a) :Item_str_ascii_func(a) {}
|
||||
String *val_str_ascii(String *);
|
||||
void fix_length_and_dec();
|
||||
const char *func_name() const { return "md5"; }
|
||||
};
|
||||
|
||||
|
||||
class Item_func_sha :public Item_str_func
|
||||
class Item_func_sha :public Item_str_ascii_func
|
||||
{
|
||||
public:
|
||||
Item_func_sha(Item *a) :Item_str_func(a)
|
||||
{
|
||||
collation.set(&my_charset_bin);
|
||||
}
|
||||
String *val_str(String *);
|
||||
Item_func_sha(Item *a) :Item_str_ascii_func(a) {}
|
||||
String *val_str_ascii(String *);
|
||||
void fix_length_and_dec();
|
||||
const char *func_name() const { return "sha"; }
|
||||
};
|
||||
@ -263,13 +276,16 @@ public:
|
||||
authentication procedure works, see comments in password.c.
|
||||
*/
|
||||
|
||||
class Item_func_password :public Item_str_func
|
||||
class Item_func_password :public Item_str_ascii_func
|
||||
{
|
||||
char tmp_value[SCRAMBLED_PASSWORD_CHAR_LENGTH+1];
|
||||
public:
|
||||
Item_func_password(Item *a) :Item_str_func(a) {}
|
||||
String *val_str(String *str);
|
||||
void fix_length_and_dec() { max_length= SCRAMBLED_PASSWORD_CHAR_LENGTH; }
|
||||
Item_func_password(Item *a) :Item_str_ascii_func(a) {}
|
||||
String *val_str_ascii(String *str);
|
||||
void fix_length_and_dec()
|
||||
{
|
||||
fix_length_and_charset(SCRAMBLED_PASSWORD_CHAR_LENGTH, default_charset());
|
||||
}
|
||||
const char *func_name() const { return "password"; }
|
||||
static char *alloc(THD *thd, const char *password, size_t pass_len);
|
||||
};
|
||||
@ -282,13 +298,16 @@ public:
|
||||
function.
|
||||
*/
|
||||
|
||||
class Item_func_old_password :public Item_str_func
|
||||
class Item_func_old_password :public Item_str_ascii_func
|
||||
{
|
||||
char tmp_value[SCRAMBLED_PASSWORD_CHAR_LENGTH_323+1];
|
||||
public:
|
||||
Item_func_old_password(Item *a) :Item_str_func(a) {}
|
||||
String *val_str(String *str);
|
||||
void fix_length_and_dec() { max_length= SCRAMBLED_PASSWORD_CHAR_LENGTH_323; }
|
||||
Item_func_old_password(Item *a) :Item_str_ascii_func(a) {}
|
||||
String *val_str_ascii(String *str);
|
||||
void fix_length_and_dec()
|
||||
{
|
||||
fix_length_and_charset(SCRAMBLED_PASSWORD_CHAR_LENGTH_323, default_charset());
|
||||
}
|
||||
const char *func_name() const { return "old_password"; }
|
||||
static char *alloc(THD *thd, const char *password, size_t pass_len);
|
||||
};
|
||||
@ -688,7 +707,7 @@ public:
|
||||
void fix_length_and_dec()
|
||||
{
|
||||
decimals= 0;
|
||||
max_length= 3 * 8 + 7;
|
||||
fix_length_and_charset(3 * 8 + 7, default_charset());
|
||||
maybe_null= 1;
|
||||
}
|
||||
};
|
||||
@ -848,14 +867,11 @@ class Item_func_uuid: public Item_str_func
|
||||
{
|
||||
public:
|
||||
Item_func_uuid(): Item_str_func() {}
|
||||
void fix_length_and_dec() {
|
||||
collation.set(system_charset_info);
|
||||
/*
|
||||
NOTE! uuid() should be changed to use 'ascii'
|
||||
charset when hex(), format(), md5(), etc, and implicit
|
||||
number-to-string conversion will use 'ascii'
|
||||
*/
|
||||
max_length= UUID_LENGTH * system_charset_info->mbmaxlen;
|
||||
void fix_length_and_dec()
|
||||
{
|
||||
collation.set(system_charset_info,
|
||||
DERIVATION_COERCIBLE, MY_REPERTOIRE_ASCII);
|
||||
fix_char_length(UUID_LENGTH);
|
||||
}
|
||||
const char *func_name() const{ return "uuid"; }
|
||||
String *val_str(String *);
|
||||
|
@ -3202,11 +3202,9 @@ Item_func_group_concat::fix_fields(THD *thd, Item **ref)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (agg_item_charsets(collation, func_name(),
|
||||
args,
|
||||
/* skip charset aggregation for order columns */
|
||||
arg_count - arg_count_order,
|
||||
MY_COLL_ALLOW_CONV, 1))
|
||||
/* skip charset aggregation for order columns */
|
||||
if (agg_item_charsets_for_string_result(collation, func_name(),
|
||||
args, arg_count - arg_count_order))
|
||||
return 1;
|
||||
|
||||
result.set_charset(collation.collation);
|
||||
|
@ -57,7 +57,7 @@ static bool make_datetime(date_time_format_types format, MYSQL_TIME *ltime,
|
||||
String *str)
|
||||
{
|
||||
char *buff;
|
||||
CHARSET_INFO *cs= &my_charset_bin;
|
||||
CHARSET_INFO *cs= &my_charset_numeric;
|
||||
uint length= MAX_DATE_STRING_REP_LENGTH;
|
||||
|
||||
if (str->alloc(length))
|
||||
@ -1586,9 +1586,7 @@ bool Item_func_from_days::get_date(MYSQL_TIME *ltime, uint fuzzy_date)
|
||||
|
||||
void Item_func_curdate::fix_length_and_dec()
|
||||
{
|
||||
collation.set(&my_charset_bin);
|
||||
decimals=0;
|
||||
max_length=MAX_DATE_WIDTH*MY_CHARSET_BIN_MB_MAXLEN;
|
||||
Item_date::fix_length_and_dec();
|
||||
|
||||
store_now_in_TIME(<ime);
|
||||
|
||||
@ -1649,7 +1647,7 @@ bool Item_func_curdate::get_date(MYSQL_TIME *res,
|
||||
String *Item_func_curtime::val_str(String *str)
|
||||
{
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
str_value.set(buff, buff_length, &my_charset_bin);
|
||||
str_value.set(buff, buff_length, &my_charset_latin1);
|
||||
return &str_value;
|
||||
}
|
||||
|
||||
@ -1659,11 +1657,10 @@ void Item_func_curtime::fix_length_and_dec()
|
||||
MYSQL_TIME ltime;
|
||||
|
||||
decimals= DATETIME_DEC;
|
||||
collation.set(&my_charset_bin);
|
||||
store_now_in_TIME(<ime);
|
||||
value= TIME_to_ulonglong_time(<ime);
|
||||
buff_length= (uint) my_time_to_str(<ime, buff);
|
||||
max_length= buff_length;
|
||||
fix_length_and_charset_datetime(buff_length);
|
||||
}
|
||||
|
||||
|
||||
@ -1698,7 +1695,7 @@ void Item_func_curtime_utc::store_now_in_TIME(MYSQL_TIME *now_time)
|
||||
String *Item_func_now::val_str(String *str)
|
||||
{
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
str_value.set(buff,buff_length, &my_charset_bin);
|
||||
str_value.set(buff, buff_length, &my_charset_numeric);
|
||||
return &str_value;
|
||||
}
|
||||
|
||||
@ -1706,13 +1703,12 @@ String *Item_func_now::val_str(String *str)
|
||||
void Item_func_now::fix_length_and_dec()
|
||||
{
|
||||
decimals= DATETIME_DEC;
|
||||
collation.set(&my_charset_bin);
|
||||
|
||||
store_now_in_TIME(<ime);
|
||||
value= (longlong) TIME_to_ulonglong_datetime(<ime);
|
||||
|
||||
buff_length= (uint) my_datetime_to_str(<ime, buff);
|
||||
max_length= buff_length;
|
||||
fix_length_and_charset_datetime(buff_length);
|
||||
}
|
||||
|
||||
|
||||
@ -1776,7 +1772,7 @@ String *Item_func_sysdate_local::val_str(String *str)
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
store_now_in_TIME(<ime);
|
||||
buff_length= (uint) my_datetime_to_str(<ime, buff);
|
||||
str_value.set(buff, buff_length, &my_charset_bin);
|
||||
str_value.set(buff, buff_length, &my_charset_numeric);
|
||||
return &str_value;
|
||||
}
|
||||
|
||||
@ -1800,8 +1796,7 @@ double Item_func_sysdate_local::val_real()
|
||||
void Item_func_sysdate_local::fix_length_and_dec()
|
||||
{
|
||||
decimals= 0;
|
||||
collation.set(&my_charset_bin);
|
||||
max_length= MAX_DATETIME_WIDTH*MY_CHARSET_BIN_MB_MAXLEN;
|
||||
fix_length_and_charset_datetime(MAX_DATETIME_WIDTH);
|
||||
}
|
||||
|
||||
|
||||
@ -2005,7 +2000,8 @@ String *Item_func_date_format::val_str(String *str)
|
||||
{
|
||||
String *res;
|
||||
if (!(res=args[0]->val_str(str)) ||
|
||||
(str_to_time_with_warn(res->ptr(), res->length(), &l_time)))
|
||||
(str_to_time_with_warn(res->charset(), res->ptr(), res->length(),
|
||||
&l_time)))
|
||||
goto null_date;
|
||||
|
||||
l_time.year=l_time.month=l_time.day=0;
|
||||
@ -2049,9 +2045,8 @@ null_date:
|
||||
void Item_func_from_unixtime::fix_length_and_dec()
|
||||
{
|
||||
thd= current_thd;
|
||||
collation.set(&my_charset_bin);
|
||||
decimals= DATETIME_DEC;
|
||||
max_length=MAX_DATETIME_WIDTH*MY_CHARSET_BIN_MB_MAXLEN;
|
||||
fix_length_and_charset_datetime(MAX_DATETIME_WIDTH);
|
||||
maybe_null= 1;
|
||||
thd->time_zone_used= 1;
|
||||
}
|
||||
@ -2109,9 +2104,8 @@ bool Item_func_from_unixtime::get_date(MYSQL_TIME *ltime,
|
||||
|
||||
void Item_func_convert_tz::fix_length_and_dec()
|
||||
{
|
||||
collation.set(&my_charset_bin);
|
||||
decimals= 0;
|
||||
max_length= MAX_DATETIME_WIDTH*MY_CHARSET_BIN_MB_MAXLEN;
|
||||
fix_length_and_charset_datetime(MAX_DATETIME_WIDTH);
|
||||
maybe_null= 1;
|
||||
}
|
||||
|
||||
@ -2155,13 +2149,13 @@ bool Item_func_convert_tz::get_date(MYSQL_TIME *ltime,
|
||||
|
||||
if (!from_tz_cached)
|
||||
{
|
||||
from_tz= my_tz_find(thd, args[1]->val_str(&str));
|
||||
from_tz= my_tz_find(thd, args[1]->val_str_ascii(&str));
|
||||
from_tz_cached= args[1]->const_item();
|
||||
}
|
||||
|
||||
if (!to_tz_cached)
|
||||
{
|
||||
to_tz= my_tz_find(thd, args[2]->val_str(&str));
|
||||
to_tz= my_tz_find(thd, args[2]->val_str_ascii(&str));
|
||||
to_tz_cached= args[2]->const_item();
|
||||
}
|
||||
|
||||
@ -2195,9 +2189,8 @@ void Item_date_add_interval::fix_length_and_dec()
|
||||
{
|
||||
enum_field_types arg0_field_type;
|
||||
|
||||
collation.set(&my_charset_bin);
|
||||
maybe_null=1;
|
||||
max_length=MAX_DATETIME_FULL_WIDTH*MY_CHARSET_BIN_MB_MAXLEN;
|
||||
fix_length_and_charset_datetime(MAX_DATETIME_FULL_WIDTH);
|
||||
value.alloc(max_length);
|
||||
|
||||
/*
|
||||
@ -2375,7 +2368,9 @@ longlong Item_extract::val_int()
|
||||
else
|
||||
{
|
||||
String *res= args[0]->val_str(&value);
|
||||
if (!res || str_to_time_with_warn(res->ptr(), res->length(), <ime))
|
||||
if (!res ||
|
||||
str_to_time_with_warn(res->charset(), res->ptr(), res->length(),
|
||||
<ime))
|
||||
{
|
||||
null_value=1;
|
||||
return 0;
|
||||
@ -2814,7 +2809,7 @@ void Item_func_add_time::fix_length_and_dec()
|
||||
{
|
||||
enum_field_types arg0_field_type;
|
||||
decimals=0;
|
||||
max_length=MAX_DATETIME_FULL_WIDTH*MY_CHARSET_BIN_MB_MAXLEN;
|
||||
fix_length_and_charset_datetime(MAX_DATETIME_FULL_WIDTH);
|
||||
maybe_null= 1;
|
||||
|
||||
/*
|
||||
@ -3225,12 +3220,12 @@ void Item_func_timestamp_diff::print(String *str, enum_query_type query_type)
|
||||
}
|
||||
|
||||
|
||||
String *Item_func_get_format::val_str(String *str)
|
||||
String *Item_func_get_format::val_str_ascii(String *str)
|
||||
{
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
const char *format_name;
|
||||
KNOWN_DATE_TIME_FORMAT *format;
|
||||
String *val= args[0]->val_str(str);
|
||||
String *val= args[0]->val_str_ascii(str);
|
||||
ulong val_len;
|
||||
|
||||
if ((null_value= args[0]->null_value))
|
||||
@ -3249,7 +3244,7 @@ String *Item_func_get_format::val_str(String *str)
|
||||
(const uchar *) format_name, val_len))
|
||||
{
|
||||
const char *format_str= get_date_time_format_str(format, type);
|
||||
str->set(format_str, (uint) strlen(format_str), &my_charset_bin);
|
||||
str->set(format_str, (uint) strlen(format_str), &my_charset_numeric);
|
||||
return str;
|
||||
}
|
||||
}
|
||||
|
@ -122,23 +122,22 @@ public:
|
||||
class Item_func_month :public Item_func
|
||||
{
|
||||
public:
|
||||
Item_func_month(Item *a) :Item_func(a) {}
|
||||
Item_func_month(Item *a) :Item_func(a) { collation.set_numeric(); }
|
||||
longlong val_int();
|
||||
double val_real()
|
||||
{ DBUG_ASSERT(fixed == 1); return (double) Item_func_month::val_int(); }
|
||||
String *val_str(String *str)
|
||||
{
|
||||
str->set(val_int(), &my_charset_bin);
|
||||
str->set(val_int(), collation.collation);
|
||||
return null_value ? 0 : str;
|
||||
}
|
||||
const char *func_name() const { return "month"; }
|
||||
enum Item_result result_type () const { return INT_RESULT; }
|
||||
void fix_length_and_dec()
|
||||
{
|
||||
collation.set(&my_charset_bin);
|
||||
decimals=0;
|
||||
max_length=2*MY_CHARSET_BIN_MB_MAXLEN;
|
||||
maybe_null=1;
|
||||
decimals= 0;
|
||||
fix_char_length(2);
|
||||
maybe_null= 1;
|
||||
}
|
||||
bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
|
||||
};
|
||||
@ -165,9 +164,9 @@ public:
|
||||
const char *func_name() const { return "dayofyear"; }
|
||||
void fix_length_and_dec()
|
||||
{
|
||||
decimals=0;
|
||||
max_length=3*MY_CHARSET_BIN_MB_MAXLEN;
|
||||
maybe_null=1;
|
||||
decimals= 0;
|
||||
fix_char_length(3);
|
||||
maybe_null= 1;
|
||||
}
|
||||
bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
|
||||
};
|
||||
@ -290,7 +289,7 @@ class Item_func_weekday :public Item_func
|
||||
bool odbc_type;
|
||||
public:
|
||||
Item_func_weekday(Item *a,bool type_arg)
|
||||
:Item_func(a), odbc_type(type_arg) {}
|
||||
:Item_func(a), odbc_type(type_arg) { collation.set_numeric(); }
|
||||
longlong val_int();
|
||||
double val_real() { DBUG_ASSERT(fixed == 1); return (double) val_int(); }
|
||||
String *val_str(String *str)
|
||||
@ -306,10 +305,9 @@ public:
|
||||
enum Item_result result_type () const { return INT_RESULT; }
|
||||
void fix_length_and_dec()
|
||||
{
|
||||
collation.set(&my_charset_bin);
|
||||
decimals=0;
|
||||
max_length=1*MY_CHARSET_BIN_MB_MAXLEN;
|
||||
maybe_null=1;
|
||||
decimals= 0;
|
||||
fix_char_length(1);
|
||||
maybe_null= 1;
|
||||
}
|
||||
bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
|
||||
};
|
||||
@ -379,15 +377,15 @@ public:
|
||||
Item_date(Item *a) :Item_func(a) {}
|
||||
enum Item_result result_type () const { return STRING_RESULT; }
|
||||
enum_field_types field_type() const { return MYSQL_TYPE_DATE; }
|
||||
CHARSET_INFO *charset_for_protocol(void) const { return &my_charset_bin; }
|
||||
String *val_str(String *str);
|
||||
longlong val_int();
|
||||
double val_real() { return val_real_from_decimal(); }
|
||||
const char *func_name() const { return "date"; }
|
||||
void fix_length_and_dec()
|
||||
{
|
||||
collation.set(&my_charset_bin);
|
||||
decimals=0;
|
||||
max_length=MAX_DATE_WIDTH*MY_CHARSET_BIN_MB_MAXLEN;
|
||||
decimals= 0;
|
||||
fix_length_and_charset_datetime(MAX_DATE_WIDTH);
|
||||
}
|
||||
Field *tmp_table_field(TABLE *table)
|
||||
{
|
||||
@ -414,6 +412,7 @@ public:
|
||||
Item_date_func(Item *a,Item *b) :Item_str_func(a,b) {}
|
||||
Item_date_func(Item *a,Item *b, Item *c) :Item_str_func(a,b,c) {}
|
||||
enum_field_types field_type() const { return MYSQL_TYPE_DATETIME; }
|
||||
CHARSET_INFO *charset_for_protocol(void) const { return &my_charset_bin; }
|
||||
Field *tmp_table_field(TABLE *table)
|
||||
{
|
||||
return tmp_table_field_from_field_type(table, 0);
|
||||
@ -440,10 +439,11 @@ public:
|
||||
Item_str_timefunc(Item *a,Item *b) :Item_str_func(a,b) {}
|
||||
Item_str_timefunc(Item *a, Item *b, Item *c) :Item_str_func(a, b ,c) {}
|
||||
enum_field_types field_type() const { return MYSQL_TYPE_TIME; }
|
||||
CHARSET_INFO *charset_for_protocol(void) const { return &my_charset_bin; }
|
||||
void fix_length_and_dec()
|
||||
{
|
||||
decimals= DATETIME_DEC;
|
||||
max_length=MAX_TIME_WIDTH*MY_CHARSET_BIN_MB_MAXLEN;
|
||||
fix_length_and_charset_datetime(MAX_TIME_WIDTH);
|
||||
}
|
||||
Field *tmp_table_field(TABLE *table)
|
||||
{
|
||||
@ -701,7 +701,6 @@ public:
|
||||
void fix_length_and_dec()
|
||||
{
|
||||
Item_str_timefunc::fix_length_and_dec();
|
||||
collation.set(&my_charset_bin);
|
||||
maybe_null=1;
|
||||
}
|
||||
const char *func_name() const { return "sec_to_time"; }
|
||||
@ -774,13 +773,7 @@ public:
|
||||
class Item_typecast_maybe_null :public Item_typecast
|
||||
{
|
||||
public:
|
||||
Item_typecast_maybe_null(Item *a) :Item_typecast(a) {}
|
||||
void fix_length_and_dec()
|
||||
{
|
||||
collation.set(&my_charset_bin);
|
||||
max_length=args[0]->max_length;
|
||||
maybe_null= 1;
|
||||
}
|
||||
Item_typecast_maybe_null(Item *a) :Item_typecast(a) { maybe_null= 1; }
|
||||
};
|
||||
|
||||
|
||||
@ -813,16 +806,12 @@ public:
|
||||
bool get_time(MYSQL_TIME *ltime);
|
||||
const char *cast_type() const { return "date"; }
|
||||
enum_field_types field_type() const { return MYSQL_TYPE_DATE; }
|
||||
CHARSET_INFO *charset_for_protocol(void) const { return &my_charset_bin; }
|
||||
Field *tmp_table_field(TABLE *table)
|
||||
{
|
||||
return tmp_table_field_from_field_type(table, 0);
|
||||
}
|
||||
void fix_length_and_dec()
|
||||
{
|
||||
collation.set(&my_charset_bin);
|
||||
max_length= 10;
|
||||
maybe_null= 1;
|
||||
}
|
||||
void fix_length_and_dec() { fix_length_and_charset_datetime(10); }
|
||||
bool result_as_longlong() { return TRUE; }
|
||||
longlong val_int();
|
||||
double val_real() { return (double) val_int(); }
|
||||
@ -847,6 +836,7 @@ public:
|
||||
bool get_time(MYSQL_TIME *ltime);
|
||||
const char *cast_type() const { return "time"; }
|
||||
enum_field_types field_type() const { return MYSQL_TYPE_TIME; }
|
||||
CHARSET_INFO *charset_for_protocol(void) const { return &my_charset_bin; }
|
||||
Field *tmp_table_field(TABLE *table)
|
||||
{
|
||||
return tmp_table_field_from_field_type(table, 0);
|
||||
@ -863,6 +853,8 @@ public:
|
||||
{
|
||||
return save_time_in_field(field);
|
||||
}
|
||||
void fix_length_and_dec()
|
||||
{ fix_length_and_charset_datetime(args[0]->max_char_length()); }
|
||||
};
|
||||
|
||||
|
||||
@ -874,15 +866,14 @@ public:
|
||||
String *val_str(String *str);
|
||||
const char *cast_type() const { return "datetime"; }
|
||||
enum_field_types field_type() const { return MYSQL_TYPE_DATETIME; }
|
||||
CHARSET_INFO *charset_for_protocol(void) const { return &my_charset_bin; }
|
||||
Field *tmp_table_field(TABLE *table)
|
||||
{
|
||||
return tmp_table_field_from_field_type(table, 0);
|
||||
}
|
||||
void fix_length_and_dec()
|
||||
{
|
||||
collation.set(&my_charset_bin);
|
||||
maybe_null= 1;
|
||||
max_length= MAX_DATETIME_FULL_WIDTH * MY_CHARSET_BIN_MB_MAXLEN;
|
||||
fix_length_and_charset_datetime(MAX_DATETIME_FULL_WIDTH);
|
||||
decimals= DATETIME_DEC;
|
||||
}
|
||||
bool result_as_longlong() { return TRUE; }
|
||||
@ -907,10 +898,11 @@ public:
|
||||
String *val_str(String *str);
|
||||
const char *func_name() const { return "makedate"; }
|
||||
enum_field_types field_type() const { return MYSQL_TYPE_DATE; }
|
||||
CHARSET_INFO *charset_for_protocol(void) const { return &my_charset_bin; }
|
||||
void fix_length_and_dec()
|
||||
{
|
||||
decimals=0;
|
||||
max_length=MAX_DATE_WIDTH*MY_CHARSET_BIN_MB_MAXLEN;
|
||||
fix_length_and_charset_datetime(MAX_DATE_WIDTH);
|
||||
maybe_null= 1;
|
||||
}
|
||||
longlong val_int();
|
||||
@ -929,6 +921,7 @@ public:
|
||||
String *val_str(String *str);
|
||||
enum_field_types field_type() const { return cached_field_type; }
|
||||
void fix_length_and_dec();
|
||||
CHARSET_INFO *charset_for_protocol(void) const { return &my_charset_bin; }
|
||||
|
||||
Field *tmp_table_field(TABLE *table)
|
||||
{
|
||||
@ -1019,20 +1012,20 @@ enum date_time_format
|
||||
USA_FORMAT, JIS_FORMAT, ISO_FORMAT, EUR_FORMAT, INTERNAL_FORMAT
|
||||
};
|
||||
|
||||
class Item_func_get_format :public Item_str_func
|
||||
class Item_func_get_format :public Item_str_ascii_func
|
||||
{
|
||||
public:
|
||||
const timestamp_type type; // keep it public
|
||||
Item_func_get_format(timestamp_type type_arg, Item *a)
|
||||
:Item_str_func(a), type(type_arg)
|
||||
:Item_str_ascii_func(a), type(type_arg)
|
||||
{}
|
||||
String *val_str(String *str);
|
||||
String *val_str_ascii(String *str);
|
||||
const char *func_name() const { return "get_format"; }
|
||||
void fix_length_and_dec()
|
||||
{
|
||||
maybe_null= 1;
|
||||
decimals=0;
|
||||
max_length=17*MY_CHARSET_BIN_MB_MAXLEN;
|
||||
fix_length_and_charset(17, default_charset());
|
||||
}
|
||||
virtual void print(String *str, enum_query_type query_type);
|
||||
};
|
||||
|
@ -2569,7 +2569,7 @@ void Item_xml_str_func::fix_length_and_dec()
|
||||
|
||||
nodeset_func= 0;
|
||||
|
||||
if (agg_arg_charsets(collation, args, arg_count, MY_COLL_CMP_CONV, 1))
|
||||
if (agg_arg_charsets_for_comparison(collation, args, arg_count))
|
||||
return;
|
||||
|
||||
if (collation.collation->mbminlen > 1)
|
||||
|
@ -110,10 +110,63 @@ int my_decimal2string(uint mask, const my_decimal *d,
|
||||
&length, (int)fixed_prec, fixed_dec,
|
||||
filler);
|
||||
str->length(length);
|
||||
str->set_charset(&my_charset_numeric);
|
||||
return check_result(mask, result);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@brief Converting decimal to string with character set conversion
|
||||
|
||||
@details Convert given my_decimal to String; allocate buffer as needed.
|
||||
|
||||
@param[in] mask what problems to warn on (mask of E_DEC_* values)
|
||||
@param[in] val the decimal to print
|
||||
@param[in] fixed_prec overall number of digits if ZEROFILL, 0 otherwise
|
||||
@param[in] fixed_dec number of decimal places (if fixed_prec != 0)
|
||||
@param[in] filler what char to pad with (ZEROFILL et al.)
|
||||
@param[out] *str where to store the resulting string
|
||||
@param[in] cs character set
|
||||
|
||||
@return error coce
|
||||
@retval E_DEC_OK
|
||||
@retval E_DEC_TRUNCATED
|
||||
@retval E_DEC_OVERFLOW
|
||||
@retval E_DEC_OOM
|
||||
|
||||
Would be great to make it a method of the String class,
|
||||
but this would need to include
|
||||
my_decimal.h from sql_string.h and sql_string.cc, which is not desirable.
|
||||
*/
|
||||
bool
|
||||
str_set_decimal(uint mask, const my_decimal *val,
|
||||
uint fixed_prec, uint fixed_dec, char filler,
|
||||
String *str, CHARSET_INFO *cs)
|
||||
{
|
||||
if (!(cs->state & MY_CS_NONASCII))
|
||||
{
|
||||
/* For ASCII-compatible character sets we can use my_decimal2string */
|
||||
my_decimal2string(mask, val, fixed_prec, fixed_dec, filler, str);
|
||||
str->set_charset(cs);
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
For ASCII-incompatible character sets (like UCS2) we
|
||||
call my_decimal2string() on a temporary buffer first,
|
||||
and then convert the result to the target character
|
||||
with help of str->copy().
|
||||
*/
|
||||
uint errors;
|
||||
char buf[DECIMAL_MAX_STR_LENGTH];
|
||||
String tmp(buf, sizeof(buf), &my_charset_latin1);
|
||||
my_decimal2string(mask, val, fixed_prec, fixed_dec, filler, &tmp);
|
||||
return str->copy(tmp.ptr(), tmp.length(), &my_charset_latin1, cs, &errors);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Convert from decimal to binary representation
|
||||
|
||||
|
@ -218,7 +218,8 @@ extern CHARSET_INFO *error_message_charset_info;
|
||||
|
||||
enum Derivation
|
||||
{
|
||||
DERIVATION_IGNORABLE= 5,
|
||||
DERIVATION_IGNORABLE= 6,
|
||||
DERIVATION_NUMERIC= 5,
|
||||
DERIVATION_COERCIBLE= 4,
|
||||
DERIVATION_SYSCONST= 3,
|
||||
DERIVATION_IMPLICIT= 2,
|
||||
@ -226,6 +227,8 @@ enum Derivation
|
||||
DERIVATION_EXPLICIT= 0
|
||||
};
|
||||
|
||||
#define my_charset_numeric my_charset_latin1
|
||||
#define MY_REPERTOIRE_NUMERIC MY_REPERTOIRE_ASCII
|
||||
|
||||
typedef struct my_locale_errmsgs
|
||||
{
|
||||
@ -870,6 +873,16 @@ typedef Comp_creator* (*chooser_compare_func_creator)(bool invert);
|
||||
#include "item.h"
|
||||
extern my_decimal decimal_zero;
|
||||
|
||||
/* my_decimal.cc */
|
||||
bool str_set_decimal(uint mask, const my_decimal *val, uint fixed_prec,
|
||||
uint fixed_dec, char filler, String *str,
|
||||
CHARSET_INFO *cs);
|
||||
inline bool str_set_decimal(const my_decimal *val, String *str,
|
||||
CHARSET_INFO *cs)
|
||||
{
|
||||
return str_set_decimal(E_DEC_FATAL_ERROR, val, 0, 0, 0, str, cs);
|
||||
}
|
||||
|
||||
/* sql_parse.cc */
|
||||
void free_items(Item *item);
|
||||
void cleanup_items(Item *item);
|
||||
@ -2243,8 +2256,17 @@ ulong convert_month_to_period(ulong month);
|
||||
void get_date_from_daynr(long daynr,uint *year, uint *month,
|
||||
uint *day);
|
||||
my_time_t TIME_to_timestamp(THD *thd, const MYSQL_TIME *t, my_bool *not_exist);
|
||||
bool str_to_time_with_warn(const char *str,uint length,MYSQL_TIME *l_time);
|
||||
timestamp_type str_to_datetime_with_warn(const char *str, uint length,
|
||||
/* Character set-aware version of str_to_time() */
|
||||
bool str_to_time(CHARSET_INFO *cs, const char *str,uint length,
|
||||
MYSQL_TIME *l_time, int *warning);
|
||||
/* Character set-aware version of str_to_datetime() */
|
||||
timestamp_type str_to_datetime(CHARSET_INFO *cs,
|
||||
const char *str, uint length,
|
||||
MYSQL_TIME *l_time, uint flags, int *was_cut);
|
||||
bool str_to_time_with_warn(CHARSET_INFO *cs, const char *str,uint length,
|
||||
MYSQL_TIME *l_time);
|
||||
timestamp_type str_to_datetime_with_warn(CHARSET_INFO *cs,
|
||||
const char *str, uint length,
|
||||
MYSQL_TIME *l_time, uint flags);
|
||||
void localtime_to_TIME(MYSQL_TIME *to, struct tm *from);
|
||||
void calc_time_from_sec(MYSQL_TIME *to, long seconds, long microseconds);
|
||||
|
@ -736,10 +736,10 @@ bool Protocol::send_result_set_metadata(List<Item> *list, uint flags)
|
||||
/* Store fixed length fields */
|
||||
pos= (char*) local_packet->ptr()+local_packet->length();
|
||||
*pos++= 12; // Length of packed fields
|
||||
if (item->collation.collation == &my_charset_bin || thd_charset == NULL)
|
||||
if (item->charset_for_protocol() == &my_charset_bin || thd_charset == NULL)
|
||||
{
|
||||
/* No conversion */
|
||||
int2store(pos, field.charsetnr);
|
||||
int2store(pos, item->charset_for_protocol()->number);
|
||||
int4store(pos+2, field.length);
|
||||
}
|
||||
else
|
||||
|
@ -412,11 +412,25 @@ bool String::append(const char *s)
|
||||
|
||||
bool String::append(const char *s,uint32 arg_length, CHARSET_INFO *cs)
|
||||
{
|
||||
uint32 dummy_offset;
|
||||
uint32 offset;
|
||||
|
||||
if (needs_conversion(arg_length, cs, str_charset, &dummy_offset))
|
||||
if (needs_conversion(arg_length, cs, str_charset, &offset))
|
||||
{
|
||||
uint32 add_length= arg_length / cs->mbminlen * str_charset->mbmaxlen;
|
||||
uint32 add_length;
|
||||
if ((cs == &my_charset_bin) && offset)
|
||||
{
|
||||
DBUG_ASSERT(str_charset->mbminlen > offset);
|
||||
offset= str_charset->mbminlen - offset; // How many characters to pad
|
||||
add_length= arg_length + offset;
|
||||
if (realloc(str_length + add_length))
|
||||
return TRUE;
|
||||
bzero((char*) Ptr + str_length, offset);
|
||||
memcpy(Ptr + str_length + offset, s, arg_length);
|
||||
str_length+= add_length;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
add_length= arg_length / cs->mbminlen * str_charset->mbmaxlen;
|
||||
uint dummy_errors;
|
||||
if (realloc(str_length + add_length))
|
||||
return TRUE;
|
||||
@ -966,6 +980,24 @@ well_formed_copy_nchars(CHARSET_INFO *to_cs,
|
||||
uint pad_length= to_cs->mbminlen - from_offset;
|
||||
bzero(to, pad_length);
|
||||
memmove(to + pad_length, from, from_offset);
|
||||
/*
|
||||
In some cases left zero-padding can create an incorrect character.
|
||||
For example:
|
||||
INSERT INTO t1 (utf32_column) VALUES (0x110000);
|
||||
We'll pad the value to 0x00110000, which is a wrong UTF32 sequence!
|
||||
The valid characters range is limited to 0x00000000..0x0010FFFF.
|
||||
|
||||
Make sure we didn't pad to an incorrect character.
|
||||
*/
|
||||
if (to_cs->cset->well_formed_len(to_cs,
|
||||
to, to + to_cs->mbminlen, 1,
|
||||
&well_formed_error) !=
|
||||
to_cs->mbminlen)
|
||||
{
|
||||
*from_end_pos= *well_formed_error_pos= from;
|
||||
*cannot_convert_error_pos= NULL;
|
||||
return 0;
|
||||
}
|
||||
nchars--;
|
||||
from+= from_offset;
|
||||
from_length-= from_offset;
|
||||
|
@ -2790,7 +2790,7 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
|
||||
sql_field->interval_list);
|
||||
List_iterator<String> int_it(sql_field->interval_list);
|
||||
String conv, *tmp;
|
||||
char comma_buf[2];
|
||||
char comma_buf[4]; /* 4 bytes for utf32 */
|
||||
int comma_length= cs->cset->wc_mb(cs, ',', (uchar*) comma_buf,
|
||||
(uchar*) comma_buf +
|
||||
sizeof(comma_buf));
|
||||
|
77
sql/time.cc
77
sql/time.cc
@ -213,6 +213,69 @@ ulong convert_month_to_period(ulong month)
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Convert a string to 8-bit representation,
|
||||
for use in str_to_time/str_to_date/str_to_date.
|
||||
|
||||
In the future to_ascii() can be extended to convert
|
||||
non-ASCII digits to ASCII digits
|
||||
(for example, ARABIC-INDIC, DEVANAGARI, BENGALI, and so on)
|
||||
so DATE/TIME/DATETIME values understand digits in the
|
||||
respected scripts.
|
||||
*/
|
||||
static uint
|
||||
to_ascii(CHARSET_INFO *cs,
|
||||
const char *src, uint src_length,
|
||||
char *dst, uint dst_length)
|
||||
|
||||
{
|
||||
int cnvres;
|
||||
my_wc_t wc;
|
||||
const char *srcend= src + src_length;
|
||||
char *dst0= dst, *dstend= dst + dst_length - 1;
|
||||
while (dst < dstend &&
|
||||
(cnvres= (cs->cset->mb_wc)(cs, &wc,
|
||||
(const uchar*) src,
|
||||
(const uchar*) srcend)) > 0 &&
|
||||
wc < 128)
|
||||
{
|
||||
src+= cnvres;
|
||||
*dst++= wc;
|
||||
}
|
||||
*dst= '\0';
|
||||
return dst - dst0;
|
||||
}
|
||||
|
||||
|
||||
/* Character set-aware version of str_to_time() */
|
||||
bool str_to_time(CHARSET_INFO *cs, const char *str,uint length,
|
||||
MYSQL_TIME *l_time, int *warning)
|
||||
{
|
||||
char cnv[32];
|
||||
if ((cs->state & MY_CS_NONASCII) != 0)
|
||||
{
|
||||
length= to_ascii(cs, str, length, cnv, sizeof(cnv));
|
||||
str= cnv;
|
||||
}
|
||||
return str_to_time(str, length, l_time, warning);
|
||||
}
|
||||
|
||||
|
||||
/* Character set-aware version of str_to_datetime() */
|
||||
timestamp_type str_to_datetime(CHARSET_INFO *cs,
|
||||
const char *str, uint length,
|
||||
MYSQL_TIME *l_time, uint flags, int *was_cut)
|
||||
{
|
||||
char cnv[32];
|
||||
if ((cs->state & MY_CS_NONASCII) != 0)
|
||||
{
|
||||
length= to_ascii(cs, str, length, cnv, sizeof(cnv));
|
||||
str= cnv;
|
||||
}
|
||||
return str_to_datetime(str, length, l_time, flags, was_cut);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Convert a timestamp string to a MYSQL_TIME value and produce a warning
|
||||
if string was truncated during conversion.
|
||||
@ -222,14 +285,15 @@ ulong convert_month_to_period(ulong month)
|
||||
*/
|
||||
|
||||
timestamp_type
|
||||
str_to_datetime_with_warn(const char *str, uint length, MYSQL_TIME *l_time,
|
||||
str_to_datetime_with_warn(CHARSET_INFO *cs,
|
||||
const char *str, uint length, MYSQL_TIME *l_time,
|
||||
uint flags)
|
||||
{
|
||||
int was_cut;
|
||||
THD *thd= current_thd;
|
||||
timestamp_type ts_type;
|
||||
|
||||
ts_type= str_to_datetime(str, length, l_time,
|
||||
ts_type= str_to_datetime(cs, str, length, l_time,
|
||||
(flags | (thd->variables.sql_mode &
|
||||
(MODE_INVALID_DATES |
|
||||
MODE_NO_ZERO_DATE))),
|
||||
@ -284,7 +348,8 @@ my_time_t TIME_to_timestamp(THD *thd, const MYSQL_TIME *t, my_bool *in_dst_time_
|
||||
See str_to_time() for more info.
|
||||
*/
|
||||
bool
|
||||
str_to_time_with_warn(const char *str, uint length, MYSQL_TIME *l_time)
|
||||
str_to_time_with_warn(CHARSET_INFO *cs,
|
||||
const char *str, uint length, MYSQL_TIME *l_time)
|
||||
{
|
||||
int warning;
|
||||
bool ret_val= str_to_time(str, length, l_time, &warning);
|
||||
@ -697,7 +762,7 @@ void make_time(const DATE_TIME_FORMAT *format __attribute__((unused)),
|
||||
{
|
||||
uint length= (uint) my_time_to_str(l_time, (char*) str->ptr());
|
||||
str->length(length);
|
||||
str->set_charset(&my_charset_bin);
|
||||
str->set_charset(&my_charset_numeric);
|
||||
}
|
||||
|
||||
|
||||
@ -706,7 +771,7 @@ void make_date(const DATE_TIME_FORMAT *format __attribute__((unused)),
|
||||
{
|
||||
uint length= (uint) my_date_to_str(l_time, (char*) str->ptr());
|
||||
str->length(length);
|
||||
str->set_charset(&my_charset_bin);
|
||||
str->set_charset(&my_charset_numeric);
|
||||
}
|
||||
|
||||
|
||||
@ -715,7 +780,7 @@ void make_datetime(const DATE_TIME_FORMAT *format __attribute__((unused)),
|
||||
{
|
||||
uint length= (uint) my_datetime_to_str(l_time, (char*) str->ptr());
|
||||
str->length(length);
|
||||
str->set_charset(&my_charset_bin);
|
||||
str->set_charset(&my_charset_numeric);
|
||||
}
|
||||
|
||||
|
||||
|
@ -689,7 +689,7 @@ int ha_heap::create(const char *name, TABLE *table_arg,
|
||||
if (field->flags & (ENUM_FLAG | SET_FLAG))
|
||||
seg->charset= &my_charset_bin;
|
||||
else
|
||||
seg->charset= field->charset();
|
||||
seg->charset= field->charset_for_protocol();
|
||||
if (field->null_ptr)
|
||||
{
|
||||
seg->null_bit= field->null_bit;
|
||||
|
@ -274,7 +274,7 @@ int table2myisam(TABLE *table_arg, MI_KEYDEF **keydef_out,
|
||||
keydef[i].seg[j].bit_start= keydef[i].seg[j].bit_end=
|
||||
keydef[i].seg[j].bit_length= 0;
|
||||
keydef[i].seg[j].bit_pos= 0;
|
||||
keydef[i].seg[j].language= field->charset()->number;
|
||||
keydef[i].seg[j].language= field->charset_for_protocol()->number;
|
||||
|
||||
if (field->null_ptr)
|
||||
{
|
||||
|
@ -467,10 +467,11 @@ uint my_instr_mb(CHARSET_INFO *cs,
|
||||
|
||||
/* BINARY collations handlers for MB charsets */
|
||||
|
||||
static int my_strnncoll_mb_bin(CHARSET_INFO * cs __attribute__((unused)),
|
||||
const uchar *s, size_t slen,
|
||||
const uchar *t, size_t tlen,
|
||||
my_bool t_is_prefix)
|
||||
int
|
||||
my_strnncoll_mb_bin(CHARSET_INFO * cs __attribute__((unused)),
|
||||
const uchar *s, size_t slen,
|
||||
const uchar *t, size_t tlen,
|
||||
my_bool t_is_prefix)
|
||||
{
|
||||
size_t len=min(slen,tlen);
|
||||
int cmp= memcmp(s,t,len);
|
||||
@ -503,10 +504,11 @@ static int my_strnncoll_mb_bin(CHARSET_INFO * cs __attribute__((unused)),
|
||||
0 if strings are equal
|
||||
*/
|
||||
|
||||
static int my_strnncollsp_mb_bin(CHARSET_INFO * cs __attribute__((unused)),
|
||||
const uchar *a, size_t a_length,
|
||||
const uchar *b, size_t b_length,
|
||||
my_bool diff_if_only_endspace_difference)
|
||||
int
|
||||
my_strnncollsp_mb_bin(CHARSET_INFO * cs __attribute__((unused)),
|
||||
const uchar *a, size_t a_length,
|
||||
const uchar *b, size_t b_length,
|
||||
my_bool diff_if_only_endspace_difference)
|
||||
{
|
||||
const uchar *end;
|
||||
size_t length;
|
||||
@ -562,14 +564,17 @@ static size_t my_strnxfrm_mb_bin(CHARSET_INFO *cs __attribute__((unused)),
|
||||
}
|
||||
|
||||
|
||||
static int my_strcasecmp_mb_bin(CHARSET_INFO * cs __attribute__((unused)),
|
||||
const char *s, const char *t)
|
||||
int
|
||||
my_strcasecmp_mb_bin(CHARSET_INFO * cs __attribute__((unused)),
|
||||
const char *s, const char *t)
|
||||
{
|
||||
return strcmp(s,t);
|
||||
}
|
||||
|
||||
static void my_hash_sort_mb_bin(CHARSET_INFO *cs __attribute__((unused)),
|
||||
const uchar *key, size_t len,ulong *nr1, ulong *nr2)
|
||||
|
||||
void
|
||||
my_hash_sort_mb_bin(CHARSET_INFO *cs __attribute__((unused)),
|
||||
const uchar *key, size_t len,ulong *nr1, ulong *nr2)
|
||||
{
|
||||
const uchar *pos = key;
|
||||
|
||||
@ -787,10 +792,11 @@ fill_max_and_min:
|
||||
}
|
||||
|
||||
|
||||
static int my_wildcmp_mb_bin(CHARSET_INFO *cs,
|
||||
const char *str,const char *str_end,
|
||||
const char *wildstr,const char *wildend,
|
||||
int escape, int w_one, int w_many)
|
||||
int
|
||||
my_wildcmp_mb_bin(CHARSET_INFO *cs,
|
||||
const char *str,const char *str_end,
|
||||
const char *wildstr,const char *wildend,
|
||||
int escape, int w_one, int w_many)
|
||||
{
|
||||
int result= -1; /* Not found, using wildcards */
|
||||
|
||||
|
1986
strings/ctype-uca.c
1986
strings/ctype-uca.c
File diff suppressed because it is too large
Load Diff
3916
strings/ctype-ucs2.c
3916
strings/ctype-ucs2.c
File diff suppressed because it is too large
Load Diff
1054
strings/ctype-utf8.c
1054
strings/ctype-utf8.c
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user