Merge joreland@bk-internal.mysql.com:/home/bk/mysql-5.0

into mysql.com:/home/jonas/src/mysql-5.0
This commit is contained in:
joreland@mysql.com 2005-01-26 15:19:13 +01:00
commit dde469a91e
40 changed files with 201 additions and 59 deletions

View file

@ -382,8 +382,11 @@ libmysqld/examples/link_sources
libmysqld/examples/my_readline.h
libmysqld/examples/mysql
libmysqld/examples/mysql.cc
libmysqld/examples/mysql_client_test.c
libmysqld/examples/mysql_client_test_embedded
libmysqld/examples/mysqltest
libmysqld/examples/mysqltest.c
libmysqld/examples/mysqltest_embedded
libmysqld/examples/readline.cc
libmysqld/examples/sql_string.cc
libmysqld/examples/sql_string.h

13
BUILD/compile-pentium64-debug Executable file
View file

@ -0,0 +1,13 @@
#! /bin/sh
path=`dirname $0`
. "$path/SETUP.sh"
extra_flags="$pentium64_cflags $debug_cflags"
c_warnings="$c_warnings $debug_extra_warnings"
cxx_warnings="$cxx_warnings $debug_extra_warnings"
extra_configs="$pentium_configs $debug_configs $static_link"
extra_configs="$extra_configs "
. "$path/FINISH.sh"

View file

@ -744,7 +744,7 @@ static int parse_args(int *argc, char*** argv)
static MYSQL* safe_connect()
{
MYSQL *local_mysql = mysql_init(NULL);
MYSQL *local_mysql= mysql_init(NULL);
if (!local_mysql)
die("Failed on mysql_init");
@ -752,9 +752,13 @@ static MYSQL* safe_connect()
if (opt_protocol)
mysql_options(local_mysql, MYSQL_OPT_PROTOCOL, (char*) &opt_protocol);
if (!mysql_real_connect(local_mysql, host, user, pass, 0, port, sock, 0))
die("failed on connect: %s", mysql_error(local_mysql));
{
char errmsg[256];
strmake(errmsg, mysql_error(local_mysql), sizeof(errmsg)-1);
mysql_close(local_mysql);
die("failed on connect: %s", errmsg);
}
local_mysql->reconnect= 1;
return local_mysql;
}
@ -781,9 +785,8 @@ static int check_master_version(MYSQL* mysql,
if (mysql_query(mysql, "SELECT VERSION()") ||
!(res = mysql_store_result(mysql)))
{
char errmsg[FN_REFLEN];
strmake(errmsg, mysql_error(mysql), sizeof(errmsg) - 1);
char errmsg[256];
strmake(errmsg, mysql_error(mysql), sizeof(errmsg)-1);
mysql_close(mysql);
die("Error checking master version: %s", errmsg);
}

View file

@ -110,6 +110,7 @@ typedef struct my_collation_handler_st
my_bool diff_if_only_endspace_difference);
int (*strnxfrm)(struct charset_info_st *,
uchar *, uint, const uchar *, uint);
uint (*strnxfrmlen)(struct charset_info_st *, uint);
my_bool (*like_range)(struct charset_info_st *,
const char *s, uint s_length,
pchar w_prefix, pchar w_one, pchar w_many,
@ -259,7 +260,8 @@ extern CHARSET_INFO my_charset_cp1250_czech_ci;
/* declarations for simple charsets */
extern int my_strnxfrm_simple(CHARSET_INFO *, uchar *, uint, const uchar *,
uint);
uint);
uint my_strnxfrmlen_simple(CHARSET_INFO *, uint);
extern int my_strnncoll_simple(CHARSET_INFO *, const uchar *, uint,
const uchar *, uint, my_bool);

View file

@ -205,8 +205,6 @@ eval_node_copy_and_alloc_val(
{
byte* data;
ut_ad(UNIV_SQL_NULL > ULINT_MAX);
if (len == UNIV_SQL_NULL) {
dfield_set_len(que_node_get_val(node), len);

View file

@ -80,10 +80,8 @@ memory is read outside the allocated blocks. */
/* Make a non-inline debug version */
#ifdef DBUG_ON
# define UNIV_DEBUG
#endif /* DBUG_ON */
/*
#define UNIV_DEBUG
#define UNIV_MEM_DEBUG
#define UNIV_IBUF_DEBUG
#define UNIV_SYNC_DEBUG
@ -122,7 +120,7 @@ by one. */
/* Definition for inline version */
#ifdef __WIN__
#define UNIV_INLINE __inline
#define UNIV_INLINE __inline
#else
/* config.h contains the right def for 'inline' for the current compiler */
#if (__GNUC__ == 2)

View file

@ -0,0 +1,4 @@
-- require r/ndb_default_cluster.require
disable_query_log;
show status like "Ndb_connected_host";
enable_query_log;

View file

@ -34,13 +34,13 @@ col5 enum('PENDING', 'ACTIVE', 'DISABLED') not null,
col6 int not null, to_be_deleted int) ENGINE=ndbcluster;
show table status;
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t1 ndbcluster 10 Dynamic 0 0 0 0 0 0 1 NULL NULL NULL latin1_swedish_ci NULL number_of_replicas: 2
t1 ndbcluster 10 Dynamic 0 0 # # 0 # 1 # # # latin1_swedish_ci NULL #
SET SQL_MODE=NO_AUTO_VALUE_ON_ZERO;
insert into t1 values
(0,4,3,5,"PENDING",1,7),(NULL,4,3,5,"PENDING",1,7),(31,4,3,5,"PENDING",1,7), (7,4,3,5,"PENDING",1,7), (NULL,4,3,5,"PENDING",1,7), (100,4,3,5,"PENDING",1,7), (99,4,3,5,"PENDING",1,7), (8,4,3,5,"PENDING",1,7), (NULL,4,3,5,"PENDING",1,7);
show table status;
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t1 ndbcluster 10 Dynamic 9 96 131072 0 0 0 101 NULL NULL NULL latin1_swedish_ci NULL number_of_replicas: 2
t1 ndbcluster 10 Dynamic 9 96 # # 0 # 101 # # # latin1_swedish_ci NULL #
select * from t1 order by col1;
col1 col2 col3 col4 col5 col6 to_be_deleted
0 4 3 5 PENDING 1 7
@ -60,7 +60,7 @@ change column col2 fourth varchar(30) not null after col3,
modify column col6 int not null first;
show table status;
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t1 ndbcluster 10 Dynamic 9 152 131072 0 0 0 102 NULL NULL NULL latin1_swedish_ci NULL number_of_replicas: 2
t1 ndbcluster 10 Dynamic 9 152 # # 0 # 102 # # # latin1_swedish_ci NULL #
select * from t1 order by col1;
col6 col1 col3 fourth col4 col4_5 col5 col7 col8
1 0 3 4 5 PENDING 0000-00-00 00:00:00
@ -75,7 +75,7 @@ col6 col1 col3 fourth col4 col4_5 col5 col7 col8
insert into t1 values (2, NULL,4,3,5,99,"PENDING","EXTRA",'2004-01-01 00:00:00');
show table status;
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t1 ndbcluster 10 Dynamic 10 152 131072 0 0 0 103 NULL NULL NULL latin1_swedish_ci NULL number_of_replicas: 2
t1 ndbcluster 10 Dynamic 10 152 # # 0 # 103 # # # latin1_swedish_ci NULL #
select * from t1 order by col1;
col6 col1 col3 fourth col4 col4_5 col5 col7 col8
1 0 3 4 5 PENDING 0000-00-00 00:00:00

View file

@ -144,8 +144,8 @@ Handler_discover 1
flush tables;
show table status;
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t6 MyISAM 9 Fixed 1 260 # # # 0 NULL # # NULL # NULL
t7 ndbcluster 9 Fixed 1 276 # # # 0 NULL # # NULL # NULL number_of_replicas: 2
t6 MyISAM 9 Fixed 1 260 # # # 0 NULL # # NULL # NULL #
t7 ndbcluster 9 Fixed 1 276 # # # 0 NULL # # NULL # NULL #
show status like 'handler_discover%';
Variable_name Value
Handler_discover 2

View file

@ -0,0 +1,2 @@
Variable_name Value
Ndb_connected_host localhost

View file

@ -612,3 +612,17 @@ a b c
3 NULL NULL
4 4 NULL
drop table t1, t8;
create table t1(
id integer not null auto_increment,
month integer not null,
year integer not null,
code varchar( 2) not null,
primary key ( id),
unique idx_t1( month, code, year)
) engine=ndb;
INSERT INTO t1 (month, year, code) VALUES (4,2004,'12');
INSERT INTO t1 (month, year, code) VALUES (5,2004,'12');
select * from t1 where code = '12' and month = 4 and year = 2004 ;
id month year code
1 4 2004 12
drop table t1;

View file

@ -47,10 +47,12 @@ col3 varchar (20) not null,
col4 varchar(4) not null,
col5 enum('PENDING', 'ACTIVE', 'DISABLED') not null,
col6 int not null, to_be_deleted int) ENGINE=ndbcluster;
--replace_column 7 # 8 # 10 # 12 # 13 # 14 # 18 #
show table status;
SET SQL_MODE=NO_AUTO_VALUE_ON_ZERO;
insert into t1 values
(0,4,3,5,"PENDING",1,7),(NULL,4,3,5,"PENDING",1,7),(31,4,3,5,"PENDING",1,7), (7,4,3,5,"PENDING",1,7), (NULL,4,3,5,"PENDING",1,7), (100,4,3,5,"PENDING",1,7), (99,4,3,5,"PENDING",1,7), (8,4,3,5,"PENDING",1,7), (NULL,4,3,5,"PENDING",1,7);
--replace_column 7 # 8 # 10 # 12 # 13 # 14 # 18 #
show table status;
select * from t1 order by col1;
alter table t1
@ -59,9 +61,11 @@ add column col7 varchar(30) not null after col5,
add column col8 datetime not null, drop column to_be_deleted,
change column col2 fourth varchar(30) not null after col3,
modify column col6 int not null first;
--replace_column 7 # 8 # 10 # 12 # 13 # 14 # 18 #
show table status;
select * from t1 order by col1;
insert into t1 values (2, NULL,4,3,5,99,"PENDING","EXTRA",'2004-01-01 00:00:00');
--replace_column 7 # 8 # 10 # 12 # 13 # 14 # 18 #
show table status;
select * from t1 order by col1;
delete from t1;

View file

@ -176,7 +176,7 @@ show status like 'handler_discover%';
flush tables;
system rm var/master-data/test/t7.frm ;
--replace_column 7 # 8 # 9 # 12 # 13 # 15 #
--replace_column 7 # 8 # 9 # 12 # 13 # 15 # 18 #
show table status;
show status like 'handler_discover%';

View file

@ -286,3 +286,24 @@ select * from t8 order by a;
select * from t1 order by a;
drop table t1, t8;
###############################
# Bug 8101
#
# Unique index not specified in the same order as in table
#
create table t1(
id integer not null auto_increment,
month integer not null,
year integer not null,
code varchar( 2) not null,
primary key ( id),
unique idx_t1( month, code, year)
) engine=ndb;
INSERT INTO t1 (month, year, code) VALUES (4,2004,'12');
INSERT INTO t1 (month, year, code) VALUES (5,2004,'12');
select * from t1 where code = '12' and month = 4 and year = 2004 ;
drop table t1;

View file

@ -1,4 +1,5 @@
-- source include/have_ndb.inc
-- source include/ndb_default_cluster.inc
--disable_warnings
use test;

View file

@ -1187,7 +1187,7 @@ sortlength(SORT_FIELD *sortorder, uint s_length, bool *multi_byte_charset)
{
sortorder->need_strxnfrm= 1;
*multi_byte_charset= 1;
sortorder->length= sortorder->length*cs->strxfrm_multiply;
sortorder->length= cs->coll->strnxfrmlen(cs, sortorder->length);
}
}
if (sortorder->field->maybe_null())
@ -1200,7 +1200,7 @@ sortlength(SORT_FIELD *sortorder, uint s_length, bool *multi_byte_charset)
sortorder->length=sortorder->item->max_length;
if (use_strnxfrm((cs=sortorder->item->collation.collation)))
{
sortorder->length= sortorder->length*cs->strxfrm_multiply;
sortorder->length= cs->coll->strnxfrmlen(cs, sortorder->length);
sortorder->need_strxnfrm= 1;
*multi_byte_charset= 1;
}

View file

@ -852,6 +852,42 @@ int ha_ndbcluster::get_metadata(const char *path)
DBUG_RETURN(build_index_list(table, ILBP_OPEN));
}
static int fix_unique_index_attr_order(NDB_INDEX_DATA &data,
const NDBINDEX *index,
KEY *key_info)
{
DBUG_ENTER("fix_unique_index_attr_order");
unsigned sz= index->getNoOfIndexColumns();
if (data.unique_index_attrid_map)
my_free((char*)data.unique_index_attrid_map, MYF(0));
data.unique_index_attrid_map= (unsigned char*)my_malloc(sz,MYF(MY_WME));
KEY_PART_INFO* key_part= key_info->key_part;
KEY_PART_INFO* end= key_part+key_info->key_parts;
DBUG_ASSERT(key_info->key_parts == sz);
for (unsigned i= 0; key_part != end; key_part++, i++)
{
const char *field_name= key_part->field->field_name;
unsigned name_sz= strlen(field_name);
if (name_sz >= NDB_MAX_ATTR_NAME_SIZE)
name_sz= NDB_MAX_ATTR_NAME_SIZE-1;
#ifndef DBUG_OFF
data.unique_index_attrid_map[i]= 255;
#endif
for (unsigned j= 0; j < sz; j++)
{
const NdbDictionary::Column *c= index->getColumn(j);
if (strncmp(field_name, c->getName(), name_sz) == 0)
{
data.unique_index_attrid_map[i]= j;
break;
}
}
DBUG_ASSERT(data.unique_index_attrid_map[i] != 255);
}
DBUG_RETURN(0);
}
int ha_ndbcluster::build_index_list(TABLE *tab, enum ILBP phase)
{
@ -926,7 +962,8 @@ int ha_ndbcluster::build_index_list(TABLE *tab, enum ILBP phase)
const NDBINDEX *index= dict->getIndex(unique_index_name, m_tabname);
if (!index) DBUG_RETURN(1);
m_index[i].unique_index= (void *) index;
}
error= fix_unique_index_attr_order(m_index[i], index, key_info);
}
}
DBUG_RETURN(error);
@ -984,6 +1021,11 @@ void ha_ndbcluster::release_metadata()
{
m_index[i].unique_index= NULL;
m_index[i].index= NULL;
if (m_index[i].unique_index_attrid_map)
{
my_free((char *)m_index[i].unique_index_attrid_map, MYF(0));
m_index[i].unique_index_attrid_map= NULL;
}
}
DBUG_VOID_RETURN;
@ -1152,7 +1194,7 @@ ha_ndbcluster::set_index_key(NdbOperation *op,
const byte* ptr= key_part->null_bit ? key_ptr + 1 : key_ptr;
char buf[256];
shrink_varchar(field, ptr, buf);
if (set_ndb_key(op, field, i, ptr))
if (set_ndb_key(op, field, m_index[active_index].unique_index_attrid_map[i], ptr))
ERR_RETURN(m_active_trans->getNdbError());
key_ptr+= key_part->store_length;
}
@ -1655,13 +1697,10 @@ int ha_ndbcluster::set_bounds(NdbIndexScanOperation *op,
// Set bound if not cancelled via type -1
if (p.bound_type != -1)
{
char truncated_field_name[NDB_MAX_ATTR_NAME_SIZE];
strnmov(truncated_field_name,field->field_name,sizeof(truncated_field_name));
truncated_field_name[sizeof(truncated_field_name)-1]= '\0';
const char* ptr= p.bound_ptr;
char buf[256];
shrink_varchar(field, ptr, buf);
if (op->setBound(truncated_field_name, p.bound_type, ptr))
if (op->setBound(i, p.bound_type, ptr))
ERR_RETURN(op->getNdbError());
}
}
@ -3990,9 +4029,10 @@ ha_ndbcluster::ha_ndbcluster(TABLE *table_arg):
for (i= 0; i < MAX_KEY; i++)
{
m_index[i].type= UNDEFINED_INDEX;
m_index[i].unique_index= NULL;
m_index[i].index= NULL;
m_index[i].type= UNDEFINED_INDEX;
m_index[i].unique_index= NULL;
m_index[i].index= NULL;
m_index[i].unique_index_attrid_map= NULL;
}
DBUG_VOID_RETURN;

View file

@ -51,6 +51,7 @@ typedef struct ndb_index_data {
NDB_INDEX_TYPE type;
void *index;
void *unique_index;
unsigned char *unique_index_attrid_map;
} NDB_INDEX_DATA;
typedef struct st_ndbcluster_share {

View file

@ -370,13 +370,14 @@ Item *create_func_space(Item *a)
{
uint dummy_errors;
sp= new Item_string("",0,cs);
sp->str_value.copy(" ", 1, &my_charset_latin1, cs, &dummy_errors);
if (sp)
sp->str_value.copy(" ", 1, &my_charset_latin1, cs, &dummy_errors);
}
else
{
sp= new Item_string(" ",1,cs);
}
return new Item_func_repeat(sp, a);
return sp ? new Item_func_repeat(sp, a) : 0;
}
Item *create_func_soundex(Item* a)

View file

@ -3036,12 +3036,11 @@ You should consider changing lower_case_table_names to 1 or 2",
(test_if_case_insensitive(mysql_real_data_home) == 1)))
{
if (global_system_variables.log_warnings)
sql_print_warning("\
You have forced lower_case_table_names to 2 through a command-line \
option, even though your file system '%s' is case sensitive. This means \
that you can create a table that you can then no longer access. \
You should consider changing lower_case_table_names to 0.",
sql_print_warning("lower_case_table_names was set to 2, even though your "
"the file system '%s' is case sensitive. Now setting "
"lower_case_table_names to 0 to avoid future problems.",
mysql_real_data_home);
lower_case_table_names= 0;
}
select_thread=pthread_self();

View file

@ -558,8 +558,13 @@ SQL_SELECT *prepare_simple_select(THD *thd, Item *cond, TABLE_LIST *tables,
{
if (!cond->fixed)
cond->fix_fields(thd, tables, &cond); // can never fail
/* Assume that no indexes cover all required fields */
table->used_keys.clear_all();
SQL_SELECT *res= make_select(table,0,0,cond,error);
if (*error || (res && res->check_quick(thd, 0, HA_POS_ERROR)))
if (*error || (res && res->check_quick(thd, 0, HA_POS_ERROR)) ||
(res->quick && res->quick->reset()))
{
delete res;
res=0;

View file

@ -4473,16 +4473,9 @@ find_best(JOIN *join,table_map rest_tables,uint idx,double record_count,
x = used key parts (1 <= x <= c)
*/
double rec_per_key;
#if 0
if (!(rec_per_key=(double)
keyinfo->rec_per_key[keyinfo->key_parts-1]))
rec_per_key=(double) s->records/rec+1;
#else
rec_per_key= keyinfo->rec_per_key[keyinfo->key_parts-1] ?
(double) keyinfo->rec_per_key[keyinfo->key_parts-1] :
(double) s->records/rec+1;
#endif
if (!s->records)
tmp=0;
else if (rec_per_key/(double) s->records >= 0.01)

View file

@ -6293,6 +6293,7 @@ static MY_COLLATION_HANDLER my_collation_big5_chinese_ci_handler =
my_strnncoll_big5,
my_strnncollsp_big5,
my_strnxfrm_big5,
my_strnxfrmlen_simple,
my_like_range_big5,
my_wildcmp_mb,
my_strcasecmp_mb,

View file

@ -447,6 +447,7 @@ MY_COLLATION_HANDLER my_collation_8bit_bin_handler =
my_strnncoll_8bit_bin,
my_strnncollsp_8bit_bin,
my_strnxfrm_8bit_bin,
my_strnxfrmlen_simple,
my_like_range_simple,
my_wildcmp_bin,
my_strcasecmp_bin,
@ -461,6 +462,7 @@ static MY_COLLATION_HANDLER my_collation_binary_handler =
my_strnncoll_binary,
my_strnncollsp_binary,
my_strnxfrm_bin,
my_strnxfrmlen_simple,
my_like_range_simple,
my_wildcmp_bin,
my_strcasecmp_bin,

View file

@ -5454,6 +5454,7 @@ static MY_COLLATION_HANDLER my_collation_ci_handler =
my_strnncoll_cp932,
my_strnncollsp_cp932,
my_strnxfrm_cp932,
my_strnxfrmlen_simple,
my_like_range_cp932,
my_wildcmp_mb, /* wildcmp */
my_strcasecmp_8bit,

View file

@ -593,6 +593,7 @@ static MY_COLLATION_HANDLER my_collation_latin2_czech_ci_handler =
my_strnncoll_czech,
my_strnncollsp_czech,
my_strnxfrm_czech,
my_strnxfrmlen_simple,
my_like_range_czech,
my_wildcmp_8bit,
my_strcasecmp_8bit,

View file

@ -8641,6 +8641,7 @@ static MY_COLLATION_HANDLER my_collation_ci_handler =
my_strnncoll_simple, /* strnncoll */
my_strnncollsp_simple,
my_strnxfrm_simple, /* strnxfrm */
my_strnxfrmlen_simple,
my_like_range_simple, /* like_range */
my_wildcmp_mb, /* wildcmp */
my_strcasecmp_mb,

View file

@ -8636,6 +8636,7 @@ static MY_COLLATION_HANDLER my_collation_ci_handler =
my_strnncoll_simple,/* strnncoll */
my_strnncollsp_simple,
my_strnxfrm_simple, /* strnxfrm */
my_strnxfrmlen_simple,
my_like_range_simple,/* like_range */
my_wildcmp_mb, /* wildcmp */
my_strcasecmp_mb,

View file

@ -5692,6 +5692,7 @@ static MY_COLLATION_HANDLER my_collation_ci_handler =
my_strnncoll_simple, /* strnncoll */
my_strnncollsp_simple,
my_strnxfrm_simple, /* strnxfrm */
my_strnxfrmlen_simple,
my_like_range_simple, /* like_range */
my_wildcmp_mb, /* wildcmp */
my_strcasecmp_mb, /* instr */

View file

@ -9939,6 +9939,7 @@ static MY_COLLATION_HANDLER my_collation_ci_handler =
my_strnncoll_gbk,
my_strnncollsp_gbk,
my_strnxfrm_gbk,
my_strnxfrmlen_simple,
my_like_range_gbk,
my_wildcmp_mb,
my_strcasecmp_mb,

View file

@ -693,6 +693,7 @@ static MY_COLLATION_HANDLER my_collation_german2_ci_handler=
my_strnncoll_latin1_de,
my_strnncollsp_latin1_de,
my_strnxfrm_latin1_de,
my_strnxfrmlen_simple,
my_like_range_simple,
my_wildcmp_8bit,
my_strcasecmp_8bit,

View file

@ -912,6 +912,7 @@ MY_COLLATION_HANDLER my_collation_mb_bin_handler =
my_strnncoll_mb_bin,
my_strnncollsp_mb_bin,
my_strnxfrm_mb_bin,
my_strnxfrmlen_simple,
my_like_range_simple,
my_wildcmp_mb_bin,
my_strcasecmp_mb_bin,

View file

@ -21,6 +21,15 @@
#include "stdarg.h"
/*
Returns the number of bytes required for strnxfrm().
*/
uint my_strnxfrmlen_simple(CHARSET_INFO *cs, uint len)
{
return len * (cs->strxfrm_multiply ? cs->strxfrm_multiply : 1);
}
/*
Converts a string into its sort key.
@ -1365,6 +1374,7 @@ MY_COLLATION_HANDLER my_collation_8bit_simple_ci_handler =
my_strnncoll_simple,
my_strnncollsp_simple,
my_strnxfrm_simple,
my_strnxfrmlen_simple,
my_like_range_simple,
my_wildcmp_8bit,
my_strcasecmp_8bit,

View file

@ -4627,6 +4627,7 @@ static MY_COLLATION_HANDLER my_collation_ci_handler =
my_strnncoll_sjis,
my_strnncollsp_sjis,
my_strnxfrm_sjis,
my_strnxfrmlen_simple,
my_like_range_sjis,
my_wildcmp_mb, /* wildcmp */
my_strcasecmp_8bit,

View file

@ -927,6 +927,7 @@ static MY_COLLATION_HANDLER my_collation_ci_handler =
my_strnncoll_tis620,
my_strnncollsp_tis620,
my_strnxfrm_tis620,
my_strnxfrmlen_simple,
my_like_range_tis620,
my_wildcmp_8bit, /* wildcmp */
my_strcasecmp_8bit,

View file

@ -8024,6 +8024,7 @@ MY_COLLATION_HANDLER my_collation_ucs2_uca_handler =
my_strnncoll_ucs2_uca,
my_strnncollsp_ucs2_uca,
my_strnxfrm_ucs2_uca,
my_strnxfrmlen_simple,
my_like_range_ucs2,
my_wildcmp_uca,
NULL,
@ -8504,6 +8505,7 @@ MY_COLLATION_HANDLER my_collation_any_uca_handler =
my_strnncoll_any_uca,
my_strnncollsp_any_uca,
my_strnxfrm_any_uca,
my_strnxfrmlen_simple,
my_like_range_mb,
my_wildcmp_uca,
NULL,

View file

@ -1499,6 +1499,7 @@ static MY_COLLATION_HANDLER my_collation_ucs2_general_ci_handler =
my_strnncoll_ucs2,
my_strnncollsp_ucs2,
my_strnxfrm_ucs2,
my_strnxfrmlen_simple,
my_like_range_ucs2,
my_wildcmp_ucs2_ci,
my_strcasecmp_ucs2,
@ -1513,6 +1514,7 @@ static MY_COLLATION_HANDLER my_collation_ucs2_bin_handler =
my_strnncoll_ucs2_bin,
my_strnncollsp_ucs2_bin,
my_strnxfrm_ucs2_bin,
my_strnxfrmlen_simple,
my_like_range_simple,
my_wildcmp_ucs2_bin,
my_strcasecmp_ucs2_bin,

View file

@ -8501,6 +8501,7 @@ static MY_COLLATION_HANDLER my_collation_ci_handler =
my_strnncoll_simple,/* strnncoll */
my_strnncollsp_simple,
my_strnxfrm_simple, /* strnxfrm */
my_strnxfrmlen_simple,
my_like_range_simple,/* like_range */
my_wildcmp_mb, /* wildcmp */
my_strcasecmp_mb,

View file

@ -2238,6 +2238,12 @@ int my_wildcmp_utf8(CHARSET_INFO *cs,
}
static
uint my_strnxfrmlen_utf8(CHARSET_INFO *cs __attribute__((unused)), uint len)
{
return (len * 2 + 2) / 3;
}
static int my_strnxfrm_utf8(CHARSET_INFO *cs,
uchar *dst, uint dstlen,
const uchar *src, uint srclen)
@ -2245,29 +2251,33 @@ static int my_strnxfrm_utf8(CHARSET_INFO *cs,
my_wc_t wc;
int res;
int plane;
uchar *de = dst + dstlen;
uchar *de= dst + dstlen;
uchar *de_beg= de - 1;
const uchar *se = src + srclen;
while( src < se && dst < de )
while (dst < de_beg)
{
if ((res=my_utf8_uni(cs,&wc, src, se))<0)
{
if ((res=my_utf8_uni(cs,&wc, src, se)) <= 0)
break;
}
src+=res;
srclen-=res;
plane=(wc>>8) & 0xFF;
wc = uni_plane[plane] ? uni_plane[plane][wc & 0xFF].sort : wc;
if ((res=my_uni_utf8(cs,wc,dst,de)) <0)
{
break;
}
dst+=res;
*dst++= wc >> 8;
*dst++= wc & 0xFF;
}
if (dst < de)
bfill(dst, de - dst, ' ');
while (dst < de_beg) /* Fill the tail with keys for space character */
{
*dst++= 0x00;
*dst++= 0x20;
}
if (dst < de) /* Clear the last byte, if "dstlen" was an odd number */
*de= 0x00;
return dstlen;
}
@ -2306,6 +2316,7 @@ static MY_COLLATION_HANDLER my_collation_ci_handler =
my_strnncoll_utf8,
my_strnncollsp_utf8,
my_strnxfrm_utf8,
my_strnxfrmlen_utf8,
my_like_range_mb,
my_wildcmp_utf8,
my_strcasecmp_utf8,

View file

@ -626,6 +626,7 @@ static MY_COLLATION_HANDLER my_collation_czech_ci_handler =
my_strnncoll_win1250ch,
my_strnncollsp_win1250ch,
my_strnxfrm_win1250ch,
my_strnxfrmlen_simple,
my_like_range_win1250ch,
my_wildcmp_8bit,
my_strcasecmp_8bit,