summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
Diffstat (limited to 'sql')
-rw-r--r--sql/convert.cc5
-rw-r--r--sql/field.cc681
-rw-r--r--sql/field.h10
-rw-r--r--sql/field_conv.cc9
-rw-r--r--sql/ha_berkeley.cc11
-rw-r--r--sql/ha_innodb.cc290
-rw-r--r--sql/ha_innodb.h3
-rw-r--r--sql/ha_myisam.cc46
-rw-r--r--sql/ha_myisam.h2
-rw-r--r--sql/ha_myisammrg.cc11
-rw-r--r--sql/item.cc35
-rw-r--r--sql/item.h22
-rw-r--r--sql/item_cmpfunc.cc57
-rw-r--r--sql/item_cmpfunc.h3
-rw-r--r--sql/item_create.cc14
-rw-r--r--sql/item_create.h1
-rw-r--r--sql/item_func.cc27
-rw-r--r--sql/item_func.h16
-rw-r--r--sql/item_row.cc2
-rw-r--r--sql/item_strfunc.cc49
-rw-r--r--sql/item_strfunc.h17
-rw-r--r--sql/item_sum.cc8
-rw-r--r--sql/item_sum.h7
-rw-r--r--sql/item_timefunc.cc2
-rw-r--r--sql/lex.h3
-rw-r--r--sql/log.cc43
-rw-r--r--sql/log_event.cc517
-rw-r--r--sql/log_event.h48
-rw-r--r--sql/mf_iocache.cc4
-rw-r--r--sql/mini_client.cc15
-rw-r--r--sql/mysql_priv.h24
-rw-r--r--sql/mysqld.cc635
-rw-r--r--sql/net_serv.cc237
-rw-r--r--sql/opt_range.cc6
-rw-r--r--sql/opt_sum.cc7
-rw-r--r--sql/password.c16
-rw-r--r--sql/procedure.h11
-rw-r--r--sql/protocol.cc158
-rw-r--r--sql/protocol.h25
-rw-r--r--sql/repl_failsafe.cc7
-rw-r--r--sql/repl_failsafe.h2
-rw-r--r--sql/set_var.cc179
-rw-r--r--sql/set_var.h40
-rw-r--r--sql/share/Makefile.am3
-rw-r--r--sql/share/charsets/Index.xml35
-rw-r--r--sql/share/charsets/MacCE.xml (renamed from sql/share/charsets/maccebin.conf)165
-rw-r--r--sql/share/charsets/MacRoman.xml (renamed from sql/share/charsets/macroman.conf)152
-rw-r--r--sql/share/charsets/armscii8.conf93
-rw-r--r--sql/share/charsets/armscii8.xml119
-rw-r--r--sql/share/charsets/ascii.xml (renamed from sql/share/charsets/cp1257bin.conf)109
-rw-r--r--sql/share/charsets/cp1250.xml (renamed from sql/share/charsets/win1250.conf)73
-rw-r--r--sql/share/charsets/cp1251.conf93
-rw-r--r--sql/share/charsets/cp1251.xml (renamed from sql/share/charsets/cp1251cias.conf)175
-rw-r--r--sql/share/charsets/cp1251bin.conf95
-rw-r--r--sql/share/charsets/cp1251csas.conf99
-rw-r--r--sql/share/charsets/cp1256.xml (renamed from sql/share/charsets/cp1256.conf)77
-rw-r--r--sql/share/charsets/cp1257.conf92
-rw-r--r--sql/share/charsets/cp1257.xml229
-rw-r--r--sql/share/charsets/cp1257ltlvciai.conf97
-rw-r--r--sql/share/charsets/cp1257ltlvcias.conf97
-rw-r--r--sql/share/charsets/cp1257ltlvcsas.conf97
-rw-r--r--sql/share/charsets/cp866.xml (renamed from sql/share/charsets/cp866.conf)78
-rw-r--r--sql/share/charsets/croat.conf92
-rw-r--r--sql/share/charsets/danish.conf92
-rw-r--r--sql/share/charsets/dec8.xml (renamed from sql/share/charsets/dec8.conf)73
-rw-r--r--sql/share/charsets/dos.conf93
-rw-r--r--sql/share/charsets/estonia.conf92
-rw-r--r--sql/share/charsets/german1.conf92
-rw-r--r--sql/share/charsets/greek.conf93
-rw-r--r--sql/share/charsets/greek.xml120
-rw-r--r--sql/share/charsets/hebrew.conf93
-rw-r--r--sql/share/charsets/hebrew.xml (renamed from sql/share/charsets/latin1bin.conf)100
-rw-r--r--sql/share/charsets/hp8.conf93
-rw-r--r--sql/share/charsets/hp8.xml120
-rw-r--r--sql/share/charsets/hungarian.conf92
-rw-r--r--sql/share/charsets/keybcs2.xml (renamed from sql/share/charsets/keybcs2.conf)71
-rw-r--r--sql/share/charsets/koi8_ru.conf93
-rw-r--r--sql/share/charsets/koi8r.xml119
-rw-r--r--sql/share/charsets/koi8u.xml (renamed from sql/share/charsets/koi8_ukr.conf)72
-rw-r--r--sql/share/charsets/latin1.conf92
-rw-r--r--sql/share/charsets/latin1.xml233
-rw-r--r--sql/share/charsets/latin1cias.conf97
-rw-r--r--sql/share/charsets/latin1csas.conf97
-rw-r--r--sql/share/charsets/latin2.conf92
-rw-r--r--sql/share/charsets/latin2.xml167
-rw-r--r--sql/share/charsets/latin5.conf96
-rw-r--r--sql/share/charsets/latin5.xml125
-rw-r--r--sql/share/charsets/latin7.xml168
-rw-r--r--sql/share/charsets/latvian.conf95
-rw-r--r--sql/share/charsets/latvian1.conf94
-rw-r--r--sql/share/charsets/macce.conf91
-rw-r--r--sql/share/charsets/macceciai.conf96
-rw-r--r--sql/share/charsets/maccecias.conf96
-rw-r--r--sql/share/charsets/maccecsas.conf96
-rw-r--r--sql/share/charsets/macromanbin.conf96
-rw-r--r--sql/share/charsets/macromanciai.conf97
-rw-r--r--sql/share/charsets/macromancias.conf97
-rw-r--r--sql/share/charsets/macromancsas.conf97
-rw-r--r--sql/share/charsets/pclatin1.xml119
-rw-r--r--sql/share/charsets/pclatin2.xml (renamed from sql/share/charsets/pclatin2.conf)70
-rw-r--r--sql/share/charsets/swe7.xml (renamed from sql/share/charsets/swe7.conf)73
-rw-r--r--sql/share/charsets/usa7.conf92
-rw-r--r--sql/share/charsets/win1251.conf100
-rw-r--r--sql/share/charsets/win1251ukr.conf95
-rw-r--r--sql/share/english/errmsg.txt4
-rw-r--r--sql/share/italian/errmsg.txt38
-rw-r--r--sql/slave.cc45
-rw-r--r--sql/slave.h16
-rw-r--r--sql/sql_acl.cc63
-rw-r--r--sql/sql_analyse.cc1
-rw-r--r--sql/sql_base.cc68
-rw-r--r--sql/sql_cache.cc28
-rw-r--r--sql/sql_class.cc24
-rw-r--r--sql/sql_class.h32
-rw-r--r--sql/sql_db.cc23
-rw-r--r--sql/sql_derived.cc105
-rw-r--r--sql/sql_error.cc32
-rw-r--r--sql/sql_handler.cc14
-rw-r--r--sql/sql_insert.cc21
-rw-r--r--sql/sql_lex.cc97
-rw-r--r--sql/sql_lex.h12
-rw-r--r--sql/sql_load.cc62
-rw-r--r--sql/sql_parse.cc369
-rw-r--r--sql/sql_prepare.cc185
-rw-r--r--sql/sql_repl.cc81
-rw-r--r--sql/sql_repl.h4
-rw-r--r--sql/sql_select.cc174
-rw-r--r--sql/sql_select.h1
-rw-r--r--sql/sql_show.cc217
-rw-r--r--sql/sql_string.cc156
-rw-r--r--sql/sql_string.h1
-rw-r--r--sql/sql_table.cc96
-rw-r--r--sql/sql_test.cc2
-rw-r--r--sql/sql_update.cc8
-rw-r--r--sql/sql_yacc.yy198
-rw-r--r--sql/structs.h2
-rw-r--r--sql/table.cc2
-rw-r--r--sql/table.h2
138 files changed, 6051 insertions, 5686 deletions
diff --git a/sql/convert.cc b/sql/convert.cc
index 155cb57f9fe..29abdde7ddc 100644
--- a/sql/convert.cc
+++ b/sql/convert.cc
@@ -457,9 +457,6 @@ bool CONVERT::store(String *packet,const char *from,uint length)
return 1;
char *to=(char*) net_store_length((char*) packet->ptr()+packet_length,
(ulonglong)length);
-
- for (const char *end=from+length ; from != end ; from++)
- *to++= to_map[(uchar) *from];
- packet->length((uint) (to-packet->ptr()));
+ packet->length((uint) (store_dest(to, from, length)-packet->ptr()));
return 0;
}
diff --git a/sql/field.cc b/sql/field.cc
index 0813c1fc6cc..a0fd8c12f9d 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -34,8 +34,6 @@
// Maximum allowed exponent value for converting string to decimal
#define MAX_EXPONENT 1024
-
-
/*****************************************************************************
Instansiate templates and static variables
*****************************************************************************/
@@ -67,39 +65,44 @@ void Field_num::prepend_zeros(String *value)
/*
Test if given number is a int (or a fixed format float with .000)
- This is only used to give warnings in ALTER TABLE or LOAD DATA...
+
+ SYNOPSIS
+ test_if_int()
+ str String to test
+ end Pointer to char after last used digit
+ cs Character set
+
+ NOTES
+ This is called after one has called my_strntol() or similar function.
+ This is only used to give warnings in ALTER TABLE or LOAD DATA...
+
+ TODO
+ Make this multi-byte-character safe
+
+ RETURN
+ 0 ok
+ 1 error
*/
-bool test_if_int(const char *str,int length, CHARSET_INFO *cs)
+bool test_if_int(const char *str, int length, const char *int_end,
+ CHARSET_INFO *cs)
{
+ if (str == int_end)
+ return 0; // Empty string
const char *end=str+length;
+ if ((str= int_end) == end)
+ return 1; // All digits was used
- cs=system_charset_info; // QQ move test_if_int into CHARSET_INFO struct
-
- // Allow start space
- while (str != end && my_isspace(cs,*str))
- str++; /* purecov: inspected */
- if (str != end && (*str == '-' || *str == '+'))
- str++;
- if (str == end)
- return 0; // Error: Empty string
- for (; str != end ; str++)
+ /* Allow end .0000 */
+ if (*str == '.')
{
- if (!my_isdigit(cs,*str))
- {
- if (*str == '.')
- { // Allow '.0000'
- for (str++ ; str != end && *str == '0'; str++) ;
- if (str == end)
- return 1;
- }
- if (!my_isspace(cs,*str))
- return 0;
- for (str++ ; str != end ; str++)
- if (!my_isspace(cs,*str))
- return 0;
- return 1;
- }
+ for (str++ ; str != end && *str == '0'; str++) ;
+ }
+ /* Allow end space */
+ for (str++ ; str != end ; str++)
+ {
+ if (!my_isspace(cs,*str))
+ return 0;
}
return 1;
}
@@ -107,7 +110,7 @@ bool test_if_int(const char *str,int length, CHARSET_INFO *cs)
static bool test_if_real(const char *str,int length, CHARSET_INFO *cs)
{
- cs=system_charset_info; // QQ move test_if_int into CHARSET_INFO struct
+ cs= system_charset_info; // QQ move test_if_real into CHARSET_INFO struct
while (length && my_isspace(cs,*str))
{ // Allow start space
@@ -207,17 +210,10 @@ bool Field::send_binary(Protocol *protocol)
void Field_num::add_zerofill_and_unsigned(String &res) const
{
- uint oldlen=res.length();
- if (oldlen < res.alloced_length())
- {
- uint len=res.alloced_length()-oldlen;
- char *end=(char*)(res.ptr()+oldlen);
- CHARSET_INFO *cs=res.charset();
- len=cs->snprintf(cs,end,len,"%s%s",
- unsigned_flag ? " unsigned" : "",
- zerofill ? " zerofill" : "");
- res.length(len+oldlen);
- }
+ if (unsigned_flag)
+ res.append(" unsigned");
+ if (zerofill)
+ res.append(" zerofill");
}
void Field_num::make_field(Send_field *field)
@@ -247,19 +243,23 @@ void Field_str::make_field(Send_field *field)
field->decimals=0;
}
+
void Field_str::add_binary_or_charset(String &res) const
{
- uint oldlen=res.length();
- if (oldlen < res.alloced_length())
+ if (binary())
+ res.append(" binary");
+ else if (field_charset != table->table_charset &&
+ !(current_thd->variables.sql_mode & MODE_NO_FIELD_OPTIONS) &&
+ !(current_thd->variables.sql_mode & MODE_MYSQL323) &&
+ !(current_thd->variables.sql_mode & MODE_MYSQL40) &&
+ !(current_thd->variables.sql_mode & MODE_POSTGRESQL) &&
+ !(current_thd->variables.sql_mode & MODE_ORACLE) &&
+ !(current_thd->variables.sql_mode & MODE_MSSQL) &&
+ !(current_thd->variables.sql_mode & MODE_DB2) &&
+ !(current_thd->variables.sql_mode & MODE_SAPDB))
{
- CHARSET_INFO *cs=res.charset();
- uint len=res.alloced_length() - oldlen;
- char *end=(char*)(res.ptr()+oldlen);
- if (binary())
- len=cs->snprintf(cs,end,len," binary");
- else
- len=cs->snprintf(cs,end,len," character set %s",field_charset->name);
- res.length(oldlen+len);
+ res.append(" character set ");
+ res.append(field_charset->csname);
}
}
@@ -287,7 +287,7 @@ uint Field::fill_cache_field(CACHE_FIELD *copy)
bool Field::get_date(TIME *ltime,bool fuzzydate)
{
char buff[40];
- String tmp(buff,sizeof(buff),my_charset_latin1),tmp2,*res;
+ String tmp(buff,sizeof(buff),my_charset_bin),tmp2,*res;
if (!(res=val_str(&tmp,&tmp2)) ||
str_to_TIME(res->ptr(),res->length(),ltime,fuzzydate) == TIMESTAMP_NONE)
return 1;
@@ -297,7 +297,7 @@ bool Field::get_date(TIME *ltime,bool fuzzydate)
bool Field::get_time(TIME *ltime)
{
char buff[40];
- String tmp(buff,sizeof(buff),my_charset_latin1),tmp2,*res;
+ String tmp(buff,sizeof(buff),my_charset_bin),tmp2,*res;
if (!(res=val_str(&tmp,&tmp2)) ||
str_to_time(res->ptr(),res->length(),ltime))
return 1;
@@ -311,23 +311,23 @@ void Field::store_time(TIME *ltime,timestamp_type type)
char buff[25];
switch (type) {
case TIMESTAMP_NONE:
- store("",0,my_charset_latin1); // Probably an error
+ store("",0,my_charset_bin); // Probably an error
break;
case TIMESTAMP_DATE:
sprintf(buff,"%04d-%02d-%02d", ltime->year,ltime->month,ltime->day);
- store(buff,10,my_charset_latin1);
+ store(buff,10,my_charset_bin);
break;
case TIMESTAMP_FULL:
sprintf(buff,"%04d-%02d-%02d %02d:%02d:%02d",
ltime->year,ltime->month,ltime->day,
ltime->hour,ltime->minute,ltime->second);
- store(buff,19,my_charset_latin1);
+ store(buff,19,my_charset_bin);
break;
case TIMESTAMP_TIME:
{
ulong length= my_sprintf(buff, (buff, "%02d:%02d:%02d",
ltime->hour,ltime->minute,ltime->second));
- store(buff,(uint) length, my_charset_latin1);
+ store(buff,(uint) length, my_charset_bin);
break;
}
}
@@ -340,15 +340,12 @@ bool Field::optimize_range(uint idx)
}
/****************************************************************************
- Functions for the Field_null
+ Field_null, a field that always return NULL
****************************************************************************/
void Field_null::sql_type(String &res) const
{
- CHARSET_INFO *cs=res.charset();
- uint len;
- len=cs->snprintf(cs,(char*)res.ptr(),res.alloced_length(),"null");
- res.length(len);
+ res.set_latin1("null", 4);
}
@@ -360,7 +357,7 @@ void Field_null::sql_type(String &res) const
void
Field_decimal::reset(void)
{
- Field_decimal::store("0",1,my_charset_latin1);
+ Field_decimal::store("0",1,my_charset_bin);
}
void Field_decimal::overflow(bool negative)
@@ -404,11 +401,16 @@ void Field_decimal::overflow(bool negative)
int Field_decimal::store(const char *from, uint len, CHARSET_INFO *cs)
{
- String l1from;
+ char buff[80];
+ String tmp(buff,sizeof(buff), my_charset_bin);
- l1from.copy(from,len,cs,my_charset_latin1);
- from=l1from.ptr();
- len=l1from.length();
+ /* Convert character set if the old one is multi byte */
+ if (cs->mbmaxlen > 1)
+ {
+ tmp.copy(from, len, cs, my_charset_bin);
+ from= tmp.ptr();
+ len= tmp.length();
+ }
const char *end= from+len;
/* The pointer where the field value starts (i.e., "where to write") */
@@ -461,7 +463,7 @@ int Field_decimal::store(const char *from, uint len, CHARSET_INFO *cs)
There are three steps in this function :
- parse the input string
- modify the position of digits around the decimal dot '.'
- according to the exponent value (if specified)
+ according to the exponent value (if specified)
- write the formatted number
*/
@@ -469,7 +471,7 @@ int Field_decimal::store(const char *from, uint len, CHARSET_INFO *cs)
tmp_dec++;
/* skip pre-space */
- while (from != end && my_isspace(my_charset_latin1,*from))
+ while (from != end && my_isspace(my_charset_bin,*from))
from++;
if (from == end)
{
@@ -506,13 +508,13 @@ int Field_decimal::store(const char *from, uint len, CHARSET_INFO *cs)
for (; from!=end && *from == '0'; from++) ; // Read prezeros
pre_zeros_end=int_digits_from=from;
/* Read non zero digits at the left of '.'*/
- for (; from != end && my_isdigit(my_charset_latin1, *from) ; from++) ;
+ for (; from != end && my_isdigit(my_charset_bin, *from) ; from++) ;
int_digits_end=from;
if (from!=end && *from == '.') // Some '.' ?
from++;
frac_digits_from= from;
/* Read digits at the right of '.' */
- for (;from!=end && my_isdigit(my_charset_latin1, *from); from++) ;
+ for (;from!=end && my_isdigit(my_charset_bin, *from); from++) ;
frac_digits_end=from;
// Some exponentiation symbol ?
if (from != end && (*from == 'e' || *from == 'E'))
@@ -528,7 +530,7 @@ int Field_decimal::store(const char *from, uint len, CHARSET_INFO *cs)
exponents will become small (e.g. 1e4294967296 will become 1e0, and the
field will finally contain 1 instead of its max possible value).
*/
- for (;from!=end && my_isdigit(my_charset_latin1, *from); from++)
+ for (;from!=end && my_isdigit(my_charset_bin, *from); from++)
{
exponent=10*exponent+(*from-'0');
if (exponent>MAX_EXPONENT)
@@ -546,7 +548,7 @@ int Field_decimal::store(const char *from, uint len, CHARSET_INFO *cs)
if (current_thd->count_cuted_fields)
{
// Skip end spaces
- for (;from != end && my_isspace(my_charset_latin1, *from); from++) ;
+ for (;from != end && my_isspace(my_charset_bin, *from); from++) ;
if (from != end) // If still something left, warn
{
current_thd->cuted_fields++;
@@ -838,30 +840,33 @@ int Field_decimal::store(longlong nr)
double Field_decimal::val_real(void)
{
- CHARSET_INFO *cs=charset();
- return my_strntod(cs,ptr,field_length,NULL);
+ int not_used;
+ return my_strntod(my_charset_bin, ptr, field_length, NULL, &not_used);
}
longlong Field_decimal::val_int(void)
{
- CHARSET_INFO *cs=charset();
+ int not_used;
if (unsigned_flag)
- return my_strntoull(cs,ptr,field_length,NULL,10);
+ return my_strntoull(my_charset_bin, ptr, field_length, 10, NULL,
+ &not_used);
else
- return my_strntoll(cs,ptr,field_length,NULL,10);
+ return my_strntoll( my_charset_bin, ptr, field_length, 10, NULL,
+ &not_used);
}
+
String *Field_decimal::val_str(String *val_buffer __attribute__((unused)),
String *val_ptr)
{
char *str;
- CHARSET_INFO *cs=current_thd->variables.thd_charset;
for (str=ptr ; *str == ' ' ; str++) ;
uint tmp_length=(uint) (str-ptr);
+ val_ptr->set_charset(my_charset_bin);
if (field_length < tmp_length) // Error in data
val_ptr->length(0);
else
- val_ptr->copy((const char*) str,field_length-tmp_length,my_charset_latin1,cs);
+ val_ptr->set_latin1((const char*) str, field_length-tmp_length);
return val_ptr;
}
@@ -878,9 +883,9 @@ int Field_decimal::cmp(const char *a_ptr,const char *b_ptr)
for (end=a_ptr+field_length;
a_ptr != end &&
(*a_ptr == *b_ptr ||
- ((my_isspace(my_charset_latin1,*a_ptr) || *a_ptr == '+' ||
+ ((my_isspace(my_charset_bin,*a_ptr) || *a_ptr == '+' ||
*a_ptr == '0') &&
- (my_isspace(my_charset_latin1,*b_ptr) || *b_ptr == '+' ||
+ (my_isspace(my_charset_bin,*b_ptr) || *b_ptr == '+' ||
*b_ptr == '0')));
a_ptr++,b_ptr++)
{
@@ -908,7 +913,7 @@ void Field_decimal::sort_string(char *to,uint length)
char *str,*end;
for (str=ptr,end=ptr+length;
str != end &&
- ((my_isspace(my_charset_latin1,*str) || *str == '+' ||
+ ((my_isspace(my_charset_bin,*str) || *str == '+' ||
*str == '0')) ;
str++)
*to++=' ';
@@ -920,7 +925,7 @@ void Field_decimal::sort_string(char *to,uint length)
*to++=1; // Smaller than any number
str++;
while (str != end)
- if (my_isdigit(my_charset_latin1,*str))
+ if (my_isdigit(my_charset_bin,*str))
*to++= (char) ('9' - *str++);
else
*to++= *str++;
@@ -933,14 +938,12 @@ void Field_decimal::sql_type(String &res) const
{
CHARSET_INFO *cs=res.charset();
uint tmp=field_length;
- uint len;
if (!unsigned_flag)
tmp--;
if (dec)
tmp--;
- len=cs->snprintf(cs,(char*) res.ptr(),res.alloced_length(),
- "decimal(%d,%d)",tmp,dec);
- res.length(len);
+ res.length(cs->snprintf(cs,(char*) res.ptr(),res.alloced_length(),
+ "decimal(%d,%d)",tmp,dec));
add_zerofill_and_unsigned(res);
}
@@ -951,7 +954,9 @@ void Field_decimal::sql_type(String &res) const
int Field_tiny::store(const char *from,uint len,CHARSET_INFO *cs)
{
- long tmp= my_strntol(cs,from,len,(char **)NULL,10);
+ int not_used; // We can ignore result from str2int
+ char *end;
+ long tmp= my_strntol(cs, from, len, 10, &end, &not_used);
int error= 0;
if (unsigned_flag)
@@ -968,7 +973,7 @@ int Field_tiny::store(const char *from,uint len,CHARSET_INFO *cs)
current_thd->cuted_fields++;
error= 1;
}
- else if (current_thd->count_cuted_fields && !test_if_int(from,len,cs))
+ else if (current_thd->count_cuted_fields && !test_if_int(from,len,end,cs))
{
current_thd->cuted_fields++;
error= 1;
@@ -988,7 +993,7 @@ int Field_tiny::store(const char *from,uint len,CHARSET_INFO *cs)
current_thd->cuted_fields++;
error= 1;
}
- else if (current_thd->count_cuted_fields && !test_if_int(from,len,cs))
+ else if (current_thd->count_cuted_fields && !test_if_int(from,len,end,cs))
{
current_thd->cuted_fields++;
error= 1;
@@ -1098,16 +1103,16 @@ longlong Field_tiny::val_int(void)
String *Field_tiny::val_str(String *val_buffer,
String *val_ptr __attribute__((unused)))
{
- CHARSET_INFO *cs=current_thd->variables.thd_charset;
+ CHARSET_INFO *cs= my_charset_bin;
uint length;
uint mlength=max(field_length+1,5*cs->mbmaxlen);
val_buffer->alloc(mlength);
char *to=(char*) val_buffer->ptr();
if (unsigned_flag)
- length= (uint) cs->l10tostr(cs,to,mlength, 10,(long) *((uchar*) ptr));
+ length= (uint) cs->long10_to_str(cs,to,mlength, 10,(long) *((uchar*) ptr));
else
- length= (uint) cs->l10tostr(cs,to,mlength,-10,(long) *((signed char*) ptr));
+ length= (uint) cs->long10_to_str(cs,to,mlength,-10,(long) *((signed char*) ptr));
val_buffer->length(length);
if (zerofill)
@@ -1140,23 +1145,22 @@ void Field_tiny::sort_string(char *to,uint length __attribute__((unused)))
void Field_tiny::sql_type(String &res) const
{
CHARSET_INFO *cs=res.charset();
- uint len=cs->snprintf(cs,(char*) res.ptr(),res.alloced_length(),
- "tinyint(%d)",(int) field_length);
- res.length(len);
+ res.length(cs->snprintf(cs,(char*) res.ptr(),res.alloced_length(),
+ "tinyint(%d)",(int) field_length));
add_zerofill_and_unsigned(res);
}
/****************************************************************************
-** short int
+ Field type short int (2 byte)
****************************************************************************/
-
-// Note: Sometimes this should be fixed to check for garbage after number.
-
int Field_short::store(const char *from,uint len,CHARSET_INFO *cs)
{
- long tmp= my_strntol(cs,from,len,NULL,10);
+ int not_used; // We can ignore result from str2int
+ char *end;
+ long tmp= my_strntol(cs, from, len, 10, &end, &not_used);
int error= 0;
+
if (unsigned_flag)
{
if (tmp < 0)
@@ -1171,7 +1175,7 @@ int Field_short::store(const char *from,uint len,CHARSET_INFO *cs)
current_thd->cuted_fields++;
error= 1;
}
- else if (current_thd->count_cuted_fields && !test_if_int(from,len,cs))
+ else if (current_thd->count_cuted_fields && !test_if_int(from,len,end,cs))
{
current_thd->cuted_fields++;
error= 1;
@@ -1191,7 +1195,7 @@ int Field_short::store(const char *from,uint len,CHARSET_INFO *cs)
current_thd->cuted_fields++;
error= 1;
}
- else if (current_thd->count_cuted_fields && !test_if_int(from,len,cs))
+ else if (current_thd->count_cuted_fields && !test_if_int(from,len,end,cs))
{
current_thd->cuted_fields++;
error= 1;
@@ -1337,7 +1341,7 @@ longlong Field_short::val_int(void)
String *Field_short::val_str(String *val_buffer,
String *val_ptr __attribute__((unused)))
{
- CHARSET_INFO *cs=current_thd->variables.thd_charset;
+ CHARSET_INFO *cs= my_charset_bin;
uint length;
uint mlength=max(field_length+1,7*cs->mbmaxlen);
val_buffer->alloc(mlength);
@@ -1351,9 +1355,9 @@ String *Field_short::val_str(String *val_buffer,
shortget(j,ptr);
if (unsigned_flag)
- length=(uint) cs->l10tostr(cs,to,mlength, 10, (long) (uint16) j);
+ length=(uint) cs->long10_to_str(cs, to, mlength, 10, (long) (uint16) j);
else
- length=(uint) cs->l10tostr(cs,to,mlength,-10, (long) j);
+ length=(uint) cs->long10_to_str(cs, to, mlength,-10, (long) j);
val_buffer->length(length);
if (zerofill)
prepend_zeros(val_buffer);
@@ -1414,22 +1418,21 @@ void Field_short::sort_string(char *to,uint length __attribute__((unused)))
void Field_short::sql_type(String &res) const
{
CHARSET_INFO *cs=res.charset();
- uint len=cs->snprintf(cs,(char*) res.ptr(),res.alloced_length(),
- "smallint(%d)",(int) field_length);
- res.length(len);
+ res.length(cs->snprintf(cs,(char*) res.ptr(),res.alloced_length(),
+ "smallint(%d)",(int) field_length));
add_zerofill_and_unsigned(res);
}
/****************************************************************************
-** medium int
+ Field type medium int (3 byte)
****************************************************************************/
-// Note: Sometimes this should be fixed to check for garbage after number.
-
int Field_medium::store(const char *from,uint len,CHARSET_INFO *cs)
{
- long tmp= my_strntol(cs,from,len,NULL,10);
+ int not_used; // We can ignore result from str2int
+ char *end;
+ long tmp= my_strntol(cs, from, len, 10, &end, &not_used);
int error= 0;
if (unsigned_flag)
@@ -1446,7 +1449,7 @@ int Field_medium::store(const char *from,uint len,CHARSET_INFO *cs)
current_thd->cuted_fields++;
error= 1;
}
- else if (current_thd->count_cuted_fields && !test_if_int(from,len,cs))
+ else if (current_thd->count_cuted_fields && !test_if_int(from,len,end,cs))
{
current_thd->cuted_fields++;
error= 1;
@@ -1466,7 +1469,7 @@ int Field_medium::store(const char *from,uint len,CHARSET_INFO *cs)
current_thd->cuted_fields++;
error= 1;
}
- else if (current_thd->count_cuted_fields && !test_if_int(from,len,cs))
+ else if (current_thd->count_cuted_fields && !test_if_int(from,len,end,cs))
{
current_thd->cuted_fields++;
error= 1;
@@ -1572,23 +1575,25 @@ double Field_medium::val_real(void)
return (double) j;
}
+
longlong Field_medium::val_int(void)
{
long j= unsigned_flag ? (long) uint3korr(ptr) : sint3korr(ptr);
return (longlong) j;
}
+
String *Field_medium::val_str(String *val_buffer,
String *val_ptr __attribute__((unused)))
{
- CHARSET_INFO *cs=current_thd->variables.thd_charset;
+ CHARSET_INFO *cs= my_charset_bin;
uint length;
uint mlength=max(field_length+1,10*cs->mbmaxlen);
val_buffer->alloc(mlength);
char *to=(char*) val_buffer->ptr();
long j= unsigned_flag ? (long) uint3korr(ptr) : sint3korr(ptr);
- length=(uint) cs->l10tostr(cs,to,mlength,-10,j);
+ length=(uint) cs->long10_to_str(cs,to,mlength,-10,j);
val_buffer->length(length);
if (zerofill)
prepend_zeros(val_buffer); /* purecov: inspected */
@@ -1632,9 +1637,8 @@ void Field_medium::sort_string(char *to,uint length __attribute__((unused)))
void Field_medium::sql_type(String &res) const
{
CHARSET_INFO *cs=res.charset();
- uint len=cs->snprintf(cs,(char*) res.ptr(),res.alloced_length(),
- "mediumint(%d)",(int) field_length);
- res.length(len);
+ res.length(cs->snprintf(cs,(char*) res.ptr(),res.alloced_length(),
+ "mediumint(%d)",(int) field_length));
add_zerofill_and_unsigned(res);
}
@@ -1643,39 +1647,35 @@ void Field_medium::sql_type(String &res) const
****************************************************************************/
-// Note: Sometimes this should be fixed to check for garbage after number.
-
int Field_long::store(const char *from,uint len,CHARSET_INFO *cs)
{
+ long tmp;
+ int error= 0;
char *end;
+ /* TODO: Make multi-byte-character safe */
while (len && my_isspace(cs,*from))
{
len--; from++;
}
- long tmp;
- String tmp_str(from, len, cs);
- from= tmp_str.c_ptr(); // Add end null if needed
- int error= 0;
- errno=0;
+ my_errno=0;
if (unsigned_flag)
{
if (!len || *from == '-')
{
tmp=0; // Set negative to 0
- errno=ERANGE;
+ my_errno=ERANGE;
error= 1;
}
else
- tmp=(long) my_strntoul(cs,from,len,&end,10);
+ tmp=(long) my_strntoul(cs,from,len,10,&end,&error);
}
else
- tmp=my_strntol(cs,from,len,&end,10);
- if (errno ||
+ tmp=my_strntol(cs,from,len,10,&end,&error);
+ if (error ||
(from+len != end && current_thd->count_cuted_fields &&
- !test_if_int(from,len,cs)))
+ !test_if_int(from,len,end,cs)))
{
current_thd->cuted_fields++;
- error= 1;
}
#ifdef WORDS_BIGENDIAN
if (table->db_low_byte_first)
@@ -1817,7 +1817,7 @@ longlong Field_long::val_int(void)
String *Field_long::val_str(String *val_buffer,
String *val_ptr __attribute__((unused)))
{
- CHARSET_INFO *cs=current_thd->variables.thd_charset;
+ CHARSET_INFO *cs= my_charset_bin;
uint length;
uint mlength=max(field_length+1,12*cs->mbmaxlen);
val_buffer->alloc(mlength);
@@ -1831,9 +1831,9 @@ String *Field_long::val_str(String *val_buffer,
longget(j,ptr);
if (unsigned_flag)
- length=cs->l10tostr(cs,to,mlength, 10,(long) (uint32)j);
+ length=cs->long10_to_str(cs,to,mlength, 10,(long) (uint32)j);
else
- length=cs->l10tostr(cs,to,mlength,-10,(long) j);
+ length=cs->long10_to_str(cs,to,mlength,-10,(long) j);
val_buffer->length(length);
if (zerofill)
prepend_zeros(val_buffer);
@@ -1896,44 +1896,42 @@ void Field_long::sort_string(char *to,uint length __attribute__((unused)))
void Field_long::sql_type(String &res) const
{
CHARSET_INFO *cs=res.charset();
- uint len=cs->snprintf(cs,(char*) res.ptr(),res.alloced_length(),
- "int(%d)",(int) field_length);
- res.length(len);
+ res.length(cs->snprintf(cs,(char*) res.ptr(),res.alloced_length(),
+ "int(%d)",(int) field_length));
add_zerofill_and_unsigned(res);
}
/****************************************************************************
-** longlong int
+ Field type longlong int (8 bytes)
****************************************************************************/
int Field_longlong::store(const char *from,uint len,CHARSET_INFO *cs)
{
+ longlong tmp;
+ int error= 0;
char *end;
+ /* TODO: Make multi byte safe */
while (len && my_isspace(cs,*from))
{ // For easy error check
len--; from++;
}
- longlong tmp;
- String tmp_str(from, len, cs);
- from= tmp_str.c_ptr(); // Add end null if needed
- int error= 0;
- errno=0;
+ my_errno=0;
if (unsigned_flag)
{
if (!len || *from == '-')
{
tmp=0; // Set negative to 0
- errno=ERANGE;
+ my_errno= ERANGE;
error= 1;
}
else
- tmp=(longlong) my_strntoull(cs,from,len,&end,10);
+ tmp=(longlong) my_strntoull(cs,from,len,10,&end,&error);
}
else
- tmp=my_strntoll(cs,from,len,&end,10);
- if (errno ||
+ tmp=my_strntoll(cs,from,len,10,&end,&error);
+ if (error ||
(from+len != end && current_thd->count_cuted_fields &&
- !test_if_int(from,len,cs)))
+ !test_if_int(from,len,end,cs)))
current_thd->cuted_fields++;
#ifdef WORDS_BIGENDIAN
if (table->db_low_byte_first)
@@ -2042,7 +2040,7 @@ longlong Field_longlong::val_int(void)
String *Field_longlong::val_str(String *val_buffer,
String *val_ptr __attribute__((unused)))
{
- CHARSET_INFO *cs=current_thd->variables.thd_charset;
+ CHARSET_INFO *cs= my_charset_bin;
uint length;
uint mlength=max(field_length+1,22*cs->mbmaxlen);
val_buffer->alloc(mlength);
@@ -2055,7 +2053,7 @@ String *Field_longlong::val_str(String *val_buffer,
#endif
longlongget(j,ptr);
- length=(uint) cs->ll10tostr(cs,to,mlength,unsigned_flag ? 10 : -10, j);
+ length=(uint) cs->longlong10_to_str(cs,to,mlength,unsigned_flag ? 10 : -10, j);
val_buffer->length(length);
if (zerofill)
prepend_zeros(val_buffer);
@@ -2128,9 +2126,8 @@ void Field_longlong::sort_string(char *to,uint length __attribute__((unused)))
void Field_longlong::sql_type(String &res) const
{
CHARSET_INFO *cs=res.charset();
- uint len=cs->snprintf(cs,(char*) res.ptr(),res.alloced_length(),
- "bigint(%d)",(int) field_length);
- res.length(len);
+ res.length(cs->snprintf(cs,(char*) res.ptr(),res.alloced_length(),
+ "bigint(%d)",(int) field_length));
add_zerofill_and_unsigned(res);
}
@@ -2140,14 +2137,14 @@ void Field_longlong::sql_type(String &res) const
int Field_float::store(const char *from,uint len,CHARSET_INFO *cs)
{
- errno=0;
- Field_float::store(my_strntod(cs,from,len,(char**)NULL));
- if (errno || current_thd->count_cuted_fields && !test_if_real(from,len,cs))
+ int err;
+ Field_float::store(my_strntod(cs,(char*) from,len,(char**)NULL,&err));
+ if (err || current_thd->count_cuted_fields && !test_if_real(from,len,cs))
{
current_thd->cuted_fields++;
return 1;
}
- return (errno) ? 1 : 0;
+ return (err) ? 1 : 0;
}
@@ -2394,18 +2391,16 @@ bool Field_float::send_binary(Protocol *protocol)
void Field_float::sql_type(String &res) const
{
- CHARSET_INFO *cs=res.charset();
- uint len;
if (dec == NOT_FIXED_DEC)
{
- len=cs->snprintf(cs,(char*) res.ptr(),res.alloced_length(),"float");
+ res.set_latin1("float", 5);
}
else
{
- len=cs->snprintf(cs,(char*) res.ptr(),res.alloced_length(),
- "float(%d,%d)",(int) field_length,dec);
+ CHARSET_INFO *cs= res.charset();
+ res.length(cs->snprintf(cs,(char*) res.ptr(),res.alloced_length(),
+ "float(%d,%d)",(int) field_length,dec));
}
- res.length(len);
add_zerofill_and_unsigned(res);
}
@@ -2415,19 +2410,17 @@ void Field_float::sql_type(String &res) const
int Field_double::store(const char *from,uint len,CHARSET_INFO *cs)
{
- errno=0;
- int error= 0;
- double j= my_strntod(cs,from,len,(char**)0);
- if (errno || current_thd->count_cuted_fields && !test_if_real(from,len,cs))
+ int err;
+ double j= my_strntod(cs,(char*) from,len,(char**)0,&err);
+ if (err || current_thd->count_cuted_fields && !test_if_real(from,len,cs))
{
current_thd->cuted_fields++;
- error= 1;
}
if (unsigned_flag && j < 0)
{
current_thd->cuted_fields++;
j=0;
- error= 1;
+ err= 1;
}
#ifdef WORDS_BIGENDIAN
if (table->db_low_byte_first)
@@ -2437,7 +2430,7 @@ int Field_double::store(const char *from,uint len,CHARSET_INFO *cs)
else
#endif
doublestore(ptr,j);
- return error;
+ return err;
}
@@ -2655,17 +2648,15 @@ void Field_double::sort_string(char *to,uint length __attribute__((unused)))
void Field_double::sql_type(String &res) const
{
CHARSET_INFO *cs=res.charset();
- uint len;
if (dec == NOT_FIXED_DEC)
{
- len=cs->snprintf(cs,(char*) res.ptr(),res.alloced_length(),"double");
+ res.set_latin1("double",6);
}
else
{
- len=cs->snprintf(cs,(char*) res.ptr(),res.alloced_length(),
- "double(%d,%d)",(int) field_length,dec);
+ res.length(cs->snprintf(cs,(char*) res.ptr(),res.alloced_length(),
+ "double(%d,%d)",(int) field_length,dec));
}
- res.length(len);
add_zerofill_and_unsigned(res);
}
@@ -2722,9 +2713,9 @@ int Field_timestamp::store(double nr)
/*
-** Convert a datetime of formats YYMMDD, YYYYMMDD or YYMMDDHHMSS to
-** YYYYMMDDHHMMSS. The high date '99991231235959' is checked before this
-** function.
+ Convert a datetime of formats YYMMDD, YYYYMMDD or YYMMDDHHMSS to
+ YYYYMMDDHHMMSS. The high date '99991231235959' is checked before this
+ function.
*/
static longlong fix_datetime(longlong nr)
@@ -2854,9 +2845,10 @@ String *Field_timestamp::val_str(String *val_buffer,
if (temp == 0L)
{ /* Zero time is "000000" */
- strmov(to, "0000-00-00 00:00:00");
- return val_buffer;
+ val_ptr->set("0000-00-00 00:00:00", 19, my_charset_bin);
+ return val_ptr;
}
+ val_buffer->set_charset(my_charset_bin); // Safety
time_arg=(time_t) temp;
localtime_r(&time_arg,&tm_tmp);
l_time=&tm_tmp;
@@ -2995,9 +2987,7 @@ void Field_timestamp::sort_string(char *to,uint length __attribute__((unused)))
void Field_timestamp::sql_type(String &res) const
{
- CHARSET_INFO *cs=res.charset();
- uint len=cs->snprintf(cs,(char*)res.ptr(),res.alloced_length(),"timestamp");
- res.length(len);
+ res.set_latin1("timestamp", 9);
}
@@ -3125,6 +3115,12 @@ longlong Field_time::val_int(void)
return (longlong) sint3korr(ptr);
}
+
+/*
+ This function is multi-byte safe as the result string is always of type
+ my_charset_bin
+*/
+
String *Field_time::val_str(String *val_buffer,
String *val_ptr __attribute__((unused)))
{
@@ -3189,9 +3185,7 @@ void Field_time::sort_string(char *to,uint length __attribute__((unused)))
void Field_time::sql_type(String &res) const
{
- CHARSET_INFO *cs=res.charset();
- uint len=cs->snprintf(cs,(char*)res.ptr(),res.alloced_length(),"time");
- res.length(len);
+ res.set_latin1("time", 4);
}
/****************************************************************************
@@ -3202,7 +3196,9 @@ void Field_time::sql_type(String &res) const
int Field_year::store(const char *from, uint len,CHARSET_INFO *cs)
{
- long nr= my_strntol(cs,from,len,NULL,10);
+ int not_used; // We can ignore result from str2int
+ char *end;
+ long nr= my_strntol(cs, from, len, 10, &end, &not_used);
if (nr < 0 || nr >= 100 && nr <= 1900 || nr > 2155)
{
@@ -3210,7 +3206,7 @@ int Field_year::store(const char *from, uint len,CHARSET_INFO *cs)
current_thd->cuted_fields++;
return 1;
}
- else if (current_thd->count_cuted_fields && !test_if_int(from,len,cs))
+ else if (current_thd->count_cuted_fields && !test_if_int(from,len,end,cs))
current_thd->cuted_fields++;
if (nr != 0 || len != 4)
{
@@ -3287,9 +3283,8 @@ String *Field_year::val_str(String *val_buffer,
void Field_year::sql_type(String &res) const
{
CHARSET_INFO *cs=res.charset();
- ulong len=cs->snprintf(cs,(char*)res.ptr(),res.alloced_length(),
- "year(%d)",(int) field_length);
- res.length(len);
+ res.length(cs->snprintf(cs,(char*)res.ptr(),res.alloced_length(),
+ "year(%d)",(int) field_length));
}
@@ -3375,6 +3370,7 @@ int Field_date::store(longlong nr)
return error;
}
+
bool Field_date::send_binary(Protocol *protocol)
{
longlong tmp= Field_date::val_int();
@@ -3469,9 +3465,7 @@ void Field_date::sort_string(char *to,uint length __attribute__((unused)))
void Field_date::sql_type(String &res) const
{
- CHARSET_INFO *cs=res.charset();
- uint len=cs->snprintf(cs,(char*)res.ptr(),res.alloced_length(),"date");
- res.length(len);
+ res.set_latin1("date", 4);
}
/****************************************************************************
@@ -3639,9 +3633,7 @@ void Field_newdate::sort_string(char *to,uint length __attribute__((unused)))
void Field_newdate::sql_type(String &res) const
{
- CHARSET_INFO *cs=res.charset();
- uint len=cs->snprintf(cs,(char*)res.ptr(),res.alloced_length(),"date");
- res.length(len);
+ res.set_latin1("date", 4);
}
@@ -3872,9 +3864,7 @@ void Field_datetime::sort_string(char *to,uint length __attribute__((unused)))
void Field_datetime::sql_type(String &res) const
{
- CHARSET_INFO *cs=res.charset();
- uint len=cs->snprintf(cs,(char*)res.ptr(),res.alloced_length(),"datetime");
- res.length(len);
+ res.set_latin1("datetime", 8);
}
/****************************************************************************
@@ -3929,7 +3919,7 @@ int Field_string::store(double nr)
int width=min(field_length,DBL_DIG+5);
sprintf(buff,"%-*.*g",width,max(width-5,0),nr);
end=strcend(buff,' ');
- return Field_string::store(buff,(uint) (end - buff), my_charset_latin1);
+ return Field_string::store(buff,(uint) (end - buff), my_charset_bin);
}
@@ -3938,22 +3928,24 @@ int Field_string::store(longlong nr)
char buff[64];
int l;
CHARSET_INFO *cs=charset();
- l=cs->ll10tostr(cs,buff,sizeof(buff),-10,nr);
+ l=cs->longlong10_to_str(cs,buff,sizeof(buff),-10,nr);
return Field_string::store(buff,(uint)l,cs);
}
double Field_string::val_real(void)
{
+ int not_used;
CHARSET_INFO *cs=charset();
- return my_strntod(cs,ptr,field_length,(char**)0);
+ return my_strntod(cs,ptr,field_length,(char**)0,&not_used);
}
longlong Field_string::val_int(void)
{
+ int not_used;
CHARSET_INFO *cs=charset();
- return my_strntoll(cs,ptr,field_length,NULL,10);
+ return my_strntoll(cs,ptr,field_length,10,NULL,&not_used);
}
@@ -3980,23 +3972,11 @@ int Field_string::cmp(const char *a_ptr, const char *b_ptr)
void Field_string::sort_string(char *to,uint length)
{
- if (binary())
- memcpy((byte*) to,(byte*) ptr,(size_t) length);
- else
- {
-#ifdef USE_STRCOLL
- if (use_strnxfrm(field_charset)) {
- uint tmp=my_strnxfrm(field_charset,
+ uint tmp=my_strnxfrm(field_charset,
(unsigned char *)to, length,
(unsigned char *) ptr, field_length);
- if (tmp < length)
- bzero(to + tmp, length - tmp);
- }
- else
-#endif
- for (char *from=ptr,*end=ptr+length ; from != end ;)
- *to++=(char) field_charset->sort_order[(uint) (uchar) *from++];
- }
+ if (tmp < length)
+ bzero(to + tmp, length - tmp);
}
@@ -4040,12 +4020,6 @@ int Field_string::pack_cmp(const char *a, const char *b, uint length)
{
uint a_length= (uint) (uchar) *a++;
uint b_length= (uint) (uchar) *b++;
-
- if (binary())
- {
- int cmp= memcmp(a,b,min(a_length,b_length));
- return cmp ? cmp : (int) (a_length - b_length);
- }
return my_strnncoll(field_charset,
(const uchar*)a,a_length,
(const uchar*)b,b_length);
@@ -4059,12 +4033,6 @@ int Field_string::pack_cmp(const char *b, uint length)
while (end > ptr && end[-1] == ' ')
end--;
uint a_length = (uint) (end - ptr);
-
- if (binary())
- {
- int cmp= memcmp(ptr,b,min(a_length,b_length));
- return cmp ? cmp : (int) (a_length - b_length);
- }
return my_strnncoll(field_charset,
(const uchar*)ptr,a_length,
(const uchar*)b, b_length);
@@ -4118,7 +4086,7 @@ int Field_varstring::store(double nr)
int width=min(field_length,DBL_DIG+5);
sprintf(buff,"%-*.*g",width,max(width-5,0),nr);
end=strcend(buff,' ');
- return Field_varstring::store(buff,(uint) (end - buff), my_charset_latin1);
+ return Field_varstring::store(buff,(uint) (end - buff), my_charset_bin);
}
@@ -4127,24 +4095,26 @@ int Field_varstring::store(longlong nr)
char buff[64];
int l;
CHARSET_INFO *cs=charset();
- l=cs->ll10tostr(cs,buff,sizeof(buff),-10,nr);
+ l=cs->longlong10_to_str(cs,buff,sizeof(buff),-10,nr);
return Field_varstring::store(buff,(uint)l,cs);
}
double Field_varstring::val_real(void)
{
+ int not_used;
uint length=uint2korr(ptr)+2;
CHARSET_INFO *cs=charset();
- return my_strntod(cs,ptr+2,length,(char**)0);
+ return my_strntod(cs,ptr+2,length,(char**)0, &not_used);
}
longlong Field_varstring::val_int(void)
{
+ int not_used;
uint length=uint2korr(ptr)+2;
CHARSET_INFO *cs=charset();
- return my_strntoll(cs,ptr+2,length,NULL,10);
+ return my_strntoll(cs,ptr+2,length,10,NULL, &not_used);
}
@@ -4171,27 +4141,9 @@ int Field_varstring::cmp(const char *a_ptr, const char *b_ptr)
void Field_varstring::sort_string(char *to,uint length)
{
uint tot_length=uint2korr(ptr);
- if (binary())
- memcpy((byte*) to,(byte*) ptr+2,(size_t) tot_length);
- else
- {
-#ifdef USE_STRCOLL
- if (use_strnxfrm(field_charset))
- tot_length=my_strnxfrm(field_charset,
+ tot_length=my_strnxfrm(field_charset,
(unsigned char *) to, length,
(unsigned char *)ptr+2, tot_length);
- else
- {
-#endif
- char *tmp=to;
- if (tot_length > length)
- tot_length=length;
- for (char *from=ptr+2,*end=from+tot_length ; from != end ;)
- *tmp++=(char) field_charset->sort_order[(uint) (uchar) *from++];
-#ifdef USE_STRCOLL
- }
-#endif
- }
if (tot_length < length)
bzero(to+tot_length,length-tot_length);
}
@@ -4255,11 +4207,6 @@ int Field_varstring::pack_cmp(const char *a, const char *b, uint key_length)
a_length= (uint) (uchar) *a++;
b_length= (uint) (uchar) *b++;
}
- if (binary())
- {
- int cmp= memcmp(a,b,min(a_length,b_length));
- return cmp ? cmp : (int) (a_length - b_length);
- }
return my_strnncoll(field_charset,
(const uchar *)a,a_length,
(const uchar *)b,b_length);
@@ -4278,11 +4225,6 @@ int Field_varstring::pack_cmp(const char *b, uint key_length)
{
b_length= (uint) (uchar) *b++;
}
- if (binary())
- {
- int cmp= memcmp(a,b,min(a_length,b_length));
- return cmp ? cmp : (int) (a_length - b_length);
- }
return my_strnncoll(field_charset,
(const uchar *)a,a_length,
(const uchar *)b,b_length);
@@ -4464,40 +4406,42 @@ int Field_blob::store(const char *from,uint len,CHARSET_INFO *cs)
int Field_blob::store(double nr)
{
- value.set(nr,2,current_thd->variables.thd_charset);
- return Field_blob::store(value.ptr(),(uint) value.length(), value.charset());
+ CHARSET_INFO *cs=charset();
+ value.set(nr, 2, cs);
+ return Field_blob::store(value.ptr(),(uint) value.length(), cs);
}
int Field_blob::store(longlong nr)
{
- value.set(nr,current_thd->variables.thd_charset);
- return Field_blob::store(value.ptr(), (uint) value.length(), value.charset());
+ CHARSET_INFO *cs=charset();
+ value.set(nr, cs);
+ return Field_blob::store(value.ptr(), (uint) value.length(), cs);
}
double Field_blob::val_real(void)
{
+ int not_used;
char *blob;
-
memcpy_fixed(&blob,ptr+packlength,sizeof(char*));
if (!blob)
return 0.0;
uint32 length=get_length(ptr);
CHARSET_INFO *cs=charset();
- return my_strntod(cs,blob,length,(char**)0);
+ return my_strntod(cs,blob,length,(char**)0, &not_used);
}
longlong Field_blob::val_int(void)
{
+ int not_used;
char *blob;
memcpy_fixed(&blob,ptr+packlength,sizeof(char*));
if (!blob)
return 0;
uint32 length=get_length(ptr);
- CHARSET_INFO *cs=charset();
- return my_strntoll(cs,blob,length,NULL,10);
+ return my_strntoll(charset(),blob,length,10,NULL,&not_used);
}
@@ -4507,9 +4451,9 @@ String *Field_blob::val_str(String *val_buffer __attribute__((unused)),
char *blob;
memcpy_fixed(&blob,ptr+packlength,sizeof(char*));
if (!blob)
- val_ptr->set("",0,field_charset); // A bit safer than ->length(0)
+ val_ptr->set("",0,charset()); // A bit safer than ->length(0)
else
- val_ptr->set((const char*) blob,get_length(ptr),field_charset);
+ val_ptr->set((const char*) blob,get_length(ptr),charset());
return val_ptr;
}
@@ -4567,7 +4511,8 @@ int Field_blob::cmp_binary(const char *a_ptr, const char *b_ptr,
/* The following is used only when comparing a key */
-void Field_blob::get_key_image(char *buff,uint length, CHARSET_INFO *cs,imagetype type)
+void Field_blob::get_key_image(char *buff,uint length,
+ CHARSET_INFO *cs,imagetype type)
{
length-= HA_KEY_BLOB_LENGTH;
uint32 blob_length= get_length(ptr);
@@ -4592,9 +4537,11 @@ void Field_blob::get_key_image(char *buff,uint length, CHARSET_INFO *cs,imagetyp
if ((uint32) length > blob_length)
{
-#ifdef HAVE_purify
+ /*
+ Must clear this as we do a memcmp in opt_range.cc to detect
+ identical keys
+ */
bzero(buff+2+blob_length, (length-blob_length));
-#endif
length=(uint) blob_length;
}
int2store(buff,length);
@@ -4630,8 +4577,13 @@ void Field_geom::get_key_image(char *buff,uint length,CHARSET_INFO *cs, imagetyp
void Field_geom::set_key_image(char *buff,uint length,CHARSET_INFO *cs)
{
+ Field_blob::set_key_image(buff, length, cs);
}
+void Field_geom::sql_type(String &res) const
+{
+ res.set("geometry", 8, default_charset_info);
+}
int Field_blob::key_cmp(const byte *key_ptr, uint max_key_length)
{
@@ -4654,61 +4606,44 @@ void Field_blob::sort_string(char *to,uint length)
{
char *blob;
uint blob_length=get_length();
-#ifdef USE_STRCOLL
- uint blob_org_length=blob_length;
-#endif
+
if (!blob_length)
bzero(to,length);
else
{
- if (blob_length > length)
- blob_length=length;
memcpy_fixed(&blob,ptr+packlength,sizeof(char*));
- if (binary())
- {
- memcpy(to,blob,blob_length);
- to+=blob_length;
- }
- else
- {
-#ifdef USE_STRCOLL
- if (use_strnxfrm(field_charset))
- {
- blob_length=my_strnxfrm(field_charset,
- (unsigned char *)to, length,
- (unsigned char *)blob, blob_org_length);
- if (blob_length >= length)
- return;
- to+=blob_length;
- }
- else
-#endif
- for (char *end=blob+blob_length ; blob != end ;)
- *to++=(char) field_charset->sort_order[(uint) (uchar) *blob++];
- }
- bzero(to,length-blob_length);
+
+ blob_length=my_strnxfrm(field_charset,
+ (unsigned char *)to, length,
+ (unsigned char *)blob, blob_length);
+ if (blob_length < length)
+ bzero(to+blob_length, length-blob_length);
}
}
void Field_blob::sql_type(String &res) const
{
- CHARSET_INFO *cs=res.charset();
const char *str;
- uint len;
+ uint length;
switch (packlength) {
- default: str="tiny"; break;
- case 2: str=""; break;
- case 3: str="medium"; break;
- case 4: str="long"; break;
+ default: str="tiny"; length=4; break;
+ case 2: str=""; length=0; break;
+ case 3: str="medium"; length= 6; break;
+ case 4: str="long"; length=4; break;
+ }
+ res.set_latin1(str,length);
+ if (binary())
+ res.append("blob");
+ else
+ {
+ res.append("text");
+ if (field_charset != table->table_charset)
+ {
+ res.append(" character set ");
+ res.append(field_charset->csname);
+ }
}
-
- len=cs->snprintf(cs,(char*)res.ptr(),res.alloced_length(),"%s%s%s%s",
- str,
- binary() ? "blob" : "text",
- binary() ? "" : " character set ",
- binary() ? "" : field_charset->name);
- res.length(len);
}
@@ -4764,11 +4699,6 @@ int Field_blob::pack_cmp(const char *a, const char *b, uint key_length)
a_length= (uint) (uchar) *a++;
b_length= (uint) (uchar) *b++;
}
- if (binary())
- {
- int cmp= memcmp(a,b,min(a_length,b_length));
- return cmp ? cmp : (int) (a_length - b_length);
- }
return my_strnncoll(field_charset,
(const uchar *)a,a_length,
(const uchar *)b,b_length);
@@ -4792,11 +4722,6 @@ int Field_blob::pack_cmp(const char *b, uint key_length)
{
b_length= (uint) (uchar) *b++;
}
- if (binary())
- {
- int cmp= memcmp(a,b,min(a_length,b_length));
- return cmp ? cmp : (int) (a_length - b_length);
- }
return my_strnncoll(field_charset,
(const uchar *)a,a_length,
(const uchar *)b,b_length);
@@ -4934,7 +4859,7 @@ uint find_enum(TYPELIB *lib,const char *x, uint length)
int Field_enum::store(const char *from,uint length,CHARSET_INFO *cs)
{
- int error= 0;
+ int err= 0;
uint tmp=find_enum(typelib,from,length);
if (!tmp)
{
@@ -4942,20 +4867,18 @@ int Field_enum::store(const char *from,uint length,CHARSET_INFO *cs)
{
/* This is for reading numbers with LOAD DATA INFILE */
char *end;
- my_errno=0;
- tmp=(uint) my_strntoul(cs,from,length,&end,10);
- if (my_errno || end != from+length || tmp > typelib->count)
+ tmp=(uint) my_strntoul(cs,from,length,10,&end,&err);
+ if (err || end != from+length || tmp > typelib->count)
{
tmp=0;
current_thd->cuted_fields++;
- error=1;
}
}
else
current_thd->cuted_fields++;
}
store_type((ulonglong) tmp);
- return error;
+ return err;
}
@@ -5084,38 +5007,52 @@ void Field_enum::sql_type(String &res) const
}
-/****************************************************************************
-** set type.
-** This is a string which can have a collection of different values.
-** Each string value is separated with a ','.
-** For example "One,two,five"
-** If one uses this string in a number context one gets the bits as a longlong
-** number.
-****************************************************************************/
+/*
+ set type.
+ This is a string which can have a collection of different values.
+ Each string value is separated with a ','.
+ For example "One,two,five"
+ If one uses this string in a number context one gets the bits as a longlong
+ number.
+
+ If there was a value in string that wasn't in set, the 'err_pos' points to
+ the last invalid value found. 'err_len' will be set to length of the
+ error string.
+*/
-ulonglong find_set(TYPELIB *lib,const char *x,uint length)
+ulonglong find_set(TYPELIB *lib, const char *x, uint length, char **err_pos,
+ uint *err_len)
{
- const char *end=x+length;
+ const char *end= x + length;
+ *err_pos= 0; // No error yet
while (end > x && my_isspace(system_charset_info, end[-1]))
end--;
- ulonglong found=0;
+ *err_len= 0;
+ ulonglong found= 0;
if (x != end)
{
- const char *start=x;
+ const char *start= x;
bool error= 0;
for (;;)
{
- const char *pos=start;
- for (; pos != end && *pos != field_separator ; pos++) ;
- uint find=find_enum(lib,start,(uint) (pos-start));
+ const char *pos= start;
+ uint var_len;
+
+ for (; pos != end && *pos != field_separator; pos++) ;
+ var_len= (uint) (pos - start);
+ uint find= find_enum(lib, start, var_len);
if (!find)
- error=1;
+ {
+ *err_pos= (char*) start;
+ *err_len= var_len;
+ error= 1;
+ }
else
- found|= ((longlong) 1 << (find-1));
+ found|= ((longlong) 1 << (find - 1));
if (pos == end)
- break;
- start=pos+1;
+ break;
+ start= pos + 1;
}
if (error)
current_thd->cuted_fields++;
@@ -5126,25 +5063,26 @@ ulonglong find_set(TYPELIB *lib,const char *x,uint length)
int Field_set::store(const char *from,uint length,CHARSET_INFO *cs)
{
- int error= 0;
- ulonglong tmp=find_set(typelib,from,length);
+ int err= 0;
+ char *not_used;
+ uint not_used2;
+
+ ulonglong tmp= find_set(typelib, from, length, &not_used, &not_used2);
if (!tmp && length && length < 22)
{
/* This is for reading numbers with LOAD DATA INFILE */
char *end;
- my_errno=0;
- tmp=my_strntoull(cs,from,length,&end,10);
- if (my_errno || end != from+length ||
+ tmp=my_strntoull(cs,from,length,10,&end,&err);
+ if (err || end != from+length ||
tmp > (ulonglong) (((longlong) 1 << typelib->count) - (longlong) 1))
{
tmp=0;
- error=1;
}
else
current_thd->cuted_fields--; // Remove warning from find_set
}
store_type(tmp);
- return error;
+ return err;
}
@@ -5273,7 +5211,8 @@ uint32 calc_pack_length(enum_field_types type,uint32 length)
case FIELD_TYPE_LONGLONG: return 8; /* Don't crash if no longlong */
case FIELD_TYPE_NULL : return 0;
case FIELD_TYPE_TINY_BLOB: return 1+portable_sizeof_char_ptr;
- case FIELD_TYPE_BLOB: return 2+portable_sizeof_char_ptr;
+ case FIELD_TYPE_BLOB:
+ case FIELD_TYPE_GEOMETRY: return 2+portable_sizeof_char_ptr;
case FIELD_TYPE_MEDIUM_BLOB: return 3+portable_sizeof_char_ptr;
case FIELD_TYPE_LONG_BLOB: return 4+portable_sizeof_char_ptr;
case FIELD_TYPE_SET:
@@ -5322,15 +5261,14 @@ Field *make_field(char *ptr, uint32 field_length,
f_packtype(pack_flag),
field_length);
- if (f_is_blob(pack_flag))
- return new Field_blob(ptr,null_pos,null_bit,
- unireg_check, field_name, table,
- pack_length, field_charset);
if (f_is_geom(pack_flag))
return new Field_geom(ptr,null_pos,null_bit,
unireg_check, field_name, table,
pack_length);
-
+ if (f_is_blob(pack_flag))
+ return new Field_blob(ptr,null_pos,null_bit,
+ unireg_check, field_name, table,
+ pack_length, field_charset);
if (interval)
{
if (f_is_enum(pack_flag))
@@ -5450,8 +5388,7 @@ create_field::create_field(Field *old_field,Field *orig_field)
orig_field)
{
char buff[MAX_FIELD_WIDTH],*pos;
- CHARSET_INFO *field_charset= charset;
- String tmp(buff,sizeof(buff),field_charset);
+ String tmp(buff,sizeof(buff), charset);
/* Get the value from record[2] (the default value row) */
my_ptrdiff_t diff= (my_ptrdiff_t) (orig_field->table->rec_buff_length*2);
@@ -5463,7 +5400,7 @@ create_field::create_field(Field *old_field,Field *orig_field)
{
pos= (char*) sql_memdup(tmp.ptr(),tmp.length()+1);
pos[tmp.length()]=0;
- def=new Item_string(pos,tmp.length(),field_charset);
+ def=new Item_string(pos,tmp.length(), charset);
}
}
}
diff --git a/sql/field.h b/sql/field.h
index f5c3dcbca68..dc0b1b35d5b 100644
--- a/sql/field.h
+++ b/sql/field.h
@@ -134,7 +134,9 @@ public:
tmp->unireg_check=Field::NONE;
tmp->flags&= (NOT_NULL_FLAG | BLOB_FLAG | UNSIGNED_FLAG |
ZEROFILL_FLAG | BINARY_FLAG | ENUM_FLAG | SET_FLAG);
+#ifdef PROBABLY_WRONG
tmp->table_name= new_table->table_name;
+#endif
tmp->reset_fields();
}
return tmp;
@@ -947,6 +949,8 @@ public:
:Field_blob(len_arg, maybe_null_arg, field_name_arg,
table_arg, my_charset_bin) {}
enum ha_base_keytype key_type() const { return HA_KEYTYPE_VARBINARY; }
+ enum_field_types type() const { return FIELD_TYPE_GEOMETRY;}
+ void sql_type(String &str) const;
void get_key_image(char *buff,uint length, CHARSET_INFO *cs,imagetype type);
void set_key_image(char *buff,uint length, CHARSET_INFO *cs);
@@ -1094,8 +1098,10 @@ uint32 calc_pack_length(enum_field_types type,uint32 length);
bool set_field_to_null(Field *field);
bool set_field_to_null_with_conversions(Field *field, bool no_conversions);
uint find_enum(TYPELIB *typelib,const char *x, uint length);
-ulonglong find_set(TYPELIB *typelib,const char *x, uint length);
-bool test_if_int(const char *str,int length,CHARSET_INFO *cs);
+ulonglong find_set(TYPELIB *typelib,const char *x, uint length,
+ char **err_pos, uint *err_len);
+bool test_if_int(const char *str, int length, const char *int_end,
+ CHARSET_INFO *cs);
/*
The following are for the interface with the .frm file
diff --git a/sql/field_conv.cc b/sql/field_conv.cc
index 95d06176cd2..47996606638 100644
--- a/sql/field_conv.cc
+++ b/sql/field_conv.cc
@@ -118,6 +118,15 @@ set_field_to_null(Field *field)
field->reset();
return 0;
}
+ field->reset();
+ if (current_thd->count_cuted_fields)
+ {
+ current_thd->cuted_fields++; // Increment error counter
+ return 0;
+ }
+ if (!current_thd->no_errors)
+ my_printf_error(ER_BAD_NULL_ERROR,ER(ER_BAD_NULL_ERROR),MYF(0),
+ field->field_name);
return 1;
}
diff --git a/sql/ha_berkeley.cc b/sql/ha_berkeley.cc
index adc2e0db195..6d2538279d9 100644
--- a/sql/ha_berkeley.cc
+++ b/sql/ha_berkeley.cc
@@ -512,7 +512,8 @@ int ha_berkeley::open(const char *name, int mode, uint test_if_locked)
file->app_private= (void*) (table->key_info+table->primary_key);
if ((error= txn_begin(db_env, 0, (DB_TXN**) &transaction, 0)) ||
(error= (file->open(file, transaction,
- fn_format(name_buff, name, "", ha_berkeley_ext, 2 | 4),
+ fn_format(name_buff, name, "", ha_berkeley_ext,
+ 2 | 4),
"main", DB_BTREE, open_mode, 0))) ||
(error= transaction->commit(transaction, 0)))
{
@@ -1950,10 +1951,13 @@ int ha_berkeley::rename_table(const char * from, const char * to)
if ((error= db_create(&file, db_env, 0)))
my_errno= error;
else
+ {
+ /* On should not do a file->close() after rename returns */
error= file->rename(file,
fn_format(from_buff, from, "", ha_berkeley_ext, 2 | 4),
NULL, fn_format(to_buff, to, "", ha_berkeley_ext,
2 | 4), 0);
+ }
return error;
}
@@ -2093,6 +2097,7 @@ static void print_msg(THD *thd, const char *table_name, const char *op_name,
msgbuf[sizeof(msgbuf) - 1] = 0; // healthy paranoia
DBUG_PRINT(msg_type,("message: %s",msgbuf));
+ protocol->set_nfields(4);
protocol->prepare_for_resend();
protocol->store(table_name);
protocol->store(op_name);
@@ -2115,7 +2120,7 @@ int ha_berkeley::analyze(THD* thd, HA_CHECK_OPT* check_opt)
free(stat);
stat=0;
}
- if (key_file[i]->stat(key_file[i], (void*) &stat, 0))
+ if ((key_file[i]->stat)(key_file[i], (void*) &stat, 0))
goto err; /* purecov: inspected */
share->rec_per_key[i]= (stat->bt_ndata /
(stat->bt_nkeys ? stat->bt_nkeys : 1));
@@ -2128,7 +2133,7 @@ int ha_berkeley::analyze(THD* thd, HA_CHECK_OPT* check_opt)
free(stat);
stat=0;
}
- if (file->stat(file, (void*) &stat, 0))
+ if ((file->stat)(file, (void*) &stat, 0))
goto err; /* purecov: inspected */
}
pthread_mutex_lock(&share->mutex);
diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc
index 8f933085066..6e2b08005df 100644
--- a/sql/ha_innodb.cc
+++ b/sql/ha_innodb.cc
@@ -82,7 +82,8 @@ are declared in mysqld.cc: */
long innobase_mirrored_log_groups, innobase_log_files_in_group,
innobase_log_file_size, innobase_log_buffer_size,
- innobase_buffer_pool_size, innobase_additional_mem_pool_size,
+ innobase_buffer_pool_size, innobase_buffer_pool_awe_mem_mb,
+ innobase_additional_mem_pool_size,
innobase_file_io_threads, innobase_lock_wait_timeout,
innobase_thread_concurrency, innobase_force_recovery;
@@ -225,10 +226,14 @@ convert_error_code_to_mysql(
return(HA_ERR_ROW_IS_REFERENCED);
- } else if (error == (int) DB_CANNOT_ADD_CONSTRAINT) {
+ } else if (error == (int) DB_CANNOT_ADD_CONSTRAINT) {
return(HA_ERR_CANNOT_ADD_FOREIGN);
+ } else if (error == (int) DB_COL_APPEARS_TWICE_IN_INDEX) {
+
+ return(HA_ERR_WRONG_TABLE_DEF);
+
} else if (error == (int) DB_OUT_OF_FILE_SPACE) {
return(HA_ERR_RECORD_FILE_FULL);
@@ -749,7 +754,25 @@ innobase_init(void)
srv_log_buffer_size = (ulint) innobase_log_buffer_size;
srv_flush_log_at_trx_commit = (ulint) innobase_flush_log_at_trx_commit;
- srv_pool_size = (ulint) innobase_buffer_pool_size;
+ /* We set srv_pool_size here in units of 1 kB. InnoDB internally
+ changes the value so that it becomes the number of database pages. */
+
+ if (innobase_buffer_pool_awe_mem_mb == 0) {
+ /* Careful here: we first convert the signed long int to ulint
+ and only after that divide */
+
+ srv_pool_size = ((ulint) innobase_buffer_pool_size) / 1024;
+ } else {
+ srv_use_awe = TRUE;
+ srv_pool_size = (ulint)
+ (1024 * innobase_buffer_pool_awe_mem_mb);
+ srv_awe_window_size = (ulint) innobase_buffer_pool_size;
+
+ /* Note that what the user specified as
+ innodb_buffer_pool_size is actually the AWE memory window
+ size in this case, and the real buffer pool size is
+ determined by .._awe_mem_mb. */
+ }
srv_mem_pool_size = (ulint) innobase_additional_mem_pool_size;
@@ -871,6 +894,7 @@ innobase_commit_low(
/*================*/
trx_t* trx) /* in: transaction handle */
{
+#ifdef HAVE_REPLICATION
if (current_thd->slave_thread) {
/* Update the replication position info inside InnoDB */
#ifdef NEED_TO_BE_FIXED
@@ -884,6 +908,7 @@ innobase_commit_low(
active_mi->rli.event_len +
active_mi->rli.pending));
}
+#endif /* HAVE_REPLICATION */
trx_commit_for_mysql(trx);
}
@@ -1233,7 +1258,14 @@ ha_innobase::open(
if (primary_key != MAX_KEY) {
fprintf(stderr,
"InnoDB: Error: table %s has no primary key in InnoDB\n"
- "InnoDB: data dictionary, but has one in MySQL!\n", name);
+ "InnoDB: data dictionary, but has one in MySQL!\n"
+ "InnoDB: If you created the table with a MySQL\n"
+ "InnoDB: version < 3.23.54 and did not define a primary\n"
+ "InnoDB: key, but defined a unique key with all non-NULL\n"
+ "InnoDB: columns, then MySQL internally treats that key\n"
+ "InnoDB: as the primary key. You can fix this error by\n"
+ "InnoDB: dump + DROP + CREATE + reimport of the table.\n",
+ name);
}
((row_prebuilt_t*)innobase_prebuilt)
@@ -1570,6 +1602,8 @@ build_template(
ibool fetch_all_in_key = FALSE;
ulint i;
+ ut_a(templ_type != ROW_MYSQL_REC_FIELDS || thd == current_thd);
+
clust_index = dict_table_get_first_index_noninline(prebuilt->table);
if (!prebuilt->hint_no_need_to_fetch_extra_cols) {
@@ -1594,6 +1628,12 @@ build_template(
}
if (prebuilt->select_lock_type == LOCK_X) {
+ /* In versions < 3.23.50 we always retrieved the clustered
+ index record if prebuilt->select_lock_type == LOCK_S,
+ but there is really not need for that, and in some cases
+ performance could be seriously degraded because the MySQL
+ optimizer did not know about our convention! */
+
/* We always retrieve the whole clustered index record if we
use exclusive row level locks, for example, if the read is
done in an UPDATE statement. */
@@ -1602,12 +1642,6 @@ build_template(
}
if (templ_type == ROW_MYSQL_REC_FIELDS) {
- /* In versions < 3.23.50 we always retrieved the clustered
- index record if prebuilt->select_lock_type == LOCK_S,
- but there is really not need for that, and in some cases
- performance could be seriously degraded because the MySQL
- optimizer did not know about our convention! */
-
index = prebuilt->index;
} else {
index = clust_index;
@@ -1898,12 +1932,9 @@ ha_innobase::write_row(
the counter here. */
skip_auto_inc_decr = FALSE;
-
- if (error == DB_DUPLICATE_KEY) {
- ut_a(user_thd->query);
- dict_accept(user_thd->query, "REPLACE",
- &skip_auto_inc_decr);
- }
+ if (error == DB_DUPLICATE_KEY &&
+ user_thd->lex.sql_command == SQLCOM_REPLACE)
+ skip_auto_inc_decr= TRUE;
if (!skip_auto_inc_decr && incremented_auto_inc_counter
&& prebuilt->trx->auto_inc_lock) {
@@ -2243,19 +2274,7 @@ convert_search_mode_to_innobase(
case HA_READ_AFTER_KEY: return(PAGE_CUR_G);
case HA_READ_BEFORE_KEY: return(PAGE_CUR_L);
case HA_READ_PREFIX: return(PAGE_CUR_GE);
- case HA_READ_PREFIX_LAST:
- /* ut_print_timestamp(stderr);
- fprintf(stderr,
- " InnoDB: Warning: Using HA_READ_PREFIX_LAST\n"); */
- return(PAGE_CUR_LE);
-
- /* InnoDB does not yet support ..PREFIX_LAST!
- We have to add a new search flag
- PAGE_CUR_LE_OR_PREFIX to InnoDB. */
-
- /* the above PREFIX flags mean that the last
- field in the key value may just be a prefix
- of the complete fixed length field */
+ case HA_READ_PREFIX_LAST: return(PAGE_CUR_LE_OR_EXTENDS);
default: assert(0);
}
@@ -2439,7 +2458,9 @@ ha_innobase::index_read_last(
}
/************************************************************************
-Changes the active index of a handle. */
+Changes the active index of a handle. Note that since we build also the
+template for a search, update_thd() must already have been called, in
+::external_lock, for example. */
int
ha_innobase::change_active_index(
@@ -2454,6 +2475,13 @@ ha_innobase::change_active_index(
statistic_increment(ha_read_key_count, &LOCK_status);
DBUG_ENTER("change_active_index");
+ ut_a(prebuilt->trx ==
+ (trx_t*) current_thd->transaction.all.innobase_tid);
+ ut_a(user_thd == current_thd);
+
+ ut_a(prebuilt->trx ==
+ (trx_t*) current_thd->transaction.all.innobase_tid);
+
active_index = keynr;
if (keynr != MAX_KEY && table->keys > 0) {
@@ -2479,11 +2507,13 @@ ha_innobase::change_active_index(
dict_index_copy_types(prebuilt->search_tuple, prebuilt->index,
prebuilt->index->n_fields);
- /* Maybe MySQL changes the active index for a handle also
- during some queries, we do not know: then it is safest to build
- the template such that all columns will be fetched */
+ /* MySQL changes the active index for a handle also during some
+ queries, for example SELECT MAX(a), SUM(a) first retrieves the MAX()
+ and then calculates te sum. Previously we played safe and used
+ the flag ROW_MYSQL_WHOLE_ROW below, but that caused unnecessary
+ copying. Starting from MySQL-4.1 we use a more efficient flag here. */
- build_template(prebuilt, user_thd, table, ROW_MYSQL_WHOLE_ROW);
+ build_template(prebuilt, user_thd, table, ROW_MYSQL_REC_FIELDS);
DBUG_RETURN(0);
}
@@ -2988,6 +3018,7 @@ ha_innobase::create(
{
int error;
dict_table_t* innobase_table;
+ trx_t* parent_trx;
trx_t* trx;
int primary_key_no;
uint i;
@@ -2999,6 +3030,16 @@ ha_innobase::create(
DBUG_ASSERT(thd != NULL);
+ /* Get the transaction associated with the current thd, or create one
+ if not yet created */
+
+ parent_trx = check_trx_exists(current_thd);
+
+ /* In case MySQL calls this in the middle of a SELECT query, release
+ possible adaptive hash latch to avoid deadlocks of threads */
+
+ trx_search_latch_release_if_reserved(parent_trx);
+
trx = trx_allocate_for_mysql();
if (thd->options & OPTION_NO_FOREIGN_KEY_CHECKS) {
@@ -3159,11 +3200,22 @@ ha_innobase::delete_table(
{
ulint name_len;
int error;
+ trx_t* parent_trx;
trx_t* trx;
char norm_name[1000];
DBUG_ENTER("ha_innobase::delete_table");
+ /* Get the transaction associated with the current thd, or create one
+ if not yet created */
+
+ parent_trx = check_trx_exists(current_thd);
+
+ /* In case MySQL calls this in the middle of a SELECT query, release
+ possible adaptive hash latch to avoid deadlocks of threads */
+
+ trx_search_latch_release_if_reserved(parent_trx);
+
if (lower_case_table_names) {
srv_lower_case_table_names = TRUE;
} else {
@@ -3218,11 +3270,22 @@ innobase_drop_database(
the database name is 'test' */
{
ulint len = 0;
+ trx_t* parent_trx;
trx_t* trx;
char* ptr;
int error;
char namebuf[10000];
+ /* Get the transaction associated with the current thd, or create one
+ if not yet created */
+
+ parent_trx = check_trx_exists(current_thd);
+
+ /* In case MySQL calls this in the middle of a SELECT query, release
+ possible adaptive hash latch to avoid deadlocks of threads */
+
+ trx_search_latch_release_if_reserved(parent_trx);
+
ptr = strend(path) - 2;
while (ptr >= path && *ptr != '\\' && *ptr != '/') {
@@ -3274,12 +3337,23 @@ ha_innobase::rename_table(
ulint name_len1;
ulint name_len2;
int error;
+ trx_t* parent_trx;
trx_t* trx;
char norm_from[1000];
char norm_to[1000];
DBUG_ENTER("ha_innobase::rename_table");
+ /* Get the transaction associated with the current thd, or create one
+ if not yet created */
+
+ parent_trx = check_trx_exists(current_thd);
+
+ /* In case MySQL calls this in the middle of a SELECT query, release
+ possible adaptive hash latch to avoid deadlocks of threads */
+
+ trx_search_latch_release_if_reserved(parent_trx);
+
if (lower_case_table_names) {
srv_lower_case_table_names = TRUE;
} else {
@@ -3326,8 +3400,8 @@ Estimates the number of index records in a range. */
ha_rows
ha_innobase::records_in_range(
/*==========================*/
- /* out: estimated number of rows,
- currently 32-bit int or uint */
+ /* out: estimated number of
+ rows */
int keynr, /* in: index number */
const mysql_byte* start_key, /* in: start key value of the
range, may also be empty */
@@ -3358,9 +3432,18 @@ ha_innobase::records_in_range(
DBUG_ENTER("records_in_range");
- /* Warning: since it is not sure that MySQL calls external_lock
- before calling this function, the trx field in prebuilt can be
- obsolete! */
+ /* We do not know if MySQL can call this function before calling
+ external_lock(). To be safe, update the thd of the current table
+ handle. */
+
+ update_thd(current_thd);
+
+ prebuilt->trx->op_info = (char*)"estimating records in index range";
+
+ /* In case MySQL calls this in the middle of a SELECT query, release
+ possible adaptive hash latch to avoid deadlocks of threads */
+
+ trx_search_latch_release_if_reserved(prebuilt->trx);
active_index = keynr;
@@ -3394,6 +3477,8 @@ ha_innobase::records_in_range(
my_free((char*) key_val_buff2, MYF(0));
+ prebuilt->trx->op_info = (char*)"";
+
DBUG_RETURN((ha_rows) n_rows);
}
@@ -3414,11 +3499,21 @@ ha_innobase::estimate_number_of_rows(void)
ulonglong estimate;
ulonglong local_data_file_length;
- /* Warning: since it is not sure that MySQL calls external_lock
- before calling this function, the trx field in prebuilt can be
- obsolete! */
+ DBUG_ENTER("estimate_number_of_rows");
- DBUG_ENTER("info");
+ /* We do not know if MySQL can call this function before calling
+ external_lock(). To be safe, update the thd of the current table
+ handle. */
+
+ update_thd(current_thd);
+
+ prebuilt->trx->op_info = (char*)
+ "calculating upper bound for table rows";
+
+ /* In case MySQL calls this in the middle of a SELECT query, release
+ possible adaptive hash latch to avoid deadlocks of threads */
+
+ trx_search_latch_release_if_reserved(prebuilt->trx);
index = dict_table_get_first_index_noninline(prebuilt->table);
@@ -3433,6 +3528,8 @@ ha_innobase::estimate_number_of_rows(void)
estimate = 2 * local_data_file_length / dict_index_calc_min_rec_len(index);
+ prebuilt->trx->op_info = (char*)"";
+
DBUG_RETURN((ha_rows) estimate);
}
@@ -3483,9 +3580,18 @@ ha_innobase::info(
return;
}
- /* Warning: since it is not sure that MySQL calls external_lock
- before calling this function, the trx field in prebuilt can be
- obsolete! */
+ /* We do not know if MySQL can call this function before calling
+ external_lock(). To be safe, update the thd of the current table
+ handle. */
+
+ update_thd(current_thd);
+
+ /* In case MySQL calls this in the middle of a SELECT query, release
+ possible adaptive hash latch to avoid deadlocks of threads */
+
+ prebuilt->trx->op_info = (char*)"returning various info to MySQL";
+
+ trx_search_latch_release_if_reserved(prebuilt->trx);
ib_table = prebuilt->table;
@@ -3493,7 +3599,12 @@ ha_innobase::info(
/* In sql_show we call with this flag: update then statistics
so that they are up-to-date */
+ prebuilt->trx->op_info = (char*)"updating table statistics";
+
dict_update_statistics(ib_table);
+
+ prebuilt->trx->op_info = (char*)
+ "returning various info to MySQL";
}
if (flag & HA_STATUS_VARIABLE) {
@@ -3553,12 +3664,6 @@ ha_innobase::info(
}
}
- /* The trx struct in InnoDB contains a pthread mutex embedded:
- in the debug version of MySQL that it replaced by a 'safe mutex'
- which is of a different size. We have to use a function to access
- trx fields. Otherwise trx->error_info will be a random
- pointer and cause a seg fault. */
-
if (flag & HA_STATUS_ERRKEY) {
ut_a(prebuilt->trx && prebuilt->trx->magic_n == TRX_MAGIC_N);
@@ -3567,6 +3672,8 @@ ha_innobase::info(
trx_get_error_info(prebuilt->trx));
}
+ prebuilt->trx->op_info = (char*)"";
+
DBUG_VOID_RETURN;
}
@@ -3624,11 +3731,22 @@ ha_innobase::update_table_comment(
char* str = my_malloc(length + 16500, MYF(0));
char* pos;
- /* Warning: since it is not sure that MySQL calls external_lock
- before calling this function, the trx field in prebuilt can be
- obsolete! */
+ /* We do not know if MySQL can call this function before calling
+ external_lock(). To be safe, update the thd of the current table
+ handle. */
+
+ update_thd(current_thd);
+
+ prebuilt->trx->op_info = (char*)"returning table comment";
+
+ /* In case MySQL calls this in the middle of a SELECT query, release
+ possible adaptive hash latch to avoid deadlocks of threads */
+
+ trx_search_latch_release_if_reserved(prebuilt->trx);
if (!str) {
+ prebuilt->trx->op_info = (char*)"";
+
return((char*)comment);
}
@@ -3652,6 +3770,8 @@ ha_innobase::update_table_comment(
prebuilt->table);
}
+ prebuilt->trx->op_info = (char*)"";
+
return(str);
}
@@ -3667,20 +3787,30 @@ ha_innobase::get_foreign_key_create_info(void)
{
row_prebuilt_t* prebuilt = (row_prebuilt_t*)innobase_prebuilt;
char* str;
-
- if (prebuilt == NULL) {
- fprintf(stderr,
-"InnoDB: Error: cannot get create info for foreign keys\n");
- return(NULL);
- }
+ ut_a(prebuilt != NULL);
+
+ /* We do not know if MySQL can call this function before calling
+ external_lock(). To be safe, update the thd of the current table
+ handle. */
+
+ update_thd(current_thd);
+ prebuilt->trx->op_info = (char*)"getting info on foreign keys";
+
+ /* In case MySQL calls this in the middle of a SELECT query, release
+ possible adaptive hash latch to avoid deadlocks of threads */
+
+ trx_search_latch_release_if_reserved(prebuilt->trx);
+
str = (char*)ut_malloc(10000);
str[0] = '\0';
dict_print_info_on_foreign_keys(TRUE, str, 9000, prebuilt->table);
+ prebuilt->trx->op_info = (char*)"";
+
return(str);
}
@@ -3715,8 +3845,18 @@ ha_innobase::extra(
obsolete! */
switch (operation) {
+ case HA_EXTRA_FLUSH:
+ if (prebuilt->blob_heap) {
+ row_mysql_prebuilt_free_blob_heap(prebuilt);
+ }
+ break;
case HA_EXTRA_RESET:
- case HA_EXTRA_RESET_STATE:
+ if (prebuilt->blob_heap) {
+ row_mysql_prebuilt_free_blob_heap(prebuilt);
+ }
+ prebuilt->read_just_key = 0;
+ break;
+ case HA_EXTRA_RESET_STATE:
prebuilt->read_just_key = 0;
break;
case HA_EXTRA_NO_KEYREAD:
@@ -3746,9 +3886,10 @@ ha_innobase::reset(void)
}
/**********************************************************************
-When we create a temporary table inside MySQL LOCK TABLES, MySQL will
-not call external_lock for the temporary table when it uses it. Instead,
-it will call this function. */
+Inside LOCK TABLES MySQL will not call external_lock() between SQL
+statements. It will call this function at the start of each SQL statement.
+Note also a spacial case: if a temporary table is created inside LOCK
+TABLES, MySQL has not called external_lock() at all on that table. */
int
ha_innobase::start_stmt(
@@ -3803,8 +3944,8 @@ innobase_map_isolation_level(
enum_tx_isolation iso) /* in: MySQL isolation level code */
{
switch(iso) {
- case ISO_READ_COMMITTED: return(TRX_ISO_READ_COMMITTED);
case ISO_REPEATABLE_READ: return(TRX_ISO_REPEATABLE_READ);
+ case ISO_READ_COMMITTED: return(TRX_ISO_READ_COMMITTED);
case ISO_SERIALIZABLE: return(TRX_ISO_SERIALIZABLE);
case ISO_READ_UNCOMMITTED: return(TRX_ISO_READ_UNCOMMITTED);
default: ut_a(0); return(0);
@@ -3859,11 +4000,9 @@ ha_innobase::external_lock(
trx->n_mysql_tables_in_use++;
prebuilt->mysql_has_locked = TRUE;
- if (thd->variables.tx_isolation != ISO_REPEATABLE_READ) {
- trx->isolation_level = innobase_map_isolation_level(
+ trx->isolation_level = innobase_map_isolation_level(
(enum_tx_isolation)
thd->variables.tx_isolation);
- }
if (trx->isolation_level == TRX_ISO_SERIALIZABLE
&& prebuilt->select_lock_type == LOCK_NONE) {
@@ -3888,8 +4027,8 @@ ha_innobase::external_lock(
trx->mysql_n_tables_locked = 0;
- /* Here we release the search latch, auto_inc_lock,
- and InnoDB thread FIFO ticket if they were reserved. */
+ /* Here we release the search latch and InnoDB
+ thread FIFO ticket if they were reserved. */
innobase_release_stat_resources(trx);
@@ -3933,12 +4072,12 @@ innodb_show_status(
DBUG_RETURN(-1);
}
- /* We let the InnoDB Monitor to output at most 100 kB of text, add
+ /* We let the InnoDB Monitor to output at most 200 kB of text, add
a safety margin of 10 kB for buffer overruns */
- buf = (char*)ut_malloc(110 * 1024);
+ buf = (char*)ut_malloc(210 * 1024);
- srv_sprintf_innodb_monitor(buf, 100 * 1024);
+ srv_sprintf_innodb_monitor(buf, 200 * 1024);
List<Item> field_list;
@@ -3946,6 +4085,7 @@ innodb_show_status(
if (protocol->send_fields(&field_list, 1))
{
+ ut_free(buf);
DBUG_RETURN(-1);
}
@@ -4196,4 +4336,4 @@ ha_innobase::get_auto_increment()
}
#endif /* HAVE_INNOBASE_DB */
-
+
diff --git a/sql/ha_innodb.h b/sql/ha_innodb.h
index d2639f39c5b..86fb5d1947b 100644
--- a/sql/ha_innodb.h
+++ b/sql/ha_innodb.h
@@ -178,7 +178,8 @@ extern char *innobase_home, *innobase_tmpdir, *innobase_logdir;
extern long innobase_lock_scan_time;
extern long innobase_mirrored_log_groups, innobase_log_files_in_group;
extern long innobase_log_file_size, innobase_log_buffer_size;
-extern long innobase_buffer_pool_size, innobase_additional_mem_pool_size;
+extern long innobase_buffer_pool_size, innobase_buffer_pool_awe_mem_mb,
+ innobase_additional_mem_pool_size;
extern long innobase_file_io_threads, innobase_lock_wait_timeout;
extern long innobase_force_recovery, innobase_thread_concurrency;
extern char *innobase_data_home_dir, *innobase_data_file_path;
diff --git a/sql/ha_myisam.cc b/sql/ha_myisam.cc
index 67fddf34d5c..754d7dc8641 100644
--- a/sql/ha_myisam.cc
+++ b/sql/ha_myisam.cc
@@ -60,11 +60,14 @@ static void mi_check_print_msg(MI_CHECK *param, const char* msg_type,
DBUG_PRINT(msg_type,("message: %s",msgbuf));
+#ifndef EMBEDDED_LIBRARY
if (thd->net.vio == 0)
{
sql_print_error(msgbuf);
return;
}
+#endif
+
if (param->testflag & (T_CREATE_MISSING_KEYS | T_SAFE_REPAIR |
T_AUTO_REPAIR))
{
@@ -136,6 +139,7 @@ const char *ha_myisam::index_type(uint key_number)
"BTREE");
}
+#ifdef HAVE_REPLICATION
int ha_myisam::net_read_dump(NET* net)
{
int data_fd = file->dfile;
@@ -160,7 +164,6 @@ int ha_myisam::net_read_dump(NET* net)
goto err;
}
}
-
err:
return error;
}
@@ -217,6 +220,7 @@ err:
my_free((gptr) buf, MYF(0));
return error;
}
+#endif /* HAVE_REPLICATION */
/* Name is here without an extension */
@@ -637,7 +641,7 @@ int ha_myisam::repair(THD *thd, MI_CHECK &param, bool optimize)
the following 'if', thought conceptually wrong,
is a useful optimization nevertheless.
*/
- if (file->state != &file->s->state.state);
+ if (file->state != &file->s->state.state)
file->s->state.state = *file->state;
if (file->s->base.auto_key)
update_auto_increment_key(&param, file, 1);
@@ -691,12 +695,22 @@ void ha_myisam::deactivate_non_unique_index(ha_rows rows)
mi_extra(file, HA_EXTRA_NO_KEYS, 0);
else
{
- /* Only disable old index if the table was empty */
- if (file->state->records == 0)
+ /*
+ Only disable old index if the table was empty and we are inserting
+ a lot of rows.
+ We should not do this for only a few rows as this is slower and
+ we don't want to update the key statistics based of only a few rows.
+ */
+ if (file->state->records == 0 &&
+ (!rows || rows >= MI_MIN_ROWS_TO_USE_BULK_INSERT))
mi_disable_non_unique_index(file,rows);
- ha_myisam::extra_opt(HA_EXTRA_BULK_INSERT_BEGIN,
- current_thd->variables.bulk_insert_buff_size);
- table->bulk_insert= 1;
+ else
+ {
+ mi_init_bulk_insert(file,
+ current_thd->variables.bulk_insert_buff_size,
+ rows);
+ table->bulk_insert= 1;
+ }
}
}
enable_activate_all_index=1;
@@ -713,7 +727,7 @@ bool ha_myisam::activate_all_index(THD *thd)
MYISAM_SHARE* share = file->s;
DBUG_ENTER("activate_all_index");
- mi_extra(file, HA_EXTRA_BULK_INSERT_END, 0);
+ mi_end_bulk_insert(file);
table->bulk_insert= 0;
if (enable_activate_all_index &&
share->state.key_map != set_bits(ulonglong, share->base.keys))
@@ -954,13 +968,11 @@ int ha_myisam::extra(enum ha_extra_function operation)
}
-/* To be used with WRITE_CACHE, EXTRA_CACHE and BULK_INSERT_BEGIN */
+/* To be used with WRITE_CACHE and EXTRA_CACHE */
int ha_myisam::extra_opt(enum ha_extra_function operation, ulong cache_size)
{
- if ((specialflag & SPECIAL_SAFE_MODE) &
- (operation == HA_EXTRA_WRITE_CACHE ||
- operation == HA_EXTRA_BULK_INSERT_BEGIN))
+ if ((specialflag & SPECIAL_SAFE_MODE) && operation == HA_EXTRA_WRITE_CACHE)
return 0;
return mi_extra(file, operation, (void*) &cache_size);
}
@@ -1045,8 +1057,9 @@ int ha_myisam::create(const char *name, register TABLE *table_arg,
for (i=0; i < table_arg->keys ; i++, pos++)
{
keydef[i].flag= (pos->flags & (HA_NOSAME | HA_FULLTEXT | HA_SPATIAL));
- keydef[i].key_alg=pos->algorithm == HA_KEY_ALG_UNDEF ?
- HA_KEY_ALG_BTREE : pos->algorithm;
+ keydef[i].key_alg= pos->algorithm == HA_KEY_ALG_UNDEF ?
+ (pos->flags & HA_SPATIAL ? HA_KEY_ALG_RTREE : HA_KEY_ALG_BTREE) :
+ pos->algorithm;
keydef[i].seg=keyseg;
keydef[i].keysegs=pos->key_parts;
for (j=0 ; j < pos->key_parts ; j++)
@@ -1100,7 +1113,7 @@ int ha_myisam::create(const char *name, register TABLE *table_arg,
keydef[i].flag|=HA_AUTO_KEY;
found_auto_increment=1;
}
- if (field->type() == FIELD_TYPE_BLOB)
+ if ((field->type() == FIELD_TYPE_BLOB) || (field->type() == FIELD_TYPE_GEOMETRY))
{
keydef[i].seg[j].flag|=HA_BLOB_PART;
/* save number of bytes used to pack length */
@@ -1224,8 +1237,7 @@ longlong ha_myisam::get_auto_increment()
}
if (table->bulk_insert)
- mi_extra(file, HA_EXTRA_BULK_INSERT_FLUSH,
- (void*) &table->next_number_index);
+ mi_flush_bulk_insert(file, table->next_number_index);
longlong nr;
int error;
diff --git a/sql/ha_myisam.h b/sql/ha_myisam.h
index 215608f8f0a..5dc294b3b9f 100644
--- a/sql/ha_myisam.h
+++ b/sql/ha_myisam.h
@@ -127,6 +127,8 @@ class ha_myisam: public handler
int optimize(THD* thd, HA_CHECK_OPT* check_opt);
int restore(THD* thd, HA_CHECK_OPT* check_opt);
int backup(THD* thd, HA_CHECK_OPT* check_opt);
+#ifdef HAVE_REPLICATION
int dump(THD* thd, int fd);
int net_read_dump(NET* net);
+#endif
};
diff --git a/sql/ha_myisammrg.cc b/sql/ha_myisammrg.cc
index 4398aaecf4d..00052239f0b 100644
--- a/sql/ha_myisammrg.cc
+++ b/sql/ha_myisammrg.cc
@@ -239,6 +239,13 @@ void ha_myisammrg::info(uint flag)
#else
ref_length=4; // Can't be > than my_off_t
#endif
+ if (flag & HA_STATUS_CONST)
+ {
+ if (table->key_parts && info.rec_per_key)
+ memcpy((char*) table->key_info[0].rec_per_key,
+ (char*) info.rec_per_key,
+ sizeof(table->key_info[0].rec_per_key)*table->key_parts);
+ }
}
@@ -257,9 +264,7 @@ int ha_myisammrg::extra(enum ha_extra_function operation)
int ha_myisammrg::extra_opt(enum ha_extra_function operation, ulong cache_size)
{
- if ((specialflag & SPECIAL_SAFE_MODE) &
- (operation == HA_EXTRA_WRITE_CACHE ||
- operation == HA_EXTRA_BULK_INSERT_BEGIN))
+ if ((specialflag & SPECIAL_SAFE_MODE) && operation == HA_EXTRA_WRITE_CACHE)
return 0;
return myrg_extra(file, operation, (void*) &cache_size);
}
diff --git a/sql/item.cc b/sql/item.cc
index ae5fd287a24..881e65310cf 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -116,7 +116,7 @@ bool Item_string::eq(const Item *item, bool binary_cmp) const
bool Item::get_date(TIME *ltime,bool fuzzydate)
{
char buff[40];
- String tmp(buff,sizeof(buff),NULL),*res;
+ String tmp(buff,sizeof(buff), my_charset_bin),*res;
if (!(res=val_str(&tmp)) ||
str_to_TIME(res->ptr(),res->length(),ltime,fuzzydate) == TIMESTAMP_NONE)
{
@@ -134,7 +134,7 @@ bool Item::get_date(TIME *ltime,bool fuzzydate)
bool Item::get_time(TIME *ltime)
{
char buff[40];
- String tmp(buff,sizeof(buff),NULL),*res;
+ String tmp(buff,sizeof(buff),my_charset_bin),*res;
if (!(res=val_str(&tmp)) ||
str_to_time(res->ptr(),res->length(),ltime))
{
@@ -378,9 +378,11 @@ int Item_param::save_in_field(Field *field, bool no_conversions)
double Item_param::val()
{
+ int err;
switch (item_result_type) {
case STRING_RESULT:
- return (double)my_strntod(str_value.charset(),str_value.ptr(),str_value.length(),(char**)0);
+ return (double) my_strntod(str_value.charset(), (char*) str_value.ptr(),
+ str_value.length(), (char**) 0, &err);
case INT_RESULT:
return (double)int_value;
default:
@@ -391,9 +393,12 @@ double Item_param::val()
longlong Item_param::val_int()
{
+ int err;
switch (item_result_type) {
case STRING_RESULT:
- return my_strntoll(str_value.charset(),str_value.ptr(),str_value.length(),(char**) 0,10);
+ return my_strntoll(str_value.charset(),
+ str_value.ptr(),str_value.length(),10,
+ (char**) 0,&err);
case REAL_RESULT:
return (longlong) (real_value+(real_value > 0 ? 0.5 : -0.5));
default:
@@ -563,7 +568,9 @@ bool Item_field::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
cause error ER_NON_UNIQ_ERROR in find_field_in_tables.
*/
SELECT_LEX *last= 0;
-
+#ifdef EMBEDDED_LIBRARY
+ thd->net.last_errno= 0;
+#endif
Item **refer= (Item **)not_found_item;
// Prevent using outer fields in subselects, that is not supported now
SELECT_LEX *cursel=(SELECT_LEX *) thd->lex.current_select;
@@ -601,7 +608,7 @@ bool Item_field::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
(char *)field_name);
if (!r)
return 1;
- if (r->check_cols(1) || r->fix_fields(thd, tables, ref))
+ if (r->fix_fields(thd, tables, ref) || r->check_cols(1))
return 1;
r->depended_from= last;
cursel->mark_as_dependent(last);
@@ -625,7 +632,7 @@ bool Item_field::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
if (!rf)
return 1;
(rf)->outer_resolving= outer_resolving;
- return rf->check_cols(1) || rf->fix_fields(thd, tables, ref);
+ return rf->fix_fields(thd, tables, ref) || rf->check_cols(1);
}
}
}
@@ -1195,7 +1202,7 @@ Item *resolve_const_item(Item *item,Item *comp_item)
if (res_type == STRING_RESULT)
{
char buff[MAX_FIELD_WIDTH];
- String tmp(buff,sizeof(buff),NULL),*result;
+ String tmp(buff,sizeof(buff),my_charset_bin),*result;
result=item->val_str(&tmp);
if (item->null_value)
{
@@ -1250,8 +1257,8 @@ bool field_is_equal_to_item(Field *field,Item *item)
{
char item_buff[MAX_FIELD_WIDTH];
char field_buff[MAX_FIELD_WIDTH];
- String item_tmp(item_buff,sizeof(item_buff),NULL),*item_result;
- String field_tmp(field_buff,sizeof(field_buff),NULL);
+ String item_tmp(item_buff,sizeof(item_buff),my_charset_bin),*item_result;
+ String field_tmp(field_buff,sizeof(field_buff),my_charset_bin);
item_result=item->val_str(&item_tmp);
if (item->null_value)
return 1; // This must be true
@@ -1308,17 +1315,19 @@ void Item_cache_str::store(Item *item)
}
double Item_cache_str::val()
{
+ int err;
if (value)
- return my_strntod(value->charset(), value->ptr(),
- value->length(), (char**)0);
+ return my_strntod(value->charset(), (char*) value->ptr(),
+ value->length(), (char**) 0, &err);
else
return (double)0;
}
longlong Item_cache_str::val_int()
{
+ int err;
if (value)
return my_strntoll(value->charset(), value->ptr(),
- value->length(), (char**) 0, 10);
+ value->length(), 10, (char**) 0, &err);
else
return (longlong)0;
}
diff --git a/sql/item.h b/sql/item.h
index ec28cfe64cf..1881b15f6e5 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -183,6 +183,7 @@ public:
String *val_str(String *str);
int save_in_field(Field *field, bool no_conversions);
int save_safe_in_field(Field *field);
+ bool send(Protocol *protocol, String *str);
enum Item_result result_type () const { return STRING_RESULT; }
enum_field_types field_type() const { return MYSQL_TYPE_NULL; }
bool fix_fields(THD *thd, struct st_table_list *list, Item **item)
@@ -191,7 +192,6 @@ public:
max_length=0;
return res;
}
- bool send(Protocol *protocol, String *str);
bool basic_const_item() const { return 1; }
Item *new_item() { return new Item_null(name); }
bool is_null() { return 1; }
@@ -345,13 +345,15 @@ public:
enum Type type() const { return STRING_ITEM; }
double val()
{
- return my_strntod(str_value.charset(), str_value.ptr(),
- str_value.length(), (char**) 0);
+ int err;
+ return my_strntod(str_value.charset(), (char*) str_value.ptr(),
+ str_value.length(), (char**) 0, &err);
}
longlong val_int()
{
+ int err;
return my_strntoll(str_value.charset(), str_value.ptr(),
- str_value.length(), (char**) 0, 10);
+ str_value.length(), 10, (char**) 0, &err);
}
String *val_str(String*) { return (String*) &str_value; }
int save_in_field(Field *field, bool no_conversions);
@@ -579,9 +581,17 @@ public:
enum Item_result result_type () const { return STRING_RESULT; }
enum_field_types field_type() const { return cached_field_type; }
double val()
- { return null_value ? 0.0 : my_strntod(str_value.charset(),str_value.ptr(),str_value.length(),NULL); }
+ {
+ int err;
+ return (null_value ? 0.0 :
+ my_strntod(str_value.charset(), (char*) str_value.ptr(),
+ str_value.length(),NULL,&err));
+ }
longlong val_int()
- { return null_value ? LL(0) : my_strntoll(str_value.charset(),str_value.ptr(),str_value.length(),(char**) 0,10); }
+ {
+ int err;
+ return null_value ? LL(0) : my_strntoll(str_value.charset(),str_value.ptr(),str_value.length(),10, (char**) 0,&err);
+ }
String *val_str(String*);
void make_field(Send_field *field) { item->make_field(field); }
void copy();
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index 94423642fa5..83d05cf5398 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -868,8 +868,9 @@ String *Item_func_case::val_str(String *str)
null_value=1;
return 0;
}
+ null_value= 0;
if (!(res=item->val_str(str)))
- null_value=1;
+ null_value= 1;
return res;
}
@@ -912,10 +913,10 @@ double Item_func_case::val()
bool
Item_func_case::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
{
- if (first_expr && (first_expr->check_cols(1) ||
- first_expr->fix_fields(thd, tables, &first_expr)) ||
- else_expr && (else_expr->check_cols(1) ||
- else_expr->fix_fields(thd, tables, &else_expr)))
+ if (first_expr && (first_expr->fix_fields(thd, tables, &first_expr) ||
+ first_expr->check_cols(1)) ||
+ else_expr && (else_expr->fix_fields(thd, tables, &else_expr) ||
+ else_expr->check_cols(1)))
return 1;
if (Item_func::fix_fields(thd, tables, ref))
return 1;
@@ -1472,7 +1473,7 @@ Item_cond::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
}
if (abort_on_null)
item->top_level_item();
- if (item->check_cols(1) || item->fix_fields(thd, tables, li.ref()))
+ if (item->fix_fields(thd, tables, li.ref()) || item->check_cols(1))
return 1; /* purecov: inspected */
used_tables_cache|=item->used_tables();
with_sum_func= with_sum_func || item->with_sum_func;
@@ -1784,10 +1785,8 @@ bool Item_func_like::fix_fields(THD *thd, TABLE_LIST *tlist, Item ** ref)
bool
Item_func_regex::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
{
- if (args[0]->check_cols(1) ||
- args[1]->check_cols(1) ||
- args[0]->fix_fields(thd, tables, args) ||
- args[1]->fix_fields(thd,tables, args + 1))
+ if (args[0]->fix_fields(thd, tables, args) || args[0]->check_cols(1) ||
+ args[1]->fix_fields(thd,tables, args + 1) || args[1]->check_cols(1))
return 1; /* purecov: inspected */
with_sum_func=args[0]->with_sum_func || args[1]->with_sum_func;
max_length= 1;
@@ -1897,7 +1896,7 @@ Item_func_regex::~Item_func_regex()
Precomputation dependent only on pattern_len.
**********************************************************************/
-void Item_func_like::turboBM_compute_suffixes(int* suff)
+void Item_func_like::turboBM_compute_suffixes(int *suff)
{
const int plm1 = pattern_len - 1;
int f = 0;
@@ -1939,8 +1938,8 @@ void Item_func_like::turboBM_compute_suffixes(int* suff)
if (i < g)
g = i; // g = min(i, g)
f = i;
- while (g >= 0 && likeconv(cs, pattern[g]) ==
- likeconv(cs, pattern[g + plm1 - f]))
+ while (g >= 0 &&
+ likeconv(cs, pattern[g]) == likeconv(cs, pattern[g + plm1 - f]))
g--;
suff[i] = f - g;
}
@@ -1954,12 +1953,12 @@ void Item_func_like::turboBM_compute_suffixes(int* suff)
Precomputation dependent only on pattern_len.
**********************************************************************/
-void Item_func_like::turboBM_compute_good_suffix_shifts(int* suff)
+void Item_func_like::turboBM_compute_good_suffix_shifts(int *suff)
{
turboBM_compute_suffixes(suff);
- int* end = bmGs + pattern_len;
- int* k;
+ int *end = bmGs + pattern_len;
+ int *k;
for (k = bmGs; k < end; k++)
*k = pattern_len;
@@ -1973,14 +1972,14 @@ void Item_func_like::turboBM_compute_good_suffix_shifts(int* suff)
{
for (tmp = plm1 - i; j < tmp; j++)
{
- int* tmp2 = bmGs + j;
+ int *tmp2 = bmGs + j;
if (*tmp2 == pattern_len)
*tmp2 = tmp;
}
}
}
- int* tmp2;
+ int *tmp2;
for (tmp = plm1 - i; j < tmp; j++)
{
tmp2 = bmGs + j;
@@ -2013,12 +2012,12 @@ void Item_func_like::turboBM_compute_bad_character_shifts()
if (binary())
{
for (j = 0; j < plm1; j++)
- bmBc[pattern[j]] = plm1 - j;
+ bmBc[(uint) (uchar) pattern[j]] = plm1 - j;
}
else
{
for (j = 0; j < plm1; j++)
- bmBc[likeconv(cs,pattern[j])] = plm1 - j;
+ bmBc[(uint) likeconv(cs,pattern[j])] = plm1 - j;
}
}
@@ -2037,27 +2036,27 @@ bool Item_func_like::turboBM_matches(const char* text, int text_len) const
int u = 0;
CHARSET_INFO *cs=system_charset_info; // QQ Needs to be fixed
- const int plm1 = pattern_len - 1;
- const int tlmpl = text_len - pattern_len;
+ const int plm1= pattern_len - 1;
+ const int tlmpl= text_len - pattern_len;
/* Searching */
if (binary())
{
while (j <= tlmpl)
{
- register int i = plm1;
+ register int i= plm1;
while (i >= 0 && pattern[i] == text[i + j])
{
i--;
if (i == plm1 - shift)
- i -= u;
+ i-= u;
}
if (i < 0)
return 1;
register const int v = plm1 - i;
turboShift = u - v;
- bcShift = bmBc[text[i + j]] - plm1 + i;
+ bcShift = bmBc[(uint) (uchar) text[i + j]] - plm1 + i;
shift = max(turboShift, bcShift);
shift = max(shift, bmGs[i]);
if (shift == bmGs[i])
@@ -2068,7 +2067,7 @@ bool Item_func_like::turboBM_matches(const char* text, int text_len) const
shift = max(shift, u + 1);
u = 0;
}
- j += shift;
+ j+= shift;
}
return 0;
}
@@ -2081,14 +2080,14 @@ bool Item_func_like::turboBM_matches(const char* text, int text_len) const
{
i--;
if (i == plm1 - shift)
- i -= u;
+ i-= u;
}
if (i < 0)
return 1;
register const int v = plm1 - i;
turboShift = u - v;
- bcShift = bmBc[likeconv(cs, text[i + j])] - plm1 + i;
+ bcShift = bmBc[(uint) likeconv(cs, text[i + j])] - plm1 + i;
shift = max(turboShift, bcShift);
shift = max(shift, bmGs[i]);
if (shift == bmGs[i])
@@ -2099,7 +2098,7 @@ bool Item_func_like::turboBM_matches(const char* text, int text_len) const
shift = max(shift, u + 1);
u = 0;
}
- j += shift;
+ j+= shift;
}
return 0;
}
diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h
index bd7d1bfaf7a..8641ab410b3 100644
--- a/sql/item_cmpfunc.h
+++ b/sql/item_cmpfunc.h
@@ -275,8 +275,7 @@ public:
longlong val_int();
bool fix_fields(THD *thd, struct st_table_list *tlist, Item **ref)
{
- return (item->check_cols(1) ||
- item->fix_fields(thd, tlist, &item) ||
+ return (item->fix_fields(thd, tlist, &item) || item->check_cols(1) ||
Item_func::fix_fields(thd, tlist, ref));
}
void fix_length_and_dec();
diff --git a/sql/item_create.cc b/sql/item_create.cc
index 259427af901..0dba7f6e3ae 100644
--- a/sql/item_create.cc
+++ b/sql/item_create.cc
@@ -303,6 +303,18 @@ Item *create_func_pow(Item* a, Item *b)
return new Item_func_pow(a,b);
}
+Item *create_func_current_user()
+{
+ THD *thd=current_thd;
+ char buff[HOSTNAME_LENGTH+USERNAME_LENGTH+2];
+ uint length;
+
+ length= (uint) (strxmov(buff, thd->priv_user, "@", thd->host_or_ip, NullS) -
+ buff);
+ return new Item_string("CURRENT_USER()", thd->memdup(buff, length), length,
+ default_charset_info);
+}
+
Item *create_func_quarter(Item* a)
{
return new Item_func_quarter(a);
@@ -406,7 +418,7 @@ Item *create_func_ucase(Item* a)
Item *create_func_version(void)
{
- return new Item_string(NullS,server_version,
+ return new Item_string("VERSION()",server_version,
(uint) strlen(server_version),
default_charset_info);
}
diff --git a/sql/item_create.h b/sql/item_create.h
index 937ea782273..97386ca9b0b 100644
--- a/sql/item_create.h
+++ b/sql/item_create.h
@@ -71,6 +71,7 @@ Item *create_func_period_add(Item* a, Item *b);
Item *create_func_period_diff(Item* a, Item *b);
Item *create_func_pi(void);
Item *create_func_pow(Item* a, Item *b);
+Item *create_func_current_user(void);
Item *create_func_quarter(Item* a);
Item *create_func_radians(Item *a);
Item *create_func_release_lock(Item* a);
diff --git a/sql/item_func.cc b/sql/item_func.cc
index f0c956b873a..6612f61b4a1 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -110,8 +110,8 @@ Item_func::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
*/
for (arg=args, arg_end=args+arg_count; arg != arg_end ; arg++)
{
- if ((*arg)->check_cols(allowed_arg_cols) ||
- (*arg)->fix_fields(thd, tables, arg))
+ if ((*arg)->fix_fields(thd, tables, arg) ||
+ (*arg)->check_cols(allowed_arg_cols))
return 1; /* purecov: inspected */
if ((*arg)->maybe_null)
maybe_null=1;
@@ -394,7 +394,7 @@ void Item_func_minus::fix_length_and_dec()
{
Item_num_op::fix_length_and_dec();
if (unsigned_flag &&
- (current_thd->sql_mode & MODE_NO_UNSIGNED_SUBTRACTION))
+ (current_thd->variables.sql_mode & MODE_NO_UNSIGNED_SUBTRACTION))
unsigned_flag=0;
}
@@ -1323,7 +1323,7 @@ udf_handler::fix_fields(THD *thd, TABLE_LIST *tables, Item_result_field *func,
arg != arg_end ;
arg++,i++)
{
- if ((*arg)->check_cols(1) || (*arg)->fix_fields(thd, tables, arg))
+ if ((*arg)->fix_fields(thd, tables, arg) || (*arg)->check_cols(1))
return 1;
if ((*arg)->binary())
func->set_charset(my_charset_bin);
@@ -1666,6 +1666,7 @@ longlong Item_master_pos_wait::val_int()
return 0;
}
ulong pos = (ulong)args[1]->val_int();
+#ifdef HAVE_REPLICATION
LOCK_ACTIVE_MI;
if ((event_count = active_mi->rli.wait_for_pos(thd, log_name, pos)) == -1)
{
@@ -1673,6 +1674,7 @@ longlong Item_master_pos_wait::val_int()
event_count=0;
}
UNLOCK_ACTIVE_MI;
+#endif
return event_count;
}
@@ -1893,7 +1895,7 @@ longlong Item_func_set_last_insert_id::val_int()
longlong Item_func_benchmark::val_int()
{
char buff[MAX_FIELD_WIDTH];
- String tmp(buff,sizeof(buff), NULL);
+ String tmp(buff,sizeof(buff), my_charset_bin);
THD *thd=current_thd;
for (ulong loop=0 ; loop < loop_count && !thd->killed; loop++)
@@ -2039,7 +2041,7 @@ Item_func_set_user_var::update()
case STRING_RESULT:
{
char buffer[MAX_FIELD_WIDTH];
- String tmp(buffer,sizeof(buffer),NULL);
+ String tmp(buffer,sizeof(buffer),my_charset_bin);
(void) val_str(&tmp);
break;
}
@@ -2179,11 +2181,14 @@ void Item_func_get_user_var::fix_length_and_dec()
maybe_null=1;
decimals=NOT_FIXED_DEC;
max_length=MAX_BLOB_WIDTH;
- if ((var_entry= get_variable(&thd->user_vars, name, 0)))
- const_var_flag= thd->query_id != var_entry->update_query_id;
+ var_entry= get_variable(&thd->user_vars, name, 0);
}
+bool Item_func_get_user_var::const_item() const
+{ return var_entry && current_thd->query_id != var_entry->update_query_id; }
+
+
enum Item_result Item_func_get_user_var::result_type() const
{
user_var_entry *entry;
@@ -2231,7 +2236,7 @@ longlong Item_func_inet_aton::val_int()
char c = '.'; // we mark c to indicate invalid IP in case length is 0
char buff[36];
- String *s,tmp(buff,sizeof(buff),NULL);
+ String *s,tmp(buff,sizeof(buff),my_charset_bin);
if (!(s = args[0]->val_str(&tmp))) // If null value
goto err;
null_value=0;
@@ -2285,7 +2290,7 @@ void Item_func_match::init_search(bool no_order)
String *ft_tmp= 0;
char tmp1[FT_QUERY_MAXLEN];
- String tmp2(tmp1,sizeof(tmp1),NULL);
+ String tmp2(tmp1,sizeof(tmp1),default_charset_info);
// MATCH ... AGAINST (NULL) is meaningless, but possible
if (!(ft_tmp=key_item()->val_str(&tmp2)))
@@ -2328,7 +2333,7 @@ bool Item_func_match::fix_fields(THD *thd, TABLE_LIST *tlist, Item **ref)
while ((item=li++))
{
- if (item->check_cols(1) || item->fix_fields(thd, tlist, li.ref()))
+ if (item->fix_fields(thd, tlist, li.ref()) || item->check_cols(1))
return 1;
if (item->type() == Item::REF_ITEM)
li.replace(item= *((Item_ref *)item)->ref);
diff --git a/sql/item_func.h b/sql/item_func.h
index 522b954b7b5..ec361cce4c5 100644
--- a/sql/item_func.h
+++ b/sql/item_func.h
@@ -608,8 +608,7 @@ public:
longlong val_int();
bool fix_fields(THD *thd,struct st_table_list *tlist, Item **ref)
{
- return (item->check_cols(1) ||
- item->fix_fields(thd, tlist, &item) ||
+ return (item->fix_fields(thd, tlist, &item) || item->check_cols(1) ||
Item_func::fix_fields(thd, tlist, ref));
}
void update_used_tables()
@@ -812,13 +811,15 @@ public:
String *val_str(String *);
double val()
{
+ int err;
String *res; res=val_str(&str_value);
- return res ? my_strntod(res->charset(),res->ptr(),res->length(),0) : 0.0;
+ return res ? my_strntod(res->charset(),(char*) res->ptr(),res->length(),0,&err) : 0.0;
}
longlong val_int()
{
+ int err;
String *res; res=val_str(&str_value);
- return res ? my_strntoll(res->charset(),res->ptr(),res->length(),(char**) 0,10) : (longlong) 0;
+ return res ? my_strntoll(res->charset(),res->ptr(),res->length(),10,(char**) 0,&err) : (longlong) 0;
}
enum Item_result result_type () const { return STRING_RESULT; }
void fix_length_and_dec();
@@ -934,11 +935,10 @@ class Item_func_get_user_var :public Item_func
{
LEX_STRING name;
user_var_entry *var_entry;
- bool const_var_flag;
public:
Item_func_get_user_var(LEX_STRING a):
- Item_func(), name(a), const_var_flag(1) {}
+ Item_func(), name(a) {}
user_var_entry *get_entry();
double val();
longlong val_int();
@@ -952,9 +952,9 @@ public:
*/
enum_field_types field_type() const { return MYSQL_TYPE_STRING; }
const char *func_name() const { return "get_user_var"; }
- bool const_item() const { return const_var_flag; }
+ bool const_item() const;
table_map used_tables() const
- { return const_var_flag ? 0 : RAND_TABLE_BIT; }
+ { return const_item() ? 0 : RAND_TABLE_BIT; }
bool eq(const Item *item, bool binary_cmp) const;
};
diff --git a/sql/item_row.cc b/sql/item_row.cc
index c62ab60c0cd..355228e45df 100644
--- a/sql/item_row.cc
+++ b/sql/item_row.cc
@@ -18,7 +18,7 @@
#include "assert.h"
Item_row::Item_row(List<Item> &arg):
- Item(), array_holder(1), used_tables_cache(0), const_item_cache(1)
+ Item(), used_tables_cache(0), array_holder(1), const_item_cache(1)
{
//TODO: think placing 2-3 component items in item (as it done for function)
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index d2b0e89254e..f9bda911eaf 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -52,16 +52,19 @@ uint nr_of_decimals(const char *str)
double Item_str_func::val()
{
+ int err;
String *res;
res=val_str(&str_value);
- return res ? my_strntod(res->charset(),res->ptr(),res->length(),NULL) : 0.0;
+ return res ? my_strntod(res->charset(), (char*) res->ptr(),res->length(),
+ NULL, &err) : 0.0;
}
longlong Item_str_func::val_int()
{
+ int err;
String *res;
res=val_str(&str_value);
- return res ? my_strntoll(res->charset(),res->ptr(),res->length(),NULL,10) : (longlong) 0;
+ return res ? my_strntoll(res->charset(),res->ptr(),res->length(),10,NULL,&err) : (longlong) 0;
}
@@ -1271,8 +1274,13 @@ String *Item_func_trim::val_str(String *str)
return &tmp_value;
}
+void Item_func_password::fix_length_and_dec()
+{
+ max_length= get_password_length(use_old_passwords);
+}
+
/*
- Password() function can have 2 args now. Second argument can be used
+ Password() function has 2 arguments. Second argument can be used
to make results repeatable
*/
@@ -1289,9 +1297,9 @@ String *Item_func_password::val_str(String *str)
{
if (res->length() == 0)
return &empty_string;
- make_scrambled_password(tmp_value,res->c_ptr(),opt_old_passwords,
+ make_scrambled_password(tmp_value,res->c_ptr(),use_old_passwords,
&current_thd->rand);
- str->set(tmp_value,get_password_length(opt_old_passwords),res->charset());
+ str->set(tmp_value,get_password_length(use_old_passwords),res->charset());
return str;
}
else
@@ -1320,9 +1328,9 @@ String *Item_func_password::val_str(String *str)
/* Use constants which allow nice random values even with small seed */
randominit(&rand_st,seed*111111+33333333L,seed*1111+55555555L);
- make_scrambled_password(tmp_value,res->c_ptr(),opt_old_passwords,
+ make_scrambled_password(tmp_value,res->c_ptr(),use_old_passwords,
&rand_st);
- str->set(tmp_value,get_password_length(opt_old_passwords),res->charset());
+ str->set(tmp_value,get_password_length(use_old_passwords),res->charset());
return str;
}
}
@@ -1955,6 +1963,7 @@ String *Item_func_conv::val_str(String *str)
longlong dec;
int from_base= (int) args[1]->val_int();
int to_base= (int) args[2]->val_int();
+ int err;
if (args[0]->null_value || args[1]->null_value || args[2]->null_value ||
abs(to_base) > 36 || abs(to_base) < 2 ||
@@ -1965,9 +1974,9 @@ String *Item_func_conv::val_str(String *str)
}
null_value=0;
if (from_base < 0)
- dec= my_strntoll(res->charset(),res->ptr(),res->length(),&endptr,-from_base);
+ dec= my_strntoll(res->charset(),res->ptr(),res->length(),-from_base,&endptr,&err);
else
- dec= (longlong) my_strntoull(res->charset(),res->ptr(),res->length(),&endptr,from_base);
+ dec= (longlong) my_strntoull(res->charset(),res->ptr(),res->length(),from_base,&endptr,&err);
ptr= longlong2str(dec,ans,to_base);
if (str->copy(ans,(uint32) (ptr-ans), thd_charset()))
return &empty_string;
@@ -2122,7 +2131,7 @@ bool Item_func_conv_charset::fix_fields(THD *thd,struct st_table_list *tables, I
if (thd && check_stack_overrun(thd,buff))
return 0; // Fatal error if flag is set!
- if (args[0]->check_cols(1) || args[0]->fix_fields(thd, tables, args))
+ if (args[0]->fix_fields(thd, tables, args) || args[0]->check_cols(1))
return 1;
maybe_null=args[0]->maybe_null;
const_item_cache=args[0]->const_item();
@@ -2155,7 +2164,7 @@ bool Item_func_set_collation::fix_fields(THD *thd,struct st_table_list *tables,
if (thd && check_stack_overrun(thd,buff))
return 0; // Fatal error if flag is set!
- if (args[0]->check_cols(1) || args[0]->fix_fields(thd, tables, args))
+ if (args[0]->fix_fields(thd, tables, args) || args[0]->check_cols(1))
return 1;
maybe_null=args[0]->maybe_null;
set_charset(set_collation);
@@ -2666,6 +2675,9 @@ Functions to concatinate various spatial objects
String *Item_func_point::val_str(String *str)
{
+ double x= args[0]->val();
+ double y= args[1]->val();
+
if ( (null_value = (args[0]->null_value ||
args[1]->null_value ||
str->realloc(1+4+8+8))))
@@ -2674,8 +2686,8 @@ String *Item_func_point::val_str(String *str)
str->length(0);
str->q_append((char)Geometry::wkbNDR);
str->q_append((uint32)Geometry::wkbPoint);
- str->q_append((double)args[0]->val());
- str->q_append((double)args[1]->val());
+ str->q_append(x);
+ str->q_append(y);
return str;
}
@@ -2707,11 +2719,10 @@ String *Item_func_spatial_collection::val_str(String *str)
for (i = 0; i < arg_count; ++i)
{
+ String *res = args[i]->val_str(&arg_value);
if (args[i]->null_value)
goto ret;
- String *res = args[i]->val_str(&arg_value);
-
if ( coll_type == Geometry::wkbGeometryCollection )
{
/*
@@ -2769,10 +2780,8 @@ String *Item_func_spatial_collection::val_str(String *str)
uint32 n_points;
double x1, y1, x2, y2;
- if (len < WKB_HEADER_SIZE + 4 + 8 + 8)
+ if (len < 4 + 2 * POINT_DATA_SIZE)
goto ret;
- data+=WKB_HEADER_SIZE;
- len-=WKB_HEADER_SIZE;
uint32 llen=len;
const char *ldata=data;
@@ -2784,10 +2793,6 @@ String *Item_func_spatial_collection::val_str(String *str)
float8get(y1,data);
data+=8;
- len-= 4 + 8 + 8;
-
- if (len < n_points * POINT_DATA_SIZE)
- goto ret;
data+=(n_points-2) * POINT_DATA_SIZE;
float8get(x2,data);
diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h
index c90ff6e2295..339a49a3580 100644
--- a/sql/item_strfunc.h
+++ b/sql/item_strfunc.h
@@ -21,9 +21,6 @@
#pragma interface /* gcc class implementation */
#endif
-extern my_bool opt_old_passwords; /* Need this variable for some functions */
-
-
class Item_str_func :public Item_func
{
public:
@@ -104,8 +101,8 @@ public:
void update_used_tables();
bool fix_fields(THD *thd, TABLE_LIST *tlist, Item **ref)
{
- return (separator->check_cols(1) ||
- separator->fix_fields(thd, tlist, &separator) ||
+ return (separator->fix_fields(thd, tlist, &separator) ||
+ separator->check_cols(1) ||
Item_func::fix_fields(thd, tlist, ref));
}
const char *func_name() const { return "concat_ws"; }
@@ -264,7 +261,7 @@ public:
Item_func_password(Item *a) :Item_str_func(a) {}
Item_func_password(Item *a, Item *b) :Item_str_func(a,b) {}
String *val_str(String *);
- void fix_length_and_dec() { max_length = get_password_length(opt_old_passwords); }
+ void fix_length_and_dec();
const char *func_name() const { return "password"; }
};
@@ -385,8 +382,8 @@ public:
String *val_str(String *str);
bool fix_fields(THD *thd, TABLE_LIST *tlist, Item **ref)
{
- return (item->check_cols(1) ||
- item->fix_fields(thd, tlist, &item) ||
+ return (item->fix_fields(thd, tlist, &item) ||
+ item->check_cols(1) ||
Item_func::fix_fields(thd, tlist, ref));
}
void fix_length_and_dec();
@@ -418,8 +415,8 @@ public:
String *val_str(String *str);
bool fix_fields(THD *thd, TABLE_LIST *tlist, Item **ref)
{
- return (item->check_cols(1) ||
- item->fix_fields(thd, tlist, &item) ||
+ return (item->fix_fields(thd, tlist, &item) ||
+ item->check_cols(1) ||
Item_func::fix_fields(thd, tlist, ref));
}
void fix_length_and_dec();
diff --git a/sql/item_sum.cc b/sql/item_sum.cc
index d78e535010f..570f1e50922 100644
--- a/sql/item_sum.cc
+++ b/sql/item_sum.cc
@@ -119,7 +119,7 @@ Item_sum_num::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
maybe_null=0;
for (uint i=0 ; i < arg_count ; i++)
{
- if (args[i]->check_cols(1) || args[i]->fix_fields(thd, tables, args + i))
+ if (args[i]->fix_fields(thd, tables, args + i) || args[i]->check_cols(1))
return 1;
if (decimals < args[i]->decimals)
decimals=args[i]->decimals;
@@ -145,7 +145,7 @@ Item_sum_hybrid::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
return 1;
}
thd->allow_sum_func=0; // No included group funcs
- if (item->check_cols(1) || item->fix_fields(thd, tables, args))
+ if (item->fix_fields(thd, tables, args) || item->check_cols(1))
return 1;
hybrid_type=item->result_type();
if (hybrid_type == INT_RESULT)
@@ -336,12 +336,14 @@ void Item_sum_variance::update_field(int offset)
double Item_sum_hybrid::val()
{
+ int err;
if (null_value)
return 0.0;
switch (hybrid_type) {
case STRING_RESULT:
String *res; res=val_str(&str_value);
- return res ? my_strntod(res->charset(),res->ptr(),res->length(),(char**)0) : 0.0;
+ return (res ? my_strntod(res->charset(), (char*) res->ptr(),res->length(),
+ (char**) 0, &err) : 0.0);
case INT_RESULT:
if (unsigned_flag)
return ulonglong2double(sum_int);
diff --git a/sql/item_sum.h b/sql/item_sum.h
index d16a1f2224e..c49311082e8 100644
--- a/sql/item_sum.h
+++ b/sql/item_sum.h
@@ -483,13 +483,16 @@ public:
String *val_str(String *);
double val()
{
+ int err;
String *res; res=val_str(&str_value);
- return res ? my_strntod(res->charset(),res->ptr(),res->length(),(char**) 0) : 0.0;
+ return res ? my_strntod(res->charset(),(char*) res->ptr(),res->length(),
+ (char**) 0, &err) : 0.0;
}
longlong val_int()
{
+ int err;
String *res; res=val_str(&str_value);
- return res ? my_strntoll(res->charset(),res->ptr(),res->length(),(char**) 0,10) : (longlong) 0;
+ return res ? my_strntoll(res->charset(),res->ptr(),res->length(),10, (char**) 0, &err) : (longlong) 0;
}
enum Item_result result_type () const { return STRING_RESULT; }
void fix_length_and_dec();
diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc
index 796070acb8a..744c0c1fa49 100644
--- a/sql/item_timefunc.cc
+++ b/sql/item_timefunc.cc
@@ -529,7 +529,7 @@ void Item_func_now::fix_length_and_dec()
{
struct tm tm_tmp,*start;
time_t query_start=current_thd->query_start();
- CHARSET_INFO *cs=thd_charset();
+ CHARSET_INFO *cs=my_charset_bin;
decimals=0;
max_length=19*cs->mbmaxlen;
diff --git a/sql/lex.h b/sql/lex.h
index 78255d477fa..a505911ccf6 100644
--- a/sql/lex.h
+++ b/sql/lex.h
@@ -161,6 +161,7 @@ static SYMBOL symbols[] = {
{ "FLUSH", SYM(FLUSH_SYM),0,0},
{ "FALSE", SYM(FALSE_SYM),0,0},
{ "FOREIGN", SYM(FOREIGN),0,0},
+ { "FORCE", SYM(FORCE_SYM),0,0},
{ "RAID_TYPE", SYM(RAID_TYPE),0,0},
{ "RAID_CHUNKS", SYM(RAID_CHUNKS),0,0},
{ "RAID_CHUNKSIZE", SYM(RAID_CHUNKSIZE),0,0},
@@ -426,7 +427,7 @@ static SYMBOL sql_functions[] = {
{ "CAST", SYM(CAST_SYM),0,0},
{ "CEIL", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_ceiling)},
{ "CEILING", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_ceiling)},
- { "CURRENT_USER", SYM(USER),0,0},
+ { "CURRENT_USER", SYM(FUNC_ARG0),0,CREATE_FUNC(create_func_current_user)},
{ "BIT_LENGTH", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_bit_length)},
{ "CENTROID", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_centroid)},
{ "CHAR_LENGTH", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_char_length)},
diff --git a/sql/log.cc b/sql/log.cc
index e21963022d9..f14bbae2543 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -202,7 +202,9 @@ bool MYSQL_LOG::open(const char *log_name, enum_log_type log_type_arg,
case LOG_NORMAL:
{
char *end;
-#ifdef __NT__
+#ifdef EMBEDDED_LIBRARY
+ sprintf(buff, "%s, Version: %s, embedded library\n", my_progname, server_version);
+#elif __NT__
sprintf(buff, "%s, Version: %s, started with:\nTCP Port: %d, Named Pipe: %s\n", my_progname, server_version, mysql_port, mysql_unix_port);
#else
sprintf(buff, "%s, Version: %s, started with:\nTcp port: %d Unix socket: %s\n", my_progname,server_version,mysql_port,mysql_unix_port);
@@ -612,6 +614,8 @@ err:
LOG_INFO_IO Got IO error while reading file
*/
+#ifdef HAVE_REPLICATION
+
int MYSQL_LOG::purge_first_log(struct st_relay_log_info* rli)
{
int error;
@@ -662,7 +666,12 @@ int MYSQL_LOG::purge_first_log(struct st_relay_log_info* rli)
rli->linfo.log_file_name);
goto err;
}
+ /*
+ Reset position to current log. This involves setting both of the
+ position variables:
+ */
rli->relay_log_pos = BIN_LOG_HEADER_SIZE;
+ rli->pending = 0;
strmake(rli->relay_log_name,rli->linfo.log_file_name,
sizeof(rli->relay_log_name)-1);
@@ -741,6 +750,8 @@ err:
DBUG_RETURN(error);
}
+#endif /* HAVE_REPLICATION */
+
/*
Create a new log file name
@@ -1050,6 +1061,7 @@ bool MYSQL_LOG::write(Log_event* event_info)
#else
IO_CACHE *file = &log_file;
#endif
+#ifdef HAVE_REPLICATION
if ((thd && !(thd->options & OPTION_BIN_LOG) &&
(thd->master_access & SUPER_ACL)) ||
(local_db && !db_ok(local_db, binlog_do_db, binlog_ignore_db)))
@@ -1058,6 +1070,7 @@ bool MYSQL_LOG::write(Log_event* event_info)
DBUG_PRINT("error",("!db_ok"));
DBUG_RETURN(0);
}
+#endif /* HAVE_REPLICATION */
error=1;
/*
@@ -1121,8 +1134,20 @@ bool MYSQL_LOG::write(Log_event* event_info)
if (file == &log_file)
{
- error = ha_report_binlog_offset_and_commit(thd, log_file_name,
+ /*
+ LOAD DATA INFILE in AUTOCOMMIT=1 mode writes to the binlog
+ chunks also before it is successfully completed. We only report
+ the binlog write and do the commit inside the transactional table
+ handler if the log event type is appropriate.
+ */
+
+ if (event_info->get_type_code() == QUERY_EVENT
+ || event_info->get_type_code() == EXEC_LOAD_EVENT)
+ {
+ error = ha_report_binlog_offset_and_commit(thd, log_file_name,
file->pos_in_file);
+ }
+
should_rotate= (my_b_tell(file) >= (my_off_t) max_binlog_size);
}
@@ -1165,7 +1190,7 @@ uint MYSQL_LOG::next_file_id()
NOTE
- We only come here if there is something in the cache.
- - The thing in the cache is always a complete transcation
+ - The thing in the cache is always a complete transaction
- 'cache' needs to be reinitialized after this functions returns.
IMPLEMENTATION
@@ -1233,6 +1258,13 @@ bool MYSQL_LOG::write(THD *thd, IO_CACHE *cache)
log_file.pos_in_file)))
goto err;
signal_update();
+ if (my_b_tell(&log_file) >= (my_off_t) max_binlog_size)
+ {
+ pthread_mutex_lock(&LOCK_index);
+ new_file(0); // inside mutex
+ pthread_mutex_unlock(&LOCK_index);
+ }
+
}
VOID(pthread_mutex_unlock(&LOCK_log));
DBUG_RETURN(0);
@@ -1421,6 +1453,7 @@ void MYSQL_LOG::close(bool exiting)
DBUG_PRINT("enter",("exiting: %d", (int) exiting));
if (is_open())
{
+#ifdef HAVE_REPLICATION
if (log_type == LOG_BIN && !no_auto_events && exiting)
{
Stop_log_event s;
@@ -1428,6 +1461,7 @@ void MYSQL_LOG::close(bool exiting)
s.write(&log_file);
signal_update();
}
+#endif /* HAVE_REPLICATION */
end_io_cache(&log_file);
if (my_close(log_file.file,MYF(0)) < 0 && ! write_error)
{
@@ -1551,3 +1585,6 @@ void sql_perror(const char *message)
perror(message);
#endif
}
+
+
+
diff --git a/sql/log_event.cc b/sql/log_event.cc
index a01b1ee6170..bf32aec91fb 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -82,12 +82,12 @@ static void pretty_print_str(FILE* file, char* str, int len)
ignored_error_code()
****************************************************************************/
-#ifndef MYSQL_CLIENT
+#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
inline int ignored_error_code(int err_code)
{
return use_slave_mask && bitmap_is_set(&slave_error_mask, err_code);
}
-#endif // !MYSQL_CLIENT
+#endif
/*****************************************************************************
@@ -95,27 +95,29 @@ inline int ignored_error_code(int err_code)
****************************************************************************/
#ifndef MYSQL_CLIENT
-static void pretty_print_str(String* packet, char* str, int len)
+static char* pretty_print_str(char* packet, char* str, int len)
{
char* end = str + len;
- packet->append('\'');
+ char* pos= packet;
+ *pos++= '\'';
while (str < end)
{
char c;
switch ((c=*str++)) {
- case '\n': packet->append( "\\n"); break;
- case '\r': packet->append( "\\r"); break;
- case '\\': packet->append( "\\\\"); break;
- case '\b': packet->append( "\\b"); break;
- case '\t': packet->append( "\\t"); break;
- case '\'': packet->append( "\\'"); break;
- case 0 : packet->append( "\\0"); break;
+ case '\n': pos= strmov(pos, "\\n"); break;
+ case '\r': pos= strmov(pos, "\\r"); break;
+ case '\\': pos= strmov(pos, "\\\\"); break;
+ case '\b': pos= strmov(pos, "\\b"); break;
+ case '\t': pos= strmov(pos, "\\t"); break;
+ case '\'': pos= strmov(pos, "\\'"); break;
+ case 0 : pos= strmov(pos, "\\0"); break;
default:
- packet->append((char)c);
+ *pos++= (char)c;
break;
}
}
- packet->append('\'');
+ *pos++= '\'';
+ return pos;
}
#endif // !MYSQL_CLIENT
@@ -124,7 +126,7 @@ static void pretty_print_str(String* packet, char* str, int len)
slave_load_file_stem()
****************************************************************************/
-#ifndef MYSQL_CLIENT
+#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
static inline char* slave_load_file_stem(char*buf, uint file_id,
int event_server_id)
{
@@ -136,7 +138,7 @@ static inline char* slave_load_file_stem(char*buf, uint file_id,
*buf++ = '-';
return int10_to_str(file_id, buf, 10);
}
-#endif // !MYSQL_CLIENT
+#endif
/*****************************************************************************
@@ -150,7 +152,7 @@ static inline char* slave_load_file_stem(char*buf, uint file_id,
Easily fixable by adding server_id as a prefix to the log files.
****************************************************************************/
-#ifndef MYSQL_CLIENT
+#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
static void cleanup_load_tmpdir()
{
MY_DIR *dirp;
@@ -168,7 +170,7 @@ static void cleanup_load_tmpdir()
my_dirend(dirp);
}
-#endif // !MYSQL_CLIENT
+#endif
/*****************************************************************************
@@ -286,6 +288,7 @@ Log_event::Log_event(const char* buf, bool old_format)
#ifndef MYSQL_CLIENT
+#ifdef HAVE_REPLICATION
/*****************************************************************************
@@ -294,11 +297,27 @@ Log_event::Log_event(const char* buf, bool old_format)
****************************************************************************/
int Log_event::exec_event(struct st_relay_log_info* rli)
{
- if (rli) // QQ When is this not true ?
+ /*
+ rli is null when (as far as I (Guilhem) know)
+ the caller is
+ Load_log_event::exec_event *and* that one is called from
+ Execute_load_log_event::exec_event.
+ In this case, we don't do anything here ;
+ Execute_load_log_event::exec_event will call Log_event::exec_event
+ again later with the proper rli.
+ Strictly speaking, if we were sure that rli is null
+ only in the case discussed above, 'if (rli)' is useless here.
+ But as we are not 100% sure, keep it for now.
+ */
+ if (rli)
{
- rli->inc_pos(get_event_len(),log_pos);
- DBUG_ASSERT(rli->sql_thd != 0);
- flush_relay_log_info(rli);
+ if (rli->inside_transaction)
+ rli->inc_pending(get_event_len());
+ else
+ {
+ rli->inc_pos(get_event_len(),log_pos);
+ flush_relay_log_info(rli);
+ }
}
return 0;
}
@@ -313,23 +332,6 @@ void Log_event::pack_info(Protocol *protocol)
protocol->store("",0);
}
-/*****************************************************************************
-
- Log_event::init_show_field_list()
-
- ****************************************************************************/
-void Log_event::init_show_field_list(List<Item>* field_list)
-{
- field_list->push_back(new Item_empty_string("Log_name", 20));
- field_list->push_back(new Item_return_int("Pos", 11,
- MYSQL_TYPE_LONGLONG));
- field_list->push_back(new Item_empty_string("Event_type", 20));
- field_list->push_back(new Item_return_int("Server_id", 10,
- MYSQL_TYPE_LONG));
- field_list->push_back(new Item_return_int("Orig_log_pos", 11,
- MYSQL_TYPE_LONGLONG));
- field_list->push_back(new Item_empty_string("Info", 20));
-}
/*****************************************************************************
@@ -338,6 +340,7 @@ void Log_event::init_show_field_list(List<Item>* field_list)
Only called by SHOW BINLOG EVENTS
****************************************************************************/
+
int Log_event::net_send(Protocol *protocol, const char* log_name, my_off_t pos)
{
const char *p= strrchr(log_name, FN_LIBCHAR);
@@ -355,6 +358,26 @@ int Log_event::net_send(Protocol *protocol, const char* log_name, my_off_t pos)
pack_info(protocol);
return protocol->write();
}
+#endif /* HAVE_REPLICATION */
+
+/*****************************************************************************
+
+ Log_event::init_show_field_list()
+
+ ****************************************************************************/
+void Log_event::init_show_field_list(List<Item>* field_list)
+{
+ field_list->push_back(new Item_empty_string("Log_name", 20));
+ field_list->push_back(new Item_return_int("Pos", 11,
+ MYSQL_TYPE_LONGLONG));
+ field_list->push_back(new Item_empty_string("Event_type", 20));
+ field_list->push_back(new Item_return_int("Server_id", 10,
+ MYSQL_TYPE_LONG));
+ field_list->push_back(new Item_return_int("Orig_log_pos", 11,
+ MYSQL_TYPE_LONGLONG));
+ field_list->push_back(new Item_empty_string("Info", 20));
+}
+
#endif // !MYSQL_CLIENT
/*****************************************************************************
@@ -554,7 +577,7 @@ Log_event* Log_event::read_log_event(const char* buf, int event_len,
ev = new Query_log_event(buf, event_len, old_format);
break;
case LOAD_EVENT:
- ev = new Create_file_log_event(buf, event_len, old_format);
+ ev = new Load_log_event(buf, event_len, old_format);
break;
case NEW_LOAD_EVENT:
ev = new Load_log_event(buf, event_len, old_format);
@@ -562,9 +585,11 @@ Log_event* Log_event::read_log_event(const char* buf, int event_len,
case ROTATE_EVENT:
ev = new Rotate_log_event(buf, event_len, old_format);
break;
+#ifdef HAVE_REPLICATION
case SLAVE_EVENT:
ev = new Slave_log_event(buf, event_len);
break;
+#endif /* HAVE_REPLICATION */
case CREATE_FILE_EVENT:
ev = new Create_file_log_event(buf, event_len, old_format);
break;
@@ -580,9 +605,11 @@ Log_event* Log_event::read_log_event(const char* buf, int event_len,
case START_EVENT:
ev = new Start_log_event(buf, old_format);
break;
+#ifdef HAVE_REPLICATION
case STOP_EVENT:
ev = new Stop_log_event(buf, old_format);
break;
+#endif /* HAVE_REPLICATION */
case INTVAR_EVENT:
ev = new Intvar_log_event(buf, old_format);
break;
@@ -669,7 +696,7 @@ void Log_event::set_log_pos(MYSQL_LOG* log)
*****************************************************************************
****************************************************************************/
-#ifndef MYSQL_CLIENT
+#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
/*****************************************************************************
Query_log_event::pack_info()
@@ -677,21 +704,26 @@ void Log_event::set_log_pos(MYSQL_LOG* log)
****************************************************************************/
void Query_log_event::pack_info(Protocol *protocol)
{
- char buf[256];
- String tmp(buf, sizeof(buf), log_cs);
- tmp.length(0);
+ char *buf, *pos;
+ if (!(buf= my_malloc(9 + db_len + q_len, MYF(MY_WME))))
+ return;
+ pos= buf;
if (db && db_len)
{
- tmp.append("use `", 5);
- tmp.append(db, db_len);
- tmp.append("`; ", 3);
+ pos= strmov(buf, "use `");
+ memcpy(pos, db, db_len);
+ pos+= db_len;
+ pos= strmov(pos, "`; ");
}
-
if (query && q_len)
- tmp.append(query, q_len);
- protocol->store((char*) tmp.ptr(), tmp.length());
+ {
+ memcpy(pos, query, q_len);
+ pos+= q_len;
+ }
+ protocol->store(buf, pos-buf);
+ my_free(buf, MYF(MY_ALLOW_ZERO_PTR));
}
-#endif // !MYSQL_CLIENT
+#endif
/*****************************************************************************
@@ -828,7 +860,7 @@ void Query_log_event::print(FILE* file, bool short_form, char* last_db)
Query_log_event::exec_event()
****************************************************************************/
-#ifndef MYSQL_CLIENT
+#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
int Query_log_event::exec_event(struct st_relay_log_info* rli)
{
int expected_error,actual_error = 0;
@@ -844,10 +876,11 @@ int Query_log_event::exec_event(struct st_relay_log_info* rli)
if (db_ok(thd->db, replicate_do_db, replicate_ignore_db))
{
- thd->query = (char*)query;
thd->set_time((time_t)when);
thd->current_tablenr = 0;
+ thd->query_length= q_len;
VOID(pthread_mutex_lock(&LOCK_thread_count));
+ thd->query = (char*)query;
thd->query_id = query_id++;
VOID(pthread_mutex_unlock(&LOCK_thread_count));
thd->query_error= 0; // clear error
@@ -865,6 +898,19 @@ int Query_log_event::exec_event(struct st_relay_log_info* rli)
mysql_log.write(thd,COM_QUERY,"%s",thd->query);
DBUG_PRINT("query",("%s",thd->query));
mysql_parse(thd, thd->query, q_len);
+
+ /*
+ Set a flag if we are inside an transaction so that we can restart
+ the transaction from the start if we are killed
+
+ This will only be done if we are supporting transactional tables
+ in the slave.
+ */
+ if (!strcmp(thd->query,"BEGIN"))
+ rli->inside_transaction= opt_using_transactions;
+ else if (!strcmp(thd->query,"COMMIT"))
+ rli->inside_transaction=0;
+
DBUG_PRINT("info",("expected_error: %d last_errno: %d",
expected_error, thd->net.last_errno));
if ((expected_error != (actual_error= thd->net.last_errno)) &&
@@ -892,7 +938,9 @@ int Query_log_event::exec_event(struct st_relay_log_info* rli)
else
{
// master could be inconsistent, abort and tell DBA to check/fix it
+ VOID(pthread_mutex_lock(&LOCK_thread_count));
thd->db = thd->query = 0;
+ VOID(pthread_mutex_unlock(&LOCK_thread_count));
thd->variables.convert_set = 0;
close_thread_tables(thd);
free_root(&thd->mem_root,0);
@@ -900,7 +948,9 @@ int Query_log_event::exec_event(struct st_relay_log_info* rli)
}
}
thd->db= 0; // prevent db from being freed
+ VOID(pthread_mutex_lock(&LOCK_thread_count));
thd->query= 0; // just to be sure
+ VOID(pthread_mutex_unlock(&LOCK_thread_count));
// assume no convert for next query unless set explictly
thd->variables.convert_set = 0;
close_thread_tables(thd);
@@ -916,7 +966,7 @@ int Query_log_event::exec_event(struct st_relay_log_info* rli)
free_root(&thd->mem_root,0);
return Log_event::exec_event(rli);
}
-#endif // !MYSQL_CLIENT
+#endif
/*****************************************************************************
@@ -932,21 +982,17 @@ int Query_log_event::exec_event(struct st_relay_log_info* rli)
Start_log_event::pack_info()
****************************************************************************/
-#ifndef MYSQL_CLIENT
+#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
void Start_log_event::pack_info(Protocol *protocol)
{
- char buf1[256];
- String tmp(buf1, sizeof(buf1), log_cs);
- tmp.length(0);
- char buf[22];
-
- tmp.append("Server ver: ");
- tmp.append(server_version);
- tmp.append(", Binlog ver: ");
- tmp.append(llstr(binlog_version, buf));
- protocol->store(tmp.ptr(), tmp.length());
+ char buf[12 + ST_SERVER_VER_LEN + 14 + 22], *pos;
+ pos= strmov(buf, "Server ver: ");
+ pos= strmov(pos, server_version);
+ pos= strmov(pos, ", Binlog ver: ");
+ pos=int10_to_str(binlog_version, pos, 10);
+ protocol->store(buf, pos-buf);
}
-#endif // !MYSQL_CLIENT
+#endif
/*****************************************************************************
@@ -1015,7 +1061,7 @@ int Start_log_event::write_data(IO_CACHE* file)
In this case we should stop the slave.
****************************************************************************/
-#ifndef MYSQL_CLIENT
+#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
int Start_log_event::exec_event(struct st_relay_log_info* rli)
{
/* All temporary tables was deleted on the master */
@@ -1027,7 +1073,7 @@ int Start_log_event::exec_event(struct st_relay_log_info* rli)
cleanup_load_tmpdir();
return Log_event::exec_event(rli);
}
-#endif // !MYSQL_CLIENT
+#endif
/*****************************************************************************
@@ -1043,83 +1089,110 @@ int Start_log_event::exec_event(struct st_relay_log_info* rli)
Load_log_event::pack_info()
****************************************************************************/
-#ifndef MYSQL_CLIENT
+#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
void Load_log_event::pack_info(Protocol *protocol)
{
- char buf[256];
- String tmp(buf, sizeof(buf), log_cs);
- tmp.length(0);
+ char *buf, *pos;
+ uint buf_len;
+
+ buf_len=
+ 5 + db_len + 3 + // "use DB; "
+ 18 + fname_len + 2 + // "LOAD DATA INFILE 'file''"
+ 9 + // " REPLACE or IGNORE "
+ 11 + table_name_len + // "INTO TABLE table"
+ 21 + sql_ex.field_term_len*4 + 2 + // " FIELDS TERMINATED BY 'str'"
+ 23 + sql_ex.enclosed_len*4 + 2 + // " OPTIONALLY ENCLOSED BY 'str'"
+ 12 + sql_ex.escaped_len*4 + 2 + // " ESCAPED BY 'str'"
+ 21 + sql_ex.line_term_len*4 + 2 + // " FIELDS TERMINATED BY 'str'"
+ 19 + sql_ex.line_start_len*4 + 2 + // " LINES STARTING BY 'str'"
+ 15 + 22 + // " IGNORE xxx LINES"
+ 3 + (num_fields-1)*2 + field_block_len; // " (field1, field2, ...)"
+
+ buf= my_malloc(buf_len, MYF(MY_WME));
+ if (!buf)
+ return;
+ pos= buf;
if (db && db_len)
{
- tmp.append("use ");
- tmp.append(db, db_len);
- tmp.append("; ", 2);
+ pos= strmov(pos, "use `");
+ memcpy(pos, db, db_len);
+ pos+= db_len;
+ pos= strmov(pos, "`; ");
}
- tmp.append("LOAD DATA INFILE '");
- tmp.append(fname, fname_len);
- tmp.append("' ", 2);
+ pos= strmov(pos, "LOAD DATA INFILE '");
+ memcpy(pos, fname, fname_len);
+ pos+= fname_len;
+ pos= strmov(pos, "' ");
+
if (sql_ex.opt_flags && REPLACE_FLAG )
- tmp.append(" REPLACE ");
+ pos= strmov(pos, " REPLACE ");
else if (sql_ex.opt_flags && IGNORE_FLAG )
- tmp.append(" IGNORE ");
-
- tmp.append("INTO TABLE ");
- tmp.append(table_name);
+ pos= strmov(pos, " IGNORE ");
+
+ pos= strmov(pos ,"INTO TABLE ");
+ memcpy(pos, table_name, table_name_len);
+ pos+= table_name_len;
+
if (sql_ex.field_term_len)
{
- tmp.append(" FIELDS TERMINATED BY ");
- pretty_print_str(&tmp, sql_ex.field_term, sql_ex.field_term_len);
+ pos= strmov(pos, " FIELDS TERMINATED BY ");
+ pos= pretty_print_str(pos, sql_ex.field_term, sql_ex.field_term_len);
}
if (sql_ex.enclosed_len)
{
if (sql_ex.opt_flags && OPT_ENCLOSED_FLAG )
- tmp.append(" OPTIONALLY ");
- tmp.append( " ENCLOSED BY ");
- pretty_print_str(&tmp, sql_ex.enclosed, sql_ex.enclosed_len);
+ pos= strmov(pos, " OPTIONALLY ");
+ pos= strmov(pos, " ENCLOSED BY ");
+ pos= pretty_print_str(pos, sql_ex.enclosed, sql_ex.enclosed_len);
}
-
+
if (sql_ex.escaped_len)
{
- tmp.append( " ESCAPED BY ");
- pretty_print_str(&tmp, sql_ex.escaped, sql_ex.escaped_len);
+ pos= strmov(pos, " ESCAPED BY ");
+ pos= pretty_print_str(pos, sql_ex.escaped, sql_ex.escaped_len);
}
-
+
if (sql_ex.line_term_len)
{
- tmp.append(" LINES TERMINATED BY ");
- pretty_print_str(&tmp, sql_ex.line_term, sql_ex.line_term_len);
+ pos= strmov(pos, " LINES TERMINATED BY ");
+ pos= pretty_print_str(pos, sql_ex.line_term, sql_ex.line_term_len);
}
if (sql_ex.line_start_len)
{
- tmp.append(" LINES STARTING BY ");
- pretty_print_str(&tmp, sql_ex.line_start, sql_ex.line_start_len);
+ pos= strmov(pos, " LINES STARTING BY ");
+ pos= pretty_print_str(pos, sql_ex.line_start, sql_ex.line_start_len);
}
-
+
if ((int)skip_lines > 0)
- tmp.append( " IGNORE %ld LINES ", (long) skip_lines);
+ {
+ pos= strmov(pos, " IGNORE ");
+ pos= longlong10_to_str((long) skip_lines, pos, 10);
+ pos= strmov(pos," LINES ");
+ }
if (num_fields)
{
uint i;
const char* field = fields;
- tmp.append(" (");
+ pos= strmov(pos, " (");
for (i = 0; i < num_fields; i++)
{
if (i)
- tmp.append(" ,");
- tmp.append( field);
-
+ pos= strmov(pos, " ,");
+ memcpy(pos, field, field_lens[i]);
+ pos+= field_lens[i];
field += field_lens[i] + 1;
}
- tmp.append(')');
+ *pos++= ')';
}
- protocol->store(tmp.ptr(), tmp.length());
+ protocol->store(buf, pos-buf);
+ my_free(buf, MYF(MY_ALLOW_ZERO_PTR));
}
-#endif // !MYSQL_CLIENT
+#endif
/*****************************************************************************
@@ -1273,8 +1346,8 @@ int Load_log_event::copy_log_event(const char *buf, ulong event_len,
{
uint data_len;
char* buf_end = (char*)buf + event_len;
- const char* data_head = buf + ((old_format) ?
- OLD_HEADER_LEN : LOG_EVENT_HEADER_LEN);
+ uint header_len= old_format ? OLD_HEADER_LEN : LOG_EVENT_HEADER_LEN;
+ const char* data_head = buf + header_len;
thread_id = uint4korr(data_head + L_THREAD_ID_OFFSET);
exec_time = uint4korr(data_head + L_EXEC_TIME_OFFSET);
skip_lines = uint4korr(data_head + L_SKIP_LINES_OFFSET);
@@ -1283,7 +1356,7 @@ int Load_log_event::copy_log_event(const char *buf, ulong event_len,
num_fields = uint4korr(data_head + L_NUM_FIELDS_OFFSET);
int body_offset = ((buf[EVENT_TYPE_OFFSET] == LOAD_EVENT) ?
- LOAD_HEADER_LEN + OLD_HEADER_LEN :
+ LOAD_HEADER_LEN + header_len :
get_data_body_offset());
if ((int) event_len < body_offset)
@@ -1337,7 +1410,10 @@ void Load_log_event::print(FILE* file, bool short_form, char* last_db)
if (db && db[0] && !same_db)
fprintf(file, "use %s;\n", db);
- fprintf(file, "LOAD DATA INFILE '%-*s' ", fname_len, fname);
+ fprintf(file, "LOAD ");
+ if (check_fname_outside_temp_buf())
+ fprintf(file, "LOCAL ");
+ fprintf(file, "DATA INFILE '%-*s' ", fname_len, fname);
if (sql_ex.opt_flags && REPLACE_FLAG )
fprintf(file," REPLACE ");
@@ -1418,17 +1494,40 @@ void Load_log_event::set_fields(List<Item> &field_list)
}
#endif // !MYSQL_CLIENT
-/*****************************************************************************
-
- Load_log_event::exec_event()
-
- ****************************************************************************/
-#ifndef MYSQL_CLIENT
-int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli)
+#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
+/*
+ Does the data loading job when executing a LOAD DATA on the slave
+
+ SYNOPSIS
+ Load_log_event::exec_event
+ net
+ rli
+ use_rli_only_for_errors - if set to 1, rli is provided to
+ Load_log_event::exec_event only for this
+ function to have RPL_LOG_NAME and
+ rli->last_slave_error, both being used by
+ error reports. rli's position advancing
+ is skipped (done by the caller which is
+ Execute_load_log_event::exec_event).
+ - if set to 0, rli is provided for full use,
+ i.e. for error reports and position
+ advancing.
+
+ DESCRIPTION
+ Does the data loading job when executing a LOAD DATA on the slave
+
+ RETURN VALUE
+ 0 Success
+ 1 Failure
+*/
+
+int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli,
+ bool use_rli_only_for_errors)
{
init_sql_alloc(&thd->mem_root, 8192,0);
thd->db = rewrite_db((char*)db);
- thd->query = 0;
+ DBUG_ASSERT(thd->query == 0);
+ thd->query = 0; // Should not be needed
thd->query_error = 0;
if (db_ok(thd->db, replicate_do_db, replicate_ignore_db))
@@ -1486,9 +1585,15 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli)
TL_WRITE))
thd->query_error = 1;
if (thd->cuted_fields)
+ {
+ /*
+ log_pos is the position of the LOAD
+ event in the master log
+ */
sql_print_error("Slave: load data infile at position %s in log \
-'%s' produced %d warning(s)", llstr(rli->master_log_pos,llbuff), RPL_LOG_NAME,
+'%s' produced %d warning(s)", llstr(log_pos,llbuff), RPL_LOG_NAME,
thd->cuted_fields );
+ }
if (net)
net->pkt_nr= thd->net.pkt_nr;
}
@@ -1527,9 +1632,9 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli)
return 1;
}
- return Log_event::exec_event(rli);
+ return ( use_rli_only_for_errors ? 0 : Log_event::exec_event(rli) );
}
-#endif // !MYSQL_CLIENT
+#endif
/*****************************************************************************
@@ -1545,20 +1650,23 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli)
Rotate_log_event::pack_info()
****************************************************************************/
-#ifndef MYSQL_CLIENT
+#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
void Rotate_log_event::pack_info(Protocol *protocol)
{
- char buf1[256], buf[22];
- String tmp(buf1, sizeof(buf1), log_cs);
- tmp.length(0);
- tmp.append(new_log_ident, ident_len);
- tmp.append(";pos=");
- tmp.append(llstr(pos,buf));
+ char *buf, *b_pos;
+ if (!(buf= my_malloc(ident_len + 45, MYF(MY_WME))))
+ return;
+ b_pos= buf;
+ memcpy(buf, new_log_ident, ident_len);
+ b_pos+= ident_len;
+ b_pos= strmov(b_pos, ";pos=");
+ b_pos=int10_to_str(pos, b_pos, 10);
if (flags & LOG_EVENT_FORCED_ROTATE_F)
- tmp.append("; forced by master");
- protocol->store(tmp.ptr(), tmp.length());
+ b_pos= strmov(b_pos ,"; forced by master");
+ protocol->store(buf, b_pos-buf);
+ my_free(buf, MYF(MY_ALLOW_ZERO_PTR));
}
-#endif // !MYSQL_CLIENT
+#endif
/*****************************************************************************
@@ -1651,7 +1759,7 @@ int Rotate_log_event::write_data(IO_CACHE* file)
0 ok
****************************************************************************/
-#ifndef MYSQL_CLIENT
+#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
int Rotate_log_event::exec_event(struct st_relay_log_info* rli)
{
char* log_name = rli->master_log_name;
@@ -1667,7 +1775,7 @@ int Rotate_log_event::exec_event(struct st_relay_log_info* rli)
flush_relay_log_info(rli);
DBUG_RETURN(0);
}
-#endif // !MYSQL_CLIENT
+#endif
/*****************************************************************************
@@ -1683,18 +1791,16 @@ int Rotate_log_event::exec_event(struct st_relay_log_info* rli)
Intvar_log_event::pack_info()
****************************************************************************/
-#ifndef MYSQL_CLIENT
+#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
void Intvar_log_event::pack_info(Protocol *protocol)
{
- char buf1[256], buf[22];
- String tmp(buf1, sizeof(buf1), log_cs);
- tmp.length(0);
- tmp.append(get_var_type_name());
- tmp.append('=');
- tmp.append(llstr(val, buf));
- protocol->store(tmp.ptr(), tmp.length());
+ char buf[64], *pos;
+ pos= strmov(buf, get_var_type_name());
+ *(pos++)='=';
+ pos=int10_to_str(val, pos, -10);
+ protocol->store(buf, pos-buf);
}
-#endif // !MYSQL_CLIENT
+#endif
/*****************************************************************************
@@ -1773,7 +1879,7 @@ void Intvar_log_event::print(FILE* file, bool short_form, char* last_db)
Intvar_log_event::exec_event()
****************************************************************************/
-#ifndef MYSQL_CLIENT
+#if defined(HAVE_REPLICATION)&& !defined(MYSQL_CLIENT)
int Intvar_log_event::exec_event(struct st_relay_log_info* rli)
{
switch (type) {
@@ -1788,7 +1894,7 @@ int Intvar_log_event::exec_event(struct st_relay_log_info* rli)
rli->inc_pending(get_event_len());
return 0;
}
-#endif // !MYSQL_CLIENT
+#endif
/*****************************************************************************
@@ -1804,7 +1910,7 @@ int Intvar_log_event::exec_event(struct st_relay_log_info* rli)
Rand_log_event::pack_info()
****************************************************************************/
-#ifndef MYSQL_CLIENT
+#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
void Rand_log_event::pack_info(Protocol *protocol)
{
char buf1[256], *pos;
@@ -1814,7 +1920,7 @@ void Rand_log_event::pack_info(Protocol *protocol)
pos= int10_to_str((long) seed2, pos, 10);
protocol->store(buf1, (uint) (pos-buf1));
}
-#endif // !MYSQL_CLIENT
+#endif
/*****************************************************************************
@@ -1867,7 +1973,7 @@ void Rand_log_event::print(FILE* file, bool short_form, char* last_db)
Rand_log_event::exec_event()
****************************************************************************/
-#ifndef MYSQL_CLIENT
+#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
int Rand_log_event::exec_event(struct st_relay_log_info* rli)
{
thd->rand.seed1= (ulong) seed1;
@@ -1875,7 +1981,7 @@ int Rand_log_event::exec_event(struct st_relay_log_info* rli)
rli->inc_pending(get_event_len());
return 0;
}
-#endif // !MYSQL_CLIENT
+#endif
/*****************************************************************************
@@ -1891,22 +1997,21 @@ int Rand_log_event::exec_event(struct st_relay_log_info* rli)
Slave_log_event::pack_info()
****************************************************************************/
+#ifdef HAVE_REPLICATION
+
#ifndef MYSQL_CLIENT
void Slave_log_event::pack_info(Protocol *protocol)
{
- char buf1[256], buf[22], *end;
- String tmp(buf1, sizeof(buf1), log_cs);
- tmp.length(0);
- tmp.append("host=");
- tmp.append(master_host);
- tmp.append(",port=");
- end= int10_to_str((long) master_port, buf, 10);
- tmp.append(buf, (uint32) (end-buf));
- tmp.append(",log=");
- tmp.append(master_log);
- tmp.append(",pos=");
- tmp.append(llstr(master_pos,buf));
- protocol->store(tmp.ptr(), tmp.length());
+ char buf[256], *pos;
+ pos= strmov(buf, "host=");
+ pos= strnmov(pos, master_host, HOSTNAME_LENGTH);
+ pos= strmov(pos, ",port=");
+ pos= int10_to_str((long) master_port, pos, 10);
+ pos= strmov(pos, ",log=");
+ pos= strmov(pos, master_log);
+ pos= strmov(pos, ",pos=");
+ pos= int10_to_str(master_pos, pos, 10);
+ protocol->store(buf, pos-buf);
}
#endif // !MYSQL_CLIENT
@@ -2114,6 +2219,7 @@ int Stop_log_event::exec_event(struct st_relay_log_info* rli)
return 0;
}
#endif // !MYSQL_CLIENT
+#endif /* HAVE_REPLICATION */
/*****************************************************************************
@@ -2224,14 +2330,32 @@ Create_file_log_event::Create_file_log_event(const char* buf, int len,
****************************************************************************/
#ifdef MYSQL_CLIENT
-void Create_file_log_event::print(FILE* file, bool short_form,
- char* last_db)
+void Create_file_log_event::print(FILE* file, bool short_form,
+ char* last_db, bool enable_local)
{
if (short_form)
+ {
+ if (enable_local && check_fname_outside_temp_buf())
+ Load_log_event::print(file, 1, last_db);
return;
- Load_log_event::print(file, 1, last_db);
+ }
+
+ if (enable_local)
+ {
+ if (!check_fname_outside_temp_buf())
+ fprintf(file, "#");
+ Load_log_event::print(file, 1, last_db);
+ fprintf(file, "#");
+ }
+
fprintf(file, " file_id: %d block_len: %d\n", file_id, block_len);
}
+
+void Create_file_log_event::print(FILE* file, bool short_form,
+ char* last_db)
+{
+ print(file,short_form,last_db,0);
+}
#endif // MYSQL_CLIENT
/*****************************************************************************
@@ -2239,32 +2363,30 @@ void Create_file_log_event::print(FILE* file, bool short_form,
Create_file_log_event::pack_info()
****************************************************************************/
-#ifndef MYSQL_CLIENT
+#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
void Create_file_log_event::pack_info(Protocol *protocol)
{
- char buf1[256],buf[22], *end;
- String tmp(buf1, sizeof(buf1), log_cs);
- tmp.length(0);
- tmp.append("db=");
- tmp.append(db, db_len);
- tmp.append(";table=");
- tmp.append(table_name, table_name_len);
- tmp.append(";file_id=");
- end= int10_to_str((long) file_id, buf, 10);
- tmp.append(buf, (uint32) (end-buf));
- tmp.append(";block_len=");
- end= int10_to_str((long) block_len, buf, 10);
- tmp.append(buf, (uint32) (end-buf));
- protocol->store((char*) tmp.ptr(), tmp.length());
+ char buf[NAME_LEN*2 + 30 + 21*2], *pos;
+ pos= strmov(buf, "db=");
+ memcpy(pos, db, db_len);
+ pos+= db_len;
+ pos= strmov(pos, ";table=");
+ memcpy(pos, table_name, table_name_len);
+ pos+= table_name_len;
+ pos= strmov(pos, ";file_id=");
+ pos= int10_to_str((long) file_id, pos, 10);
+ pos= strmov(pos, ";block_len=");
+ pos= int10_to_str((long) block_len, pos, 10);
+ protocol->store(buf, pos-buf);
}
-#endif // !MYSQL_CLIENT
+#endif
/*****************************************************************************
Create_file_log_event::exec_event()
****************************************************************************/
-#ifndef MYSQL_CLIENT
+#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
int Create_file_log_event::exec_event(struct st_relay_log_info* rli)
{
char fname_buf[FN_REFLEN+10];
@@ -2321,7 +2443,7 @@ err:
my_close(fd, MYF(0));
return error ? 1 : Log_event::exec_event(rli);
}
-#endif // !MYSQL_CLIENT
+#endif
/*****************************************************************************
@@ -2398,7 +2520,7 @@ void Append_block_log_event::print(FILE* file, bool short_form,
Append_block_log_event::pack_info()
****************************************************************************/
-#ifndef MYSQL_CLIENT
+#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
void Append_block_log_event::pack_info(Protocol *protocol)
{
char buf[256];
@@ -2408,14 +2530,14 @@ void Append_block_log_event::pack_info(Protocol *protocol)
block_len));
protocol->store(buf, (int32) length);
}
-#endif // !MYSQL_CLIENT
+#endif
/*****************************************************************************
Append_block_log_event::exec_event()
****************************************************************************/
-#ifndef MYSQL_CLIENT
+#if defined( HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
int Append_block_log_event::exec_event(struct st_relay_log_info* rli)
{
char fname[FN_REFLEN+10];
@@ -2443,7 +2565,7 @@ err:
my_close(fd, MYF(0));
return error ? error : Log_event::exec_event(rli);
}
-#endif // !MYSQL_CLIENT
+#endif
/*****************************************************************************
@@ -2513,7 +2635,7 @@ void Delete_file_log_event::print(FILE* file, bool short_form,
Delete_file_log_event::pack_info()
****************************************************************************/
-#ifndef MYSQL_CLIENT
+#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
void Delete_file_log_event::pack_info(Protocol *protocol)
{
char buf[64];
@@ -2521,14 +2643,14 @@ void Delete_file_log_event::pack_info(Protocol *protocol)
length= (uint) my_sprintf(buf, (buf, ";file_id=%u", (uint) file_id));
protocol->store(buf, (int32) length);
}
-#endif // !MYSQL_CLIENT
+#endif
/*****************************************************************************
Delete_file_log_event::exec_event()
****************************************************************************/
-#ifndef MYSQL_CLIENT
+#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
int Delete_file_log_event::exec_event(struct st_relay_log_info* rli)
{
char fname[FN_REFLEN+10];
@@ -2541,7 +2663,7 @@ int Delete_file_log_event::exec_event(struct st_relay_log_info* rli)
mysql_bin_log.write(this);
return Log_event::exec_event(rli);
}
-#endif // !MYSQL_CLIENT
+#endif
/*****************************************************************************
@@ -2612,7 +2734,7 @@ void Execute_load_log_event::print(FILE* file, bool short_form,
Execute_load_log_event::pack_info()
****************************************************************************/
-#ifndef MYSQL_CLIENT
+#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
void Execute_load_log_event::pack_info(Protocol *protocol)
{
char buf[64];
@@ -2620,14 +2742,13 @@ void Execute_load_log_event::pack_info(Protocol *protocol)
length= (uint) my_sprintf(buf, (buf, ";file_id=%u", (uint) file_id));
protocol->store(buf, (int32) length);
}
-#endif // !MYSQL_CLIENT
/*****************************************************************************
Execute_load_log_event::exec_event()
****************************************************************************/
-#ifndef MYSQL_CLIENT
+
int Execute_load_log_event::exec_event(struct st_relay_log_info* rli)
{
char fname[FN_REFLEN+10];
@@ -2663,7 +2784,11 @@ int Execute_load_log_event::exec_event(struct st_relay_log_info* rli)
save_options = thd->options;
thd->options &= ~ (ulong) (OPTION_BIN_LOG);
lev->thd = thd;
- if (lev->exec_event(0,0))
+ /*
+ lev->exec_event should use rli only for errors
+ i.e. should not advance rli's position
+ */
+ if (lev->exec_event(0,rli,1))
{
slave_print_error(rli,my_errno, "Failed executing load from '%s'", fname);
thd->options = save_options;
@@ -2686,7 +2811,8 @@ err:
}
return error ? error : Log_event::exec_event(rli);
}
-#endif // !MYSQL_CLIENT
+
+#endif
/*****************************************************************************
@@ -2778,8 +2904,3 @@ char* sql_ex_info::init(char* buf,char* buf_end,bool use_new_format)
}
-
-
-
-
-
diff --git a/sql/log_event.h b/sql/log_event.h
index ec3b4819e74..29fdf80b03b 100644
--- a/sql/log_event.h
+++ b/sql/log_event.h
@@ -269,10 +269,12 @@ public:
static int read_log_event(IO_CACHE* file, String* packet,
pthread_mutex_t* log_lock);
void set_log_pos(MYSQL_LOG* log);
- virtual void pack_info(Protocol *protocol);
- int net_send(Protocol *protocol, const char* log_name, my_off_t pos);
static void init_show_field_list(List<Item>* field_list);
+#ifdef HAVE_REPLICATION
+ int net_send(Protocol *protocol, const char* log_name, my_off_t pos);
+ virtual void pack_info(Protocol *protocol);
virtual int exec_event(struct st_relay_log_info* rli);
+#endif /* HAVE_REPLICATION */
virtual const char* get_db()
{
return thd ? thd->db : 0;
@@ -357,8 +359,10 @@ public:
Query_log_event(THD* thd_arg, const char* query_arg, ulong query_length,
bool using_trans);
const char* get_db() { return db; }
+#ifdef HAVE_REPLICATION
void pack_info(Protocol* protocol);
int exec_event(struct st_relay_log_info* rli);
+#endif /* HAVE_REPLICATION */
#else
void print(FILE* file, bool short_form = 0, char* last_db = 0);
#endif
@@ -385,6 +389,7 @@ public:
}
};
+#ifdef HAVE_REPLICATION
/*****************************************************************************
@@ -420,6 +425,8 @@ public:
int write_data(IO_CACHE* file );
};
+#endif /* HAVE_REPLICATION */
+
/*****************************************************************************
@@ -447,6 +454,13 @@ public:
uint32 skip_lines;
sql_ex_info sql_ex;
+ /* fname doesn't point to memory inside Log_event::temp_buf */
+ void set_fname_outside_temp_buf(const char *afname, uint alen)
+ {fname=afname;fname_len=alen;}
+ /* fname doesn't point to memory inside Log_event::temp_buf */
+ int check_fname_outside_temp_buf()
+ {return fname<temp_buf || fname>temp_buf+cached_event_len;}
+
#ifndef MYSQL_CLIENT
String field_lens_buf;
String fields_buf;
@@ -456,13 +470,16 @@ public:
List<Item>& fields_arg, enum enum_duplicates handle_dup,
bool using_trans);
void set_fields(List<Item> &fields_arg);
- void pack_info(Protocol* protocol);
const char* get_db() { return db; }
+#ifdef HAVE_REPLICATION
+ void pack_info(Protocol* protocol);
int exec_event(struct st_relay_log_info* rli)
{
- return exec_event(thd->slave_net,rli);
+ return exec_event(thd->slave_net,rli,0);
}
- int exec_event(NET* net, struct st_relay_log_info* rli);
+ int exec_event(NET* net, struct st_relay_log_info* rli,
+ bool use_rli_only_for_errors);
+#endif /* HAVE_REPLICATION */
#else
void print(FILE* file, bool short_form = 0, char* last_db = 0);
#endif
@@ -509,8 +526,10 @@ public:
created = (uint32) when;
memcpy(server_version, ::server_version, ST_SERVER_VER_LEN);
}
+#ifdef HAVE_REPLICATION
void pack_info(Protocol* protocol);
int exec_event(struct st_relay_log_info* rli);
+#endif /* HAVE_REPLICATION */
#else
void print(FILE* file, bool short_form = 0, char* last_db = 0);
#endif
@@ -544,8 +563,10 @@ public:
Intvar_log_event(THD* thd_arg,uchar type_arg, ulonglong val_arg)
:Log_event(),val(val_arg),type(type_arg)
{}
+#ifdef HAVE_REPLICATION
void pack_info(Protocol* protocol);
int exec_event(struct st_relay_log_info* rli);
+#endif /* HAVE_REPLICATION */
#else
void print(FILE* file, bool short_form = 0, char* last_db = 0);
#endif
@@ -576,8 +597,10 @@ class Rand_log_event: public Log_event
Rand_log_event(THD* thd_arg, ulonglong seed1_arg, ulonglong seed2_arg)
:Log_event(thd_arg,0,0),seed1(seed1_arg),seed2(seed2_arg)
{}
+#ifdef HAVE_REPLICATION
void pack_info(Protocol* protocol);
int exec_event(struct st_relay_log_info* rli);
+#endif /* HAVE_REPLICATION */
#else
void print(FILE* file, bool short_form = 0, char* last_db = 0);
#endif
@@ -596,6 +619,8 @@ class Rand_log_event: public Log_event
Stop Log Event class
****************************************************************************/
+#ifdef HAVE_REPLICATION
+
class Stop_log_event: public Log_event
{
public:
@@ -615,6 +640,8 @@ public:
bool is_valid() { return 1; }
};
+#endif /* HAVE_REPLICATION */
+
/*****************************************************************************
@@ -638,8 +665,10 @@ public:
pos(pos_arg),ident_len(ident_len_arg ? ident_len_arg :
(uint) strlen(new_log_ident_arg)), alloced(0)
{}
+#ifdef HAVE_REPLICATION
void pack_info(Protocol* protocol);
int exec_event(struct st_relay_log_info* rli);
+#endif /* HAVE_REPLICATION */
#else
void print(FILE* file, bool short_form = 0, char* last_db = 0);
#endif
@@ -685,10 +714,13 @@ public:
enum enum_duplicates handle_dup,
char* block_arg, uint block_len_arg,
bool using_trans);
+#ifdef HAVE_REPLICATION
void pack_info(Protocol* protocol);
int exec_event(struct st_relay_log_info* rli);
+#endif /* HAVE_REPLICATION */
#else
void print(FILE* file, bool short_form = 0, char* last_db = 0);
+ void print(FILE* file, bool short_form, char* last_db, bool enable_local);
#endif
Create_file_log_event(const char* buf, int event_len, bool old_format);
@@ -735,8 +767,10 @@ public:
#ifndef MYSQL_CLIENT
Append_block_log_event(THD* thd, char* block_arg,
uint block_len_arg, bool using_trans);
+#ifdef HAVE_REPLICATION
int exec_event(struct st_relay_log_info* rli);
void pack_info(Protocol* protocol);
+#endif /* HAVE_REPLICATION */
#else
void print(FILE* file, bool short_form = 0, char* last_db = 0);
#endif
@@ -761,8 +795,10 @@ public:
#ifndef MYSQL_CLIENT
Delete_file_log_event(THD* thd, bool using_trans);
+#ifdef HAVE_REPLICATION
void pack_info(Protocol* protocol);
int exec_event(struct st_relay_log_info* rli);
+#endif /* HAVE_REPLICATION */
#else
void print(FILE* file, bool short_form = 0, char* last_db = 0);
#endif
@@ -787,8 +823,10 @@ public:
#ifndef MYSQL_CLIENT
Execute_load_log_event(THD* thd, bool using_trans);
+#ifdef HAVE_REPLICATION
void pack_info(Protocol* protocol);
int exec_event(struct st_relay_log_info* rli);
+#endif /* HAVE_REPLICATION */
#else
void print(FILE* file, bool short_form = 0, char* last_db = 0);
#endif
diff --git a/sql/mf_iocache.cc b/sql/mf_iocache.cc
index 1bc65eebd23..e7e72617c83 100644
--- a/sql/mf_iocache.cc
+++ b/sql/mf_iocache.cc
@@ -32,6 +32,7 @@
#define MAP_TO_USE_RAID
#include "mysql_priv.h"
+#ifdef HAVE_REPLICATION
#ifdef HAVE_AIOWAIT
#include <mysys_err.h>
#include <errno.h>
@@ -81,3 +82,6 @@ int _my_b_net_read(register IO_CACHE *info, byte *Buffer,
}
} /* extern "C" */
+#endif /* HAVE_REPLICATION */
+
+
diff --git a/sql/mini_client.cc b/sql/mini_client.cc
index 83f68a28228..2ee4b551d71 100644
--- a/sql/mini_client.cc
+++ b/sql/mini_client.cc
@@ -23,6 +23,8 @@
*/
#include <my_global.h>
+#ifdef HAVE_EXTERNAL_CLIENT
+
/* my_pthread must be included early to be able to fix things */
#if defined(THREAD)
#include <my_pthread.h> /* because of signal() */
@@ -545,10 +547,13 @@ mc_mysql_connect(MYSQL *mysql,const char *host, const char *user,
bzero((char*) &UNIXaddr,sizeof(UNIXaddr));
UNIXaddr.sun_family = AF_UNIX;
strmov(UNIXaddr.sun_path, unix_socket);
- if (mc_sock_connect(sock,(struct sockaddr *) &UNIXaddr, sizeof(UNIXaddr),
+ if (mc_sock_connect(sock,
+ my_reinterpret_cast(struct sockaddr *) (&UNIXaddr),
+ sizeof(UNIXaddr),
mysql->options.connect_timeout) <0)
{
- DBUG_PRINT("error",("Got error %d on connect to local server",socket_errno));
+ DBUG_PRINT("error",("Got error %d on connect to local server",
+ socket_errno));
net->last_errno=CR_CONNECTION_ERROR;
sprintf(net->last_error,ER(net->last_errno),unix_socket,socket_errno);
goto error;
@@ -635,7 +640,9 @@ mc_mysql_connect(MYSQL *mysql,const char *host, const char *user,
my_gethostbyname_r_free();
}
sock_addr.sin_port = (ushort) htons((ushort) port);
- if (mc_sock_connect(sock,(struct sockaddr *) &sock_addr, sizeof(sock_addr),
+ if (mc_sock_connect(sock,
+ my_reinterpret_cast(struct sockaddr *) (&sock_addr),
+ sizeof(sock_addr),
mysql->options.connect_timeout) <0)
{
DBUG_PRINT("error",("Got error %d on connect to '%s'",
@@ -1471,3 +1478,5 @@ MYSQL_RES *mc_mysql_store_result(MYSQL *mysql)
mysql->fields=0; /* fields is now in result */
DBUG_RETURN(result); /* Data fetched */
}
+
+#endif /* HAVE_EXTERNAL_CLIENT */
diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h
index d89816a0dd9..7a354ef5ff1 100644
--- a/sql/mysql_priv.h
+++ b/sql/mysql_priv.h
@@ -209,6 +209,11 @@ char* query_table_status(THD *thd,const char *db,const char *table_name);
#define MODE_MSSQL 512
#define MODE_DB2 1024
#define MODE_SAPDB 2048
+#define MODE_NO_KEY_OPTIONS 4096
+#define MODE_NO_TABLE_OPTIONS 8192
+#define MODE_NO_FIELD_OPTIONS 16384
+#define MODE_MYSQL323 32768
+#define MODE_MYSQL40 65536
#define RAID_BLOCK_SIZE 1024
@@ -235,6 +240,10 @@ void debug_sync_point(const char* lock_name, uint lock_timeout);
#define SHOW_LOG_STATUS_FREE "FREE"
#define SHOW_LOG_STATUS_INUSE "IN USE"
+/* Options to add_table_to_list() */
+#define TL_OPTION_UPDATING 1
+#define TL_OPTION_FORCE_INDEX 2
+
/* Some portable defines */
#define portable_sizeof_char_ptr 8
@@ -323,11 +332,12 @@ int mysql_create_db(THD *thd, char *db, HA_CREATE_INFO *create, bool silent);
int mysql_alter_db(THD *thd, const char *db, HA_CREATE_INFO *create);
int mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent);
void mysql_binlog_send(THD* thd, char* log_ident, my_off_t pos, ushort flags);
-int mysql_rm_table(THD *thd,TABLE_LIST *tables, my_bool if_exists);
+int mysql_rm_table(THD *thd,TABLE_LIST *tables, my_bool if_exists,
+ my_bool drop_temporary);
int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
- bool log_query);
+ bool drop_temporary, bool log_query);
int mysql_rm_table_part2_with_lock(THD *thd, TABLE_LIST *tables,
- bool if_exists,
+ bool if_exists, bool drop_temporary,
bool log_query);
int quick_rm_table(enum db_type base,const char *db,
const char *table_name);
@@ -526,7 +536,8 @@ int check_insert_fields(THD *thd,TABLE *table,List<Item> &fields,
/* sql_error.cc */
void push_warning(THD *thd, MYSQL_ERROR::enum_warning_level level, uint code,
const char *msg);
-void store_warning(THD *thd, uint errcode, ...);
+void push_warning_printf(THD *thd, MYSQL_ERROR::enum_warning_level level,
+ uint code, const char *format, ...);
void mysql_reset_errors(THD *thd);
my_bool mysqld_show_warnings(THD *thd, ulong levels_to_show);
@@ -577,8 +588,7 @@ bool rm_temporary_table(enum db_type base, char *path);
void free_io_cache(TABLE *entry);
void intern_close_table(TABLE *entry);
bool close_thread_table(THD *thd, TABLE **table_ptr);
-void close_thread_tables(THD *thd,bool locked=0);
-bool close_thread_table(THD *thd, TABLE **table_ptr);
+void close_thread_tables(THD *thd, bool locked=0, bool skip_derived=0);
void close_temporary_tables(THD *thd);
TABLE_LIST * find_table_in_list(TABLE_LIST *table,
const char *db_name, const char *table_name);
@@ -708,6 +718,7 @@ extern my_bool opt_sql_bin_update, opt_safe_user_create, opt_no_mix_types;
extern my_bool opt_safe_show_db, opt_local_infile, lower_case_table_names;
extern my_bool opt_slave_compressed_protocol, use_temp_pool;
extern my_bool opt_enable_named_pipe;
+extern my_bool opt_old_passwords, use_old_passwords;
extern char *shared_memory_base_name;
extern bool opt_enable_shared_memory;
extern char f_fyllchar;
@@ -819,7 +830,6 @@ uint calc_week(TIME *ltime, bool with_year, bool sunday_first_day_of_week,
void find_date(char *pos,uint *vek,uint flag);
TYPELIB *convert_strings_to_array_type(my_string *typelibs, my_string *end);
TYPELIB *typelib(List<String> &strings);
-void clean_up(bool print_message=1);
ulong get_form_pos(File file, uchar *head, TYPELIB *save_names);
ulong make_new_entry(File file,uchar *fileinfo,TYPELIB *formnames,
const char *newname);
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 01dadbb6223..85d088f8173 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -206,7 +206,7 @@ static char **opt_argv;
#else
#define MYSQL_SERVER_SUFFIX ""
#endif /* __NT__ */
-#endif
+#endif /* __WIN__ */
#ifdef HAVE_BERKELEY_DB
SHOW_COMP_OPTION have_berkeley_db=SHOW_OPTION_YES;
@@ -247,6 +247,12 @@ SHOW_COMP_OPTION have_query_cache=SHOW_OPTION_NO;
const char *show_comp_option_name[]= {"YES", "NO", "DISABLED"};
bool opt_large_files= sizeof(my_off_t) > 4;
+#if SIZEOF_OFF_T > 4 && defined(BIG_TABLES)
+#define GET_HA_ROWS GET_ULL
+#else
+#define GET_HA_ROWS GET_ULONG
+#endif
+
/*
Variables to store startup options
@@ -282,7 +288,7 @@ static my_bool opt_noacl=0, opt_bootstrap=0, opt_myisam_log=0;
my_bool opt_safe_user_create = 0, opt_no_mix_types = 0;
my_bool lower_case_table_names, opt_old_rpl_compat;
my_bool opt_show_slave_auth_info, opt_sql_bin_update = 0;
-my_bool opt_log_slave_updates= 0, opt_old_passwords=0;
+my_bool opt_log_slave_updates= 0, opt_old_passwords=0, use_old_passwords=0;
volatile bool mqh_used = 0;
FILE *bootstrap_file=0;
@@ -418,12 +424,12 @@ double log_10[32]; /* 10 potences */
I_List<THD> threads,thread_cache;
time_t start_time;
-ulong opt_sql_mode = 0L;
const char *sql_mode_names[] =
{
"REAL_AS_FLOAT", "PIPES_AS_CONCAT", "ANSI_QUOTES", "IGNORE_SPACE",
"SERIALIZE", "ONLY_FULL_GROUP_BY", "NO_UNSIGNED_SUBTRACTION",
- "POSTGRESQL", "ORACLE", "MSSQL", "SAPDB",
+ "POSTGRESQL", "ORACLE", "MSSQL", "DB2", "SAPDB", "NO_KEY_OPTIONS",
+ "NO_TABLE_OPTIONS", "NO_FIELD_OPTIONS", "MYSQL323", "MYSQL40",
NullS
};
TYPELIB sql_mode_typelib= {array_elements(sql_mode_names)-1,"",
@@ -485,7 +491,9 @@ extern "C" pthread_handler_decl(handle_slave,arg);
static uint set_maximum_open_files(uint max_file_limit);
#endif
static ulong find_bit_type(const char *x, TYPELIB *bit_lib);
+static void clean_up(bool print_message);
+#ifndef EMBEDDED_LIBRARY
/****************************************************************************
** Code to end mysqld
****************************************************************************/
@@ -661,6 +669,7 @@ static void close_connections(void)
DBUG_PRINT("quit",("close_connections thread"));
DBUG_VOID_RETURN;
}
+#endif /*EMBEDDED_LIBRARY*/
static void close_server_sock()
{
@@ -752,18 +761,19 @@ void kill_mysql(void)
DBUG_VOID_RETURN;
}
+#ifndef EMBEDDED_LIBRARY
/* Force server down. kill all connections and threads and exit */
#if defined(OS2)
extern "C" void kill_server(int sig_ptr)
-#define RETURN_FROM_KILL_SERVER return
+#define RETURN_FROM_KILL_SERVER DBUG_RETURN
#elif !defined(__WIN__)
static void *kill_server(void *sig_ptr)
-#define RETURN_FROM_KILL_SERVER return 0
+#define RETURN_FROM_KILL_SERVER DBUG_RETURN(0)
#else
static void __cdecl kill_server(int sig_ptr)
-#define RETURN_FROM_KILL_SERVER return
+#define RETURN_FROM_KILL_SERVER DBUG_VOID_RETURN
#endif
{
int sig=(int) (long) sig_ptr; // This is passed a int
@@ -792,13 +802,16 @@ static void __cdecl kill_server(int sig_ptr)
RETURN_FROM_KILL_SERVER;
}
+#endif /* EMBEDDED_LIBRARY */
#ifdef USE_ONE_SIGNAL_HAND
extern "C" pthread_handler_decl(kill_server_thread,arg __attribute__((unused)))
{
SHUTDOWN_THD;
my_thread_init(); // Initialize new thread
+#ifndef EMBEDDED_LIBRARY
kill_server(0);
+#endif /* EMBEDDED_LIBRARY */
my_thread_end(); // Normally never reached
return 0;
}
@@ -842,7 +855,7 @@ extern "C" sig_handler print_signal_warning(int sig)
void unireg_end(void)
{
- clean_up();
+ clean_up(1);
my_thread_end();
#ifdef SIGNALS_DONT_BREAK_READ
exit(0);
@@ -857,7 +870,7 @@ extern "C" void unireg_abort(int exit_code)
DBUG_ENTER("unireg_abort");
if (exit_code)
sql_print_error("Aborting\n");
- clean_up(); /* purecov: inspected */
+ clean_up(1); /* purecov: inspected */
DBUG_PRINT("quit",("done with cleanup in unireg_abort"));
my_thread_end();
exit(exit_code); /* purecov: inspected */
@@ -869,8 +882,10 @@ void clean_up(bool print_message)
DBUG_PRINT("exit",("clean_up"));
if (cleanup_done++)
return; /* purecov: inspected */
+#ifdef HAVE_REPLICATION
if (use_slave_mask)
bitmap_free(&slave_error_mask);
+#endif
acl_free(1);
grant_free();
query_cache_destroy();
@@ -892,22 +907,26 @@ void clean_up(bool print_message)
free_defaults(defaults_argv);
my_free(charsets_list, MYF(MY_ALLOW_ZERO_PTR));
free_tmpdir(&mysql_tmpdir_list);
+#ifdef HAVE_REPLICATION
my_free(slave_load_tmpdir,MYF(MY_ALLOW_ZERO_PTR));
+#endif
x_free(opt_bin_logname);
x_free(opt_relay_logname);
bitmap_free(&temp_pool);
free_max_user_conn();
+#ifdef HAVE_REPLICATION
end_slave_list();
+#endif
#ifdef USE_REGEX
regex_end();
#endif
+ if (print_message && errmesg)
+ sql_print_error(ER(ER_SHUTDOWN_COMPLETE),my_progname);
#if !defined(__WIN__) && !defined(EMBEDDED_LIBRARY)
if (!opt_bootstrap)
(void) my_delete(pidfile_name,MYF(0)); // This may not always exist
#endif
- if (print_message && errmesg)
- sql_print_error(ER(ER_SHUTDOWN_COMPLETE),my_progname);
x_free((gptr) my_errmsg[ERRMAPP]); /* Free messages */
DBUG_PRINT("quit", ("Error messages freed"));
/* Tell main we are ready */
@@ -917,6 +936,10 @@ void clean_up(bool print_message)
/* do the broadcast inside the lock to ensure that my_end() is not called */
(void) pthread_cond_broadcast(&COND_thread_count);
(void) pthread_mutex_unlock(&LOCK_thread_count);
+ /*
+ The following lines may never be executed as the main thread may have
+ killed us
+ */
DBUG_PRINT("quit", ("done with cleanup"));
} /* clean_up */
@@ -1179,7 +1202,7 @@ void yyerror(const char *s)
thd->lex.yylineno);
}
-
+#ifndef EMBEDDED_LIBRARY
void close_connection(NET *net,uint errcode,bool lock)
{
st_vio* vio;
@@ -1199,6 +1222,7 @@ void close_connection(NET *net,uint errcode,bool lock)
(void) pthread_mutex_unlock(&LOCK_thread_count);
DBUG_VOID_RETURN;
}
+#endif
/* Called when a thread is aborted */
/* ARGSUSED */
@@ -1496,7 +1520,7 @@ static void init_signals(void)
/* Change limits so that we will get a core file */
struct rlimit rl;
rl.rlim_cur = rl.rlim_max = RLIM_INFINITY;
- if (setrlimit(RLIMIT_CORE, &rl))
+ if (setrlimit(RLIMIT_CORE, &rl) && global_system_variables.log_warnings)
sql_print_error("Warning: setrlimit could not change the size of core files to 'infinity'; We may not be able to generate a core file on signals");
}
#endif
@@ -1565,8 +1589,11 @@ extern "C" void *signal_hand(void *arg __attribute__((unused)))
my_thread_init(); // Init new thread
DBUG_ENTER("signal_hand");
SIGNAL_THD;
- /* Setup alarm handler */
- init_thr_alarm(max_connections+max_insert_delayed_threads);
+ /*
+ Setup alarm handler
+ The two extra handlers are for slave threads
+ */
+ init_thr_alarm(max_connections+max_insert_delayed_threads+2);
#if SIGINT != THR_KILL_SIGNAL
(void) sigemptyset(&set); // Setup up SIGINT for debug
(void) sigaddset(&set,SIGINT); // For debugging
@@ -1654,12 +1681,15 @@ extern "C" void *signal_hand(void *arg __attribute__((unused)))
}
break;
case SIGHUP:
- reload_acl_and_cache((THD*) 0,
- (REFRESH_LOG | REFRESH_TABLES | REFRESH_FAST |
- REFRESH_STATUS | REFRESH_GRANT | REFRESH_THREADS |
- REFRESH_HOSTS),
- (TABLE_LIST*) 0); // Flush logs
- mysql_print_status((THD*) 0); // Send debug some info
+ if (!abort_loop)
+ {
+ reload_acl_and_cache((THD*) 0,
+ (REFRESH_LOG | REFRESH_TABLES | REFRESH_FAST |
+ REFRESH_STATUS | REFRESH_GRANT |
+ REFRESH_THREADS | REFRESH_HOSTS),
+ (TABLE_LIST*) 0); // Flush logs
+ mysql_print_status((THD*) 0); // Send debug some info
+ }
break;
#ifdef USE_ONE_SIGNAL_HAND
case THR_SERVER_ALARM:
@@ -1714,7 +1744,7 @@ extern "C" int my_message_sql(uint error, const char *str,
void clear_error_message(THD *thd)
{
- thd->net.last_error[0]= 0;
+ thd->clear_error();
}
@@ -1827,28 +1857,15 @@ bool open_log(MYSQL_LOG *log, const char *hostname,
}
-
-#ifdef __WIN__
-int win_main(int argc, char **argv)
-#else
-int main(int argc, char **argv)
-#endif
+static int init_common_variables(const char *conf_file_name, int argc, char **argv,
+ const char **groups)
{
- DEBUGGER_OFF;
-
my_umask=0660; // Default umask for new files
my_umask_dir=0700; // Default umask for new directories
- MAIN_THD;
- /*
- Initialize signal_th and shutdown_th to main_th for default value
- as we need to initialize them to something safe. They are used
- when compiled with safemalloc.
- */
- SIGNAL_THD;
- SHUTDOWN_THD;
- MY_INIT(argv[0]); // init my_sys library & pthreads
+ umask(((~my_umask) & 0666));
tzset(); // Set tzname
+ max_system_variables.pseudo_thread_id= (ulong)~0;
start_time=time((time_t*) 0);
#ifdef OS2
{
@@ -1878,31 +1895,62 @@ int main(int argc, char **argv)
strmov(glob_hostname,"mysql");
strmake(pidfile_name, glob_hostname, sizeof(pidfile_name)-5);
strmov(fn_ext(pidfile_name),".pid"); // Add proper extension
+
#ifndef DBUG_OFF
strxmov(strend(server_version),MYSQL_SERVER_SUFFIX,"-debug",NullS);
#else
strmov(strend(server_version),MYSQL_SERVER_SUFFIX);
#endif
-#ifdef _CUSTOMSTARTUPCONFIG_
- if (_cust_check_startup())
- {
- /* _cust_check_startup will report startup failure error */
- exit( 1 );
- }
-#endif
- load_defaults(MYSQL_CONFIG_NAME,load_default_groups,&argc,&argv);
- defaults_argv=argv;
+ load_defaults(conf_file_name, groups, &argc, &argv);
+ defaults_argv=argv;
set_options();
get_options(argc,argv);
- max_system_variables.pseudo_thread_id= (ulong)~0;
if (opt_log || opt_update_log || opt_slow_log || opt_bin_log)
strcat(server_version,"-log");
DBUG_PRINT("info",("%s Ver %s for %s on %s\n",my_progname,
server_version, SYSTEM_TYPE,MACHINE_TYPE));
- /* These must be set early */
+#if defined( SET_RLIMIT_NOFILE) || defined( OS2)
+ /* connections and databases needs lots of files */
+ {
+ uint wanted_files=10+(uint) max(max_connections*5,
+ max_connections+table_cache_size*2);
+ set_if_bigger(wanted_files, open_files_limit);
+ // Note that some system returns 0 if we succeed here:
+ uint files=set_maximum_open_files(wanted_files);
+ if (files && files < wanted_files && ! open_files_limit)
+ {
+ max_connections= (ulong) min((files-10),max_connections);
+ table_cache_size= (ulong) max((files-10-max_connections)/2,64);
+ DBUG_PRINT("warning",
+ ("Changed limits: max_connections: %ld table_cache: %ld",
+ max_connections,table_cache_size));
+ sql_print_error("Warning: Changed limits: max_connections: %ld table_cache: %ld",max_connections,table_cache_size);
+ }
+ }
+#endif
+ unireg_init(opt_specialflag); /* Set up extern variabels */
+ init_errmessage(); /* Read error messages from file */
+ lex_init();
+ item_init();
+ set_var_init();
+ mysys_uses_curses=0;
+#ifdef USE_REGEX
+ regex_init();
+#endif
+ if (set_default_charset_by_name(sys_charset.value, MYF(MY_WME)))
+ return 1;
+ charsets_list= list_charsets(MYF(MY_CS_COMPILED | MY_CS_CONFIG));
+ if (use_temp_pool && bitmap_init(&temp_pool,1024,1))
+ return 2;
+
+ return 0;
+}
+
+static int init_thread_environement()
+{
(void) pthread_mutex_init(&LOCK_mysql_create_db,MY_MUTEX_INIT_SLOW);
(void) pthread_mutex_init(&LOCK_Acl,MY_MUTEX_INIT_SLOW);
(void) pthread_mutex_init(&LOCK_open,MY_MUTEX_INIT_FAST);
@@ -1919,7 +1967,9 @@ int main(int argc, char **argv)
(void) pthread_mutex_init(&LOCK_bytes_received,MY_MUTEX_INIT_FAST);
(void) pthread_mutex_init(&LOCK_timezone,MY_MUTEX_INIT_FAST);
(void) pthread_mutex_init(&LOCK_user_conn, MY_MUTEX_INIT_FAST);
+#ifdef HAVE_REPLICATION
(void) pthread_mutex_init(&LOCK_rpl_status, MY_MUTEX_INIT_FAST);
+#endif
(void) pthread_mutex_init(&LOCK_active_mi, MY_MUTEX_INIT_FAST);
(void) pthread_mutex_init(&LOCK_global_system_variables, MY_MUTEX_INIT_FAST);
(void) my_rwlock_init(&LOCK_grant, NULL);
@@ -1928,13 +1978,30 @@ int main(int argc, char **argv)
(void) pthread_cond_init(&COND_thread_cache,NULL);
(void) pthread_cond_init(&COND_flush_thread_cache,NULL);
(void) pthread_cond_init(&COND_manager,NULL);
+#ifdef HAVE_REPLICATION
(void) pthread_cond_init(&COND_rpl_status, NULL);
- init_signals();
+#endif
+ /* Parameter for threads created for connections */
+ (void) pthread_attr_init(&connection_attrib);
+ (void) pthread_attr_setdetachstate(&connection_attrib,
+ PTHREAD_CREATE_DETACHED);
+ pthread_attr_setstacksize(&connection_attrib,thread_stack);
+ pthread_attr_setscope(&connection_attrib, PTHREAD_SCOPE_SYSTEM);
- if (set_default_charset_by_name(sys_charset.value, MYF(MY_WME)))
- exit(1);
- charsets_list= list_charsets(MYF(MY_CS_COMPILED | MY_CS_CONFIG));
+ if (pthread_key_create(&THR_THD,NULL) ||
+ pthread_key_create(&THR_MALLOC,NULL))
+ {
+ sql_print_error("Can't create thread-keys");
+ return 1;
+ }
+
+ (void) thr_setconcurrency(concurrency); // 10 by default
+
+ return 0;
+}
+static void init_ssl()
+{
#ifdef HAVE_OPENSSL
if (opt_use_ssl)
{
@@ -1946,70 +2013,13 @@ int main(int argc, char **argv)
if (!ssl_acceptor_fd)
opt_use_ssl = 0;
}
+ if (des_key_file)
+ load_des_key_file(des_key_file);
#endif /* HAVE_OPENSSL */
+}
-#ifdef HAVE_LIBWRAP
- libwrapName= my_progname+dirname_length(my_progname);
- openlog(libwrapName, LOG_PID, LOG_AUTH);
-#endif
-
- if (!(opt_specialflag & SPECIAL_NO_PRIOR))
- my_pthread_setprio(pthread_self(),CONNECT_PRIOR);
- /* Parameter for threads created for connections */
- (void) pthread_attr_init(&connection_attrib);
- (void) pthread_attr_setdetachstate(&connection_attrib,
- PTHREAD_CREATE_DETACHED);
- pthread_attr_setstacksize(&connection_attrib,thread_stack);
-
- if (!(opt_specialflag & SPECIAL_NO_PRIOR))
- my_pthread_attr_setprio(&connection_attrib,WAIT_PRIOR);
- pthread_attr_setscope(&connection_attrib, PTHREAD_SCOPE_SYSTEM);
-
-#if defined( SET_RLIMIT_NOFILE) || defined( OS2)
- /* connections and databases needs lots of files */
- {
- uint wanted_files=10+(uint) max(max_connections*5,
- max_connections+table_cache_size*2);
- set_if_bigger(wanted_files, open_files_limit);
- // Note that some system returns 0 if we succeed here:
- uint files=set_maximum_open_files(wanted_files);
- if (files && files < wanted_files && ! open_files_limit)
- {
- max_connections= (ulong) min((files-10),max_connections);
- table_cache_size= (ulong) max((files-10-max_connections)/2,64);
- DBUG_PRINT("warning",
- ("Changed limits: max_connections: %ld table_cache: %ld",
- max_connections,table_cache_size));
- sql_print_error("Warning: Changed limits: max_connections: %ld table_cache: %ld",max_connections,table_cache_size);
- }
- }
-#endif
- unireg_init(opt_specialflag); /* Set up extern variabels */
- init_errmessage(); /* Read error messages from file */
- lex_init();
- item_init();
- set_var_init();
- mysys_uses_curses=0;
-#ifdef USE_REGEX
- regex_init();
-#endif
- select_thread=pthread_self();
- select_thread_in_use=1;
- if (use_temp_pool && bitmap_init(&temp_pool,1024,1))
- unireg_abort(1);
-
- /*
- We have enough space for fiddling with the argv, continue
- */
- umask(((~my_umask) & 0666));
- if (my_setwd(mysql_real_data_home,MYF(MY_WME)))
- {
- unireg_abort(1); /* purecov: inspected */
- }
- mysql_data_home= mysql_data_home_buff;
- mysql_data_home[0]=FN_CURLIB; // all paths are relative from here
- mysql_data_home[1]=0;
- server_init();
+static int init_server_components()
+{
table_cache_init();
hostname_cache_init();
query_cache_result_size_limit(query_cache_limit);
@@ -2017,12 +2027,9 @@ int main(int argc, char **argv)
randominit(&sql_rand,(ulong) start_time,(ulong) start_time/2);
reset_floating_point_exceptions();
init_thr_lock();
+#ifdef HAVE_REPLICATION
init_slave_list();
-#ifdef HAVE_OPENSSL
- if (des_key_file)
- load_des_key_file(des_key_file);
-#endif /* HAVE_OPENSSL */
-
+#endif
/* Setup log files */
if (opt_log)
open_log(&mysql_log, glob_hostname, opt_logname, ".log", NullS,
@@ -2033,26 +2040,17 @@ int main(int argc, char **argv)
NullS, LOG_NEW);
using_update_log=1;
}
-
+
if (opt_slow_log)
open_log(&mysql_slow_log, glob_hostname, opt_slow_logname, "-slow.log",
NullS, LOG_NORMAL);
-#ifdef __WIN__
-#define MYSQL_ERR_FILE "mysql.err"
- if (!opt_console)
- {
- freopen(MYSQL_ERR_FILE,"a+",stdout);
- freopen(MYSQL_ERR_FILE,"a+",stderr);
- }
-#endif
if (ha_init())
{
sql_print_error("Can't init databases");
- if (unix_sock != INVALID_SOCKET)
- unlink(mysql_unix_port);
- exit(1);
+ return 1;
}
ha_key_cache();
+
#if defined(HAVE_MLOCKALL) && defined(MCL_CURRENT)
if (locked_in_memory && !geteuid())
{
@@ -2071,71 +2069,9 @@ int main(int argc, char **argv)
(void) mi_log( 1 );
ft_init_stopwords(ft_precompiled_stopwords);
-#ifdef __WIN__
- if (!opt_console)
- FreeConsole(); // Remove window
-#endif
-
- /*
- init signals & alarm
- After this we can't quit by a simple unireg_abort
- */
- error_handler_hook = my_message_sql;
- if (pthread_key_create(&THR_THD,NULL) ||
- pthread_key_create(&THR_MALLOC,NULL))
- {
- sql_print_error("Can't create thread-keys");
- if (unix_sock != INVALID_SOCKET)
- unlink(mysql_unix_port);
- exit(1);
- }
- start_signal_handler(); // Creates pidfile
- if (acl_init((THD*) 0, opt_noacl))
- {
- abort_loop=1;
- select_thread_in_use=0;
- (void) pthread_kill(signal_thread,MYSQL_KILL_SIGNAL);
-#ifndef __WIN__
- if (!opt_bootstrap)
- (void) my_delete(pidfile_name,MYF(MY_WME)); // Not needed anymore
-#endif
- if (unix_sock != INVALID_SOCKET)
- unlink(mysql_unix_port);
- exit(1);
- }
- if (!opt_noacl)
- (void) grant_init((THD*) 0);
init_max_user_conn();
init_update_queries();
- DBUG_ASSERT(current_thd == 0);
-
-#ifdef HAVE_DLOPEN
- if (!opt_noacl)
- udf_init();
-#endif
- /* init_slave() must be called after the thread keys are created */
- init_slave();
- DBUG_ASSERT(current_thd == 0);
- if (opt_bin_log && !server_id)
- {
- server_id= !master_host ? 1 : 2;
- switch (server_id) {
-#ifdef EXTRA_DEBUG
- case 1:
- sql_print_error("\
-Warning: You have enabled the binary log, but you haven't set server-id:\n\
-Updates will be logged to the binary log, but connections to slaves will\n\
-not be accepted.");
- break;
-#endif
- case 2:
- sql_print_error("\
-Warning: You should set server-id to a non-0 value if master_host is set.\n\
-The server will not act as a slave.");
- break;
- }
- }
if (opt_bin_log)
{
open_log(&mysql_bin_log, glob_hostname, opt_bin_logname, "-bin",
@@ -2143,25 +2079,29 @@ The server will not act as a slave.");
using_update_log=1;
}
+ return 0;
+}
- if (opt_bootstrap)
- {
- int error=bootstrap(stdin);
- end_thr_alarm(); // Don't allow alarms
- unireg_abort(error ? 1 : 0);
- }
- if (opt_init_file)
+static void create_maintenance_thread()
+{
+ if (
+#ifdef HAVE_BERKELEY_DB
+ !berkeley_skip ||
+#endif
+ (flush_time && flush_time != ~(ulong) 0L))
{
- if (read_init_file(opt_init_file))
- {
- end_thr_alarm(); // Don't allow alarms
- unireg_abort(1);
- }
+ pthread_t hThread;
+ if (pthread_create(&hThread,&connection_attrib,handle_manager,0))
+ sql_print_error("Warning: Can't create thread to manage maintenance");
}
- (void) thr_setconcurrency(concurrency); // 10 by default
-#if defined(__WIN__) && !defined(EMBEDDED_LIBRARY) //IRENA
+}
+
+static void create_shutdown_thread()
+{
+
+#ifdef __WIN__
{
- hEventShutdown=CreateEvent(0, FALSE, FALSE, shutdown_event_name);
+ hEventShutdown=CreateEvent(0, FALSE, FALSE, event_name);
pthread_t hThread;
if (pthread_create(&hThread,&connection_attrib,handle_shutdown,0))
sql_print_error("Warning: Can't create thread to handle shutdown requests");
@@ -2178,38 +2118,24 @@ The server will not act as a slave.");
sql_print_error("Warning: Can't create thread to handle shutdown requests");
}
#endif
+}
- if (
-#ifdef HAVE_BERKELEY_DB
- !berkeley_skip ||
-#endif
- (flush_time && flush_time != ~(ulong) 0L))
- {
- pthread_t hThread;
- if (pthread_create(&hThread,&connection_attrib,handle_manager,0))
- sql_print_error("Warning: Can't create thread to manage maintenance");
- }
-
- printf(ER(ER_READY),my_progname,server_version,"");
- fflush(stdout);
-#if defined(__NT__) || defined(HAVE_SMEM)
#ifdef __NT__
+void create_named_pipe_thread()
+{
if (hPipe == INVALID_HANDLE_VALUE &&
- (!have_tcpip || opt_disable_networking) &&
- !opt_enable_shared_memory)
+ (!have_tcpip || opt_disable_networking))
{
- sql_print_error("TCP/IP,--shared-memory or --named-pipe should be configured on NT OS");
- unireg_abort(1);
+ sql_print_error("TCP/IP or --enable-named-pipe should be configured on NT OS");
+ unireg_abort(1);
}
else
-#endif
{
pthread_mutex_lock(&LOCK_thread_count);
(void) pthread_cond_init(&COND_handler_count,NULL);
{
pthread_t hThread;
handler_count=0;
-#ifdef __NT__
if (hPipe != INVALID_HANDLE_VALUE && opt_enable_named_pipe)
{
handler_count++;
@@ -2220,36 +2146,169 @@ The server will not act as a slave.");
handler_count--;
}
}
-#endif
-#ifdef HAVE_SMEM
- if (opt_enable_shared_memory)
- {
- handler_count++;
- if (pthread_create(&hThread,&connection_attrib,
- handle_connections_shared_memory, 0))
- {
- sql_print_error("Warning: Can't create thread to handle shared memory");
- handler_count--;
- }
- }
-#endif
if (have_tcpip && !opt_disable_networking)
{
handler_count++;
if (pthread_create(&hThread,&connection_attrib,
handle_connections_sockets, 0))
{
- sql_print_error("Warning: Can't create thread to handle tcp/ip");
+ sql_print_error("Warning: Can't create thread to handle named pipes");
handler_count--;
}
}
while (handler_count > 0)
- {
pthread_cond_wait(&COND_handler_count,&LOCK_thread_count);
- }
}
pthread_mutex_unlock(&LOCK_thread_count);
}
+}
+#endif
+
+#ifndef EMBEDDED_LIBRARY
+#ifdef __WIN__
+int win_main(int argc, char **argv)
+#else
+int main(int argc, char **argv)
+#endif
+{
+ int init_error;
+
+ DEBUGGER_OFF;
+
+#ifdef _CUSTOMSTARTUPCONFIG_
+ if (_cust_check_startup())
+ {
+ / * _cust_check_startup will report startup failure error * /
+ exit( 1 );
+ }
+#endif
+
+ MY_INIT(argv[0]); // init my_sys library & pthreads
+
+ if ((init_error=init_common_variables(MYSQL_CONFIG_NAME,
+ argc, argv, load_default_groups)))
+ if (init_error == 2)
+ unireg_abort(1);
+ else
+ exit(1);
+
+ init_signals();
+ if (init_thread_environement())
+ exit(1);
+ select_thread=pthread_self();
+ select_thread_in_use=1;
+ if (!(opt_specialflag & SPECIAL_NO_PRIOR))
+ my_pthread_setprio(pthread_self(),CONNECT_PRIOR);
+
+ if (!(opt_specialflag & SPECIAL_NO_PRIOR))
+ my_pthread_attr_setprio(&connection_attrib,WAIT_PRIOR);
+
+ init_ssl();
+
+#ifdef HAVE_LIBWRAP
+ libwrapName= my_progname+dirname_length(my_progname);
+ openlog(libwrapName, LOG_PID, LOG_AUTH);
+#endif
+
+ /*
+ We have enough space for fiddling with the argv, continue
+ */
+ if (my_setwd(mysql_real_data_home,MYF(MY_WME)))
+ {
+ unireg_abort(1); /* purecov: inspected */
+ }
+ mysql_data_home= mysql_data_home_buff;
+ mysql_data_home[0]=FN_CURLIB; // all paths are relative from here
+ mysql_data_home[1]=0;
+ server_init();
+
+ if (opt_bin_log && !server_id)
+ {
+ server_id= !master_host ? 1 : 2;
+ switch (server_id) {
+#ifdef EXTRA_DEBUG
+ case 1:
+ sql_print_error("\
+Warning: You have enabled the binary log, but you haven't set server-id:\n\
+Updates will be logged to the binary log, but connections to slaves will\n\
+not be accepted.");
+ break;
+#endif
+ case 2:
+ sql_print_error("\
+Warning: You should set server-id to a non-0 value if master_host is set.\n\
+The server will not act as a slave.");
+ break;
+ }
+ }
+
+ if (init_server_components())
+ exit(1);
+
+#ifdef __WIN__
+#define MYSQL_ERR_FILE "mysql.err"
+ if (!opt_console)
+ {
+ freopen(MYSQL_ERR_FILE,"a+",stdout);
+ freopen(MYSQL_ERR_FILE,"a+",stderr);
+ }
+#endif
+
+#ifdef __WIN__
+ if (!opt_console)
+ FreeConsole(); // Remove window
+#endif
+
+ /*
+ init signals & alarm
+ After this we can't quit by a simple unireg_abort
+ */
+ error_handler_hook = my_message_sql;
+ start_signal_handler(); // Creates pidfile
+ if (acl_init((THD *)0, opt_noacl))
+ {
+ abort_loop=1;
+ select_thread_in_use=0;
+ (void) pthread_kill(signal_thread,MYSQL_KILL_SIGNAL);
+#ifndef __WIN__
+ if (!opt_bootstrap)
+ (void) my_delete(pidfile_name,MYF(MY_WME)); // Not needed anymore
+#endif
+ exit(1);
+ }
+ if (!opt_noacl)
+ (void) grant_init((THD *)0);
+
+#ifdef HAVE_DLOPEN
+ if (!opt_noacl)
+ udf_init();
+#endif
+ /* init_slave() must be called after the thread keys are created */
+ init_slave();
+
+ if (opt_bootstrap)
+ {
+ int error=bootstrap(stdin);
+ end_thr_alarm(); // Don't allow alarms
+ unireg_abort(error ? 1 : 0);
+ }
+ if (opt_init_file)
+ {
+ if (read_init_file(opt_init_file))
+ {
+ end_thr_alarm(); // Don't allow alarms
+ unireg_abort(1);
+ }
+ }
+
+ create_shutdown_thread();
+ create_maintenance_thread();
+
+ printf(ER(ER_READY),my_progname,server_version,"");
+ fflush(stdout);
+
+#ifdef __NT__
+ create_named_pipe_thread();
#else
handle_connections_sockets(0);
#ifdef EXTRA_DEBUG2
@@ -2296,6 +2355,8 @@ The server will not act as a slave.");
return(0); /* purecov: deadcode */
}
+#endif /* EMBEDDED_LIBRARY */
+
/****************************************************************************
Main and thread entry function for Win32
@@ -2434,7 +2495,7 @@ int main(int argc, char **argv)
Execute all commands from a file. Used by the mysql_install_db script to
create MySQL privilege tables without having to start a full MySQL server.
*/
-
+#ifndef EMBEDDED_LIBRARY
static int bootstrap(FILE *file)
{
THD *thd= new THD;
@@ -2471,6 +2532,8 @@ static int bootstrap(FILE *file)
DBUG_RETURN(error);
}
+#endif
+
static bool read_init_file(char *file_name)
{
FILE *file;
@@ -2478,11 +2541,14 @@ static bool read_init_file(char *file_name)
DBUG_PRINT("enter",("name: %s",file_name));
if (!(file=my_fopen(file_name,O_RDONLY,MYF(MY_WME))))
return(1);
+#ifndef EMBEDDED_LIBRARY
bootstrap(file); /* Ignore errors from this */
+#endif
(void) my_fclose(file,MYF(MY_WME));
return 0;
}
+#ifndef EMBEDDED_LIBRARY
static void create_new_thread(THD *thd)
{
@@ -2564,6 +2630,7 @@ static void create_new_thread(THD *thd)
DBUG_PRINT("info",("Thread created"));
DBUG_VOID_RETURN;
}
+#endif
#ifdef SIGNALS_DONT_BREAK_READ
inline void kill_broken_server()
@@ -2581,6 +2648,7 @@ inline void kill_broken_server()
#define MAYBE_BROKEN_SYSCALL
#endif
+#ifndef EMBEDDED_LIBRARY
/* Handle new connections and spawn new process to handle them */
extern "C" pthread_handler_decl(handle_connections_sockets,arg __attribute__((unused)))
@@ -3085,6 +3153,7 @@ error:
}
#endif /* HAVE_SMEM */
+#endif /* EMBEDDED_LIBRARY */
/******************************************************************************
** handle start options
@@ -3188,6 +3257,7 @@ enum options {
OPT_INNODB_LOG_FILE_SIZE,
OPT_INNODB_LOG_BUFFER_SIZE,
OPT_INNODB_BUFFER_POOL_SIZE,
+ OPT_INNODB_BUFFER_POOL_AWE_MEM_MB,
OPT_INNODB_ADDITIONAL_MEM_POOL_SIZE,
OPT_INNODB_FILE_IO_THREADS,
OPT_INNODB_LOCK_WAIT_TIMEOUT,
@@ -3449,6 +3519,7 @@ struct my_option my_long_options[] =
GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
{"memlock", OPT_MEMLOCK, "Lock mysqld in memory", (gptr*) &locked_in_memory,
(gptr*) &locked_in_memory, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+#ifdef HAVE_REPLICATION
{"disconnect-slave-event-count", OPT_DISCONNECT_SLAVE_EVENT_COUNT,
"Option used by mysql-test for debugging and testing of replication",
(gptr*) &disconnect_slave_event_count,
@@ -3467,6 +3538,7 @@ struct my_option my_long_options[] =
(gptr*) &opt_sporadic_binlog_dump_fail,
(gptr*) &opt_sporadic_binlog_dump_fail, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0,
0},
+#endif /* HAVE_REPLICATION */
{"safemalloc-mem-limit", OPT_SAFEMALLOC_MEM_LIMIT,
"Simulate memory shortage when compiled with the --with-debug=full option",
0, 0, 0, GET_ULL, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
@@ -3542,7 +3614,7 @@ struct my_option my_long_options[] =
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"safe-mode", OPT_SAFE, "Skip some optimize stages (for testing).",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
- {"old-passwords", OPT_OLD_PASSWORDS, "Use old password encryption method (needed for old clients)",
+ {"old-passwords", OPT_OLD_PASSWORDS, "Use old password encryption method (needed for 4.0 and older clients)",
(gptr*) &opt_old_passwords, (gptr*) &opt_old_passwords, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
#ifndef TO_BE_DELETED
{"safe-show-database", OPT_SAFE_SHOW_DB,
@@ -3609,12 +3681,14 @@ struct my_option my_long_options[] =
{"relay-log-info-file", OPT_RELAY_LOG_INFO_FILE, "Undocumented",
(gptr*) &relay_log_info_file, (gptr*) &relay_log_info_file, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+#ifdef HAVE_REPLICATION
{"slave-load-tmpdir", OPT_SLAVE_LOAD_TMPDIR, "Undocumented",
(gptr*) &slave_load_tmpdir, (gptr*) &slave_load_tmpdir, 0, GET_STR_ALLOC,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"slave-skip-errors", OPT_SLAVE_SKIP_ERRORS,
"Tells the slave thread to continue replication when a query returns an error from the provided list",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+#endif
{"socket", OPT_SOCKET, "Socket file to use for connection",
(gptr*) &mysql_unix_port, (gptr*) &mysql_unix_port, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
@@ -3747,6 +3821,10 @@ struct my_option my_long_options[] =
"The size of the memory buffer InnoDB uses to cache data and indexes of its tables.",
(gptr*) &innobase_buffer_pool_size, (gptr*) &innobase_buffer_pool_size, 0,
GET_LONG, REQUIRED_ARG, 8*1024*1024L, 1024*1024L, ~0L, 0, 1024*1024L, 0},
+ {"innodb_buffer_pool_awe_mem_mb", OPT_INNODB_BUFFER_POOL_AWE_MEM_MB,
+ "If Windows AWE is used, the size of InnoDB buffer pool allocated from the AWE memory.",
+ (gptr*) &innobase_buffer_pool_awe_mem_mb, (gptr*) &innobase_buffer_pool_awe_mem_mb, 0,
+ GET_LONG, REQUIRED_ARG, 0, 0, 63000, 0, 1, 0},
{"innodb_additional_mem_pool_size", OPT_INNODB_ADDITIONAL_MEM_POOL_SIZE,
"Size of a memory pool InnoDB uses to store data dictionary information and other internal data structures.",
(gptr*) &innobase_additional_mem_pool_size,
@@ -3793,8 +3871,13 @@ struct my_option my_long_options[] =
{"lower_case_table_names", OPT_LOWER_CASE_TABLE_NAMES,
"If set to 1 table names are stored in lowercase on disk and table names will be case-insensitive.",
(gptr*) &lower_case_table_names,
- (gptr*) &lower_case_table_names, 0,
- GET_BOOL, NO_ARG, IF_WIN(1,0), 0, 1, 0, 1, 0},
+ (gptr*) &lower_case_table_names, 0, GET_BOOL, NO_ARG,
+#ifdef FN_NO_CASE_SENCE
+ 1
+#else
+ 0
+#endif
+ , 0, 1, 0, 1, 0},
{"max_allowed_packet", OPT_MAX_ALLOWED_PACKET,
"Max packetlength to send/receive from to server.",
(gptr*) &global_system_variables.max_allowed_packet,
@@ -3833,7 +3916,7 @@ struct my_option my_long_options[] =
{"max_join_size", OPT_MAX_JOIN_SIZE,
"Joins that are probably going to read more than max_join_size records return an error.",
(gptr*) &global_system_variables.max_join_size,
- (gptr*) &max_system_variables.max_join_size, 0, GET_ULONG, REQUIRED_ARG,
+ (gptr*) &max_system_variables.max_join_size, 0, GET_HA_ROWS, REQUIRED_ARG,
~0L, 1, ~0L, 0, 1, 0},
{"max_prepared_statements", OPT_MAX_PREP_STMT,
"Max number of prepared_statements for a thread",
@@ -3942,6 +4025,7 @@ struct my_option my_long_options[] =
(gptr*) &global_system_variables.read_buff_size,
(gptr*) &max_system_variables.read_buff_size,0, GET_ULONG, REQUIRED_ARG,
128*1024L, IO_SIZE*2+MALLOC_OVERHEAD, ~0L, MALLOC_OVERHEAD, IO_SIZE, 0},
+#ifdef HAVE_REPLICATION
{"relay_log_space_limit", OPT_RELAY_LOG_SPACE_LIMIT,
"Max space to use for all relay logs",
(gptr*) &relay_log_space_limit,
@@ -3956,6 +4040,7 @@ struct my_option my_long_options[] =
"Number of seconds to wait for more data from a master/slave connection before aborting the read.",
(gptr*) &slave_net_timeout, (gptr*) &slave_net_timeout, 0,
GET_ULONG, REQUIRED_ARG, SLAVE_NET_TIMEOUT, 1, LONG_TIMEOUT, 0, 1, 0},
+#endif
{"slow_launch_time", OPT_SLOW_LAUNCH_TIME,
"If creating the thread takes longer than this value (in seconds), the Slow_launch_threads counter will be incremented.",
(gptr*) &slow_launch_time, (gptr*) &slow_launch_time, 0, GET_ULONG,
@@ -4234,12 +4319,12 @@ static void set_options(void)
sizeof(mysql_real_data_home)-1);
/* Set default values for some variables */
- global_system_variables.table_type=DB_TYPE_MYISAM;
- global_system_variables.tx_isolation=ISO_REPEATABLE_READ;
+ global_system_variables.table_type= DB_TYPE_MYISAM;
+ global_system_variables.tx_isolation= ISO_REPEATABLE_READ;
global_system_variables.select_limit= (ulonglong) HA_POS_ERROR;
- max_system_variables.select_limit= (ulong) HA_POS_ERROR;
+ max_system_variables.select_limit= (ulonglong) HA_POS_ERROR;
global_system_variables.max_join_size= (ulonglong) HA_POS_ERROR;
- max_system_variables.max_join_size= (ulonglong) HA_POS_ERROR;
+ max_system_variables.max_join_size= (ulonglong) HA_POS_ERROR;
#ifdef __WIN__
/* Allow Win32 users to move MySQL anywhere */
@@ -4274,9 +4359,10 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
opt_endinfo=1; /* unireg: memory allocation */
break;
case 'a':
- opt_sql_mode = (MODE_REAL_AS_FLOAT | MODE_PIPES_AS_CONCAT |
- MODE_ANSI_QUOTES | MODE_IGNORE_SPACE | MODE_SERIALIZABLE |
- MODE_ONLY_FULL_GROUP_BY);
+ global_system_variables.sql_mode=
+ (MODE_REAL_AS_FLOAT | MODE_PIPES_AS_CONCAT |
+ MODE_ANSI_QUOTES | MODE_IGNORE_SPACE | MODE_SERIALIZABLE |
+ MODE_ONLY_FULL_GROUP_BY);
global_system_variables.tx_isolation= ISO_SERIALIZABLE;
break;
case 'b':
@@ -4299,9 +4385,11 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
case 'o':
protocol_version=PROTOCOL_VERSION-1;
break;
+#ifdef HAVE_REPLICATION
case OPT_SLAVE_SKIP_ERRORS:
init_slave_skip_errors(argument);
break;
+#endif
case OPT_SAFEMALLOC_MEM_LIMIT:
#if !defined(DBUG_OFF) && defined(SAFEMALLOC)
safemalloc_mem_limit = atoi(argument);
@@ -4341,6 +4429,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
case (int) OPT_BIN_LOG:
opt_bin_log=1;
break;
+#ifdef HAVE_REPLICATION
case (int) OPT_INIT_RPL_ROLE:
{
int role;
@@ -4461,13 +4550,14 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
table_rules_on = 1;
break;
}
- case (int) OPT_SLOW_QUERY_LOG:
- opt_slow_log=1;
- break;
case (int)OPT_RECKLESS_SLAVE:
opt_reckless_slave = 1;
init_slave_skip_errors("all");
break;
+#endif /* HAVE_REPLICATION */
+ case (int) OPT_SLOW_QUERY_LOG:
+ opt_slow_log=1;
+ break;
case (int) OPT_SKIP_NEW:
opt_specialflag|= SPECIAL_NO_NEW_FUNC;
delay_key_write_options= (uint) DELAY_KEY_WRITE_NONE;
@@ -4638,8 +4728,12 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
berkeley_lock_type=berkeley_lock_types[type-1];
else
{
- if (test_if_int(argument,(uint) strlen(argument), my_charset_latin1))
- berkeley_lock_scan_time=atoi(argument);
+ int err;
+ char *end;
+ uint length= strlen(argument);
+ long value= my_strntol(my_charset_latin1, argument, length, 10, &end, &err);
+ if (test_if_int(argument,(uint) length, end, my_charset_latin1))
+ berkeley_lock_scan_time= value;
else
{
fprintf(stderr,"Unknown lock type: %s\n",argument);
@@ -4700,16 +4794,17 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
}
case OPT_SQL_MODE:
{
- sql_mode_str = argument;
- if ((opt_sql_mode =
- find_bit_type(argument, &sql_mode_typelib)) == ~(ulong) 0)
+ sql_mode_str= argument;
+ if ((global_system_variables.sql_mode=
+ find_bit_type(argument, &sql_mode_typelib)) == ~(ulong) 0)
{
fprintf(stderr, "Unknown option to sql-mode: %s\n", argument);
exit(1);
}
- global_system_variables.tx_isolation= ((opt_sql_mode & MODE_SERIALIZABLE) ?
- ISO_SERIALIZABLE :
- ISO_REPEATABLE_READ);
+ global_system_variables.tx_isolation=
+ ((global_system_variables.sql_mode & MODE_SERIALIZABLE) ?
+ ISO_SERIALIZABLE :
+ ISO_REPEATABLE_READ);
break;
}
case OPT_MASTER_PASSWORD:
@@ -4841,11 +4936,13 @@ static void fix_paths(void)
if (init_tmpdir(&mysql_tmpdir_list, opt_mysql_tmpdir))
exit(1);
+#ifdef HAVE_REPLICATION
if (!slave_load_tmpdir)
{
if (!(slave_load_tmpdir = (char*) my_strdup(mysql_tmpdir, MYF(MY_FAE))))
exit(1);
}
+#endif
}
diff --git a/sql/net_serv.cc b/sql/net_serv.cc
index d165125eb90..550fb772fce 100644
--- a/sql/net_serv.cc
+++ b/sql/net_serv.cc
@@ -23,6 +23,7 @@
3 byte length & 1 byte package-number.
*/
+#ifndef EMBEDDED_LIBRARY
#ifdef __WIN__
#include <winsock.h>
#endif
@@ -73,7 +74,7 @@ extern pthread_mutex_t LOCK_bytes_sent , LOCK_bytes_received;
#include "thr_alarm.h"
#define TEST_BLOCKING 8
-#define MAX_THREE_BYTES 255L*255L*255L
+#define MAX_PACKET_LENGTH (256L*256L*256L-1)
static my_bool net_write_buff(NET *net,const char *packet,ulong len);
@@ -132,13 +133,17 @@ my_bool net_realloc(NET *net, ulong length)
{
uchar *buff;
ulong pkt_length;
+ DBUG_ENTER("net_realloc");
+ DBUG_PRINT("enter",("length: %lu", length));
+
if (length >= net->max_packet_size)
{
- DBUG_PRINT("error",("Packet too large (%lu)", length));
+ DBUG_PRINT("error",("Packet too large. Max sixe: %lu",
+ net->max_packet_size));
net->error= 1;
net->report_error= 1;
net->last_errno= ER_NET_PACKET_TOO_LARGE;
- return 1;
+ DBUG_RETURN(1);
}
pkt_length = (length+IO_SIZE-1) & ~(IO_SIZE-1);
/*
@@ -154,11 +159,11 @@ my_bool net_realloc(NET *net, ulong length)
#ifdef MYSQL_SERVER
net->last_errno= ER_OUT_OF_RESOURCES;
#endif
- return 1;
+ DBUG_RETURN(1);
}
net->buff=net->write_pos=buff;
net->buff_end=buff+(net->max_packet=pkt_length);
- return 0;
+ DBUG_RETURN(0);
}
/* Remove unwanted characters from connection */
@@ -220,13 +225,13 @@ my_net_write(NET *net,const char *packet,ulong len)
{
uchar buff[NET_HEADER_SIZE];
/*
- Big packets are handled by splitting them in packets of MAX_THREE_BYTES
- length. The last packet is always a packet that is < MAX_THREE_BYTES.
- (The last packet may even have a lengt of 0)
+ Big packets are handled by splitting them in packets of MAX_PACKET_LENGTH
+ length. The last packet is always a packet that is < MAX_PACKET_LENGTH.
+ (The last packet may even have a length of 0)
*/
- while (len >= MAX_THREE_BYTES)
+ while (len >= MAX_PACKET_LENGTH)
{
- const ulong z_size = MAX_THREE_BYTES;
+ const ulong z_size = MAX_PACKET_LENGTH;
int3store(buff, z_size);
buff[3]= (uchar) net->pkt_nr++;
if (net_write_buff(net, (char*) buff, NET_HEADER_SIZE) ||
@@ -241,7 +246,7 @@ my_net_write(NET *net,const char *packet,ulong len)
if (net_write_buff(net,(char*) buff,NET_HEADER_SIZE))
return 1;
DBUG_DUMP("packet_header",(char*) buff,NET_HEADER_SIZE);
- return net_write_buff(net,packet,len);
+ return test(net_write_buff(net,packet,len));
}
/*
@@ -280,57 +285,110 @@ net_write_command(NET *net,uchar command,
ulong length=len+1+head_len; /* 1 extra byte for command */
uchar buff[NET_HEADER_SIZE+1];
uint header_size=NET_HEADER_SIZE+1;
+ DBUG_ENTER("net_write_command");
+ DBUG_PRINT("enter",("length: %lu", len));
+
buff[4]=command; /* For first packet */
- if (length >= MAX_THREE_BYTES)
+ if (length >= MAX_PACKET_LENGTH)
{
/* Take into account that we have the command in the first header */
- len= MAX_THREE_BYTES - 1 - head_len;
+ len= MAX_PACKET_LENGTH - 1 - head_len;
do
{
- int3store(buff, MAX_THREE_BYTES);
+ int3store(buff, MAX_PACKET_LENGTH);
buff[3]= (uchar) net->pkt_nr++;
if (net_write_buff(net,(char*) buff, header_size) ||
net_write_buff(net, header, head_len) ||
net_write_buff(net, packet, len))
- return 1;
+ DBUG_RETURN(1);
packet+= len;
- length-= MAX_THREE_BYTES;
- len=MAX_THREE_BYTES;
- head_len=0;
- header_size=NET_HEADER_SIZE;
- } while (length >= MAX_THREE_BYTES);
+ length-= MAX_PACKET_LENGTH;
+ len= MAX_PACKET_LENGTH;
+ head_len= 0;
+ header_size= NET_HEADER_SIZE;
+ } while (length >= MAX_PACKET_LENGTH);
len=length; /* Data left to be written */
}
int3store(buff,length);
buff[3]= (uchar) net->pkt_nr++;
- return test(net_write_buff(net, (char*) buff, header_size) ||
+ DBUG_RETURN(test(net_write_buff(net, (char*) buff, header_size) ||
(head_len && net_write_buff(net, (char*) header, head_len)) ||
- net_write_buff(net, packet, len) || net_flush(net));
+ net_write_buff(net, packet, len) || net_flush(net)));
}
/*
Caching the data in a local buffer before sending it.
- One can force the buffer to be flushed with 'net_flush'.
+
+ SYNOPSIS
+ net_write_buff()
+ net Network handler
+ packet Packet to send
+ len Length of packet
+
+ DESCRIPTION
+ Fill up net->buffer and send it to the client when full.
+
+ If the rest of the to-be-sent-packet is bigger than buffer,
+ send it in one big block (to avoid copying to internal buffer).
+ If not, copy the rest of the data to the buffer and return without
+ sending data.
+
+ NOTES
+ The cached buffer can be sent as it is with 'net_flush()'.
+
+ In this code we have to be careful to not send a packet longer than
+ MAX_PACKET_LENGTH to net_real_write() if we are using the compressed protocol
+ as we store the length of the compressed packet in 3 bytes.
+
+ RETURN
+ 0 ok
+ 1
*/
static my_bool
net_write_buff(NET *net,const char *packet,ulong len)
{
- ulong left_length=(ulong) (net->buff_end - net->write_pos);
+ ulong left_length;
+ if (net->compress && net->max_packet > MAX_PACKET_LENGTH)
+ left_length= MAX_PACKET_LENGTH - (net->write_pos - net->buff);
+ else
+ left_length= (ulong) (net->buff_end - net->write_pos);
- while (len > left_length)
+ if (len > left_length)
{
- memcpy((char*) net->write_pos,packet,left_length);
- if (net_real_write(net,(char*) net->buff,net->max_packet))
- return 1;
- net->write_pos=net->buff;
- packet+=left_length;
- len-=left_length;
- left_length=net->max_packet;
+ if (net->write_pos != net->buff)
+ {
+ /* Fill up already used packet and write it */
+ memcpy((char*) net->write_pos,packet,left_length);
+ if (net_real_write(net,(char*) net->buff,
+ (ulong) (net->write_pos - net->buff) + left_length))
+ return 1;
+ net->write_pos= net->buff;
+ packet+= left_length;
+ len-= left_length;
+ }
+ if (net->compress)
+ {
+ /*
+ We can't have bigger packets than 16M with compression
+ Because the uncompressed length is stored in 3 bytes
+ */
+ left_length= MAX_PACKET_LENGTH;
+ while (len > left_length)
+ {
+ if (net_real_write(net, packet, left_length))
+ return 1;
+ packet+= left_length;
+ len-= left_length;
+ }
+ }
+ if (len > net->max_packet)
+ return net_real_write(net, packet, len) ? 1 : 0;
+ /* Send out rest of the blocks as full sized blocks */
}
memcpy((char*) net->write_pos,packet,len);
- net->write_pos+=len;
+ net->write_pos+= len;
return 0;
}
@@ -383,11 +441,7 @@ net_real_write(NET *net,const char *packet,ulong len)
memcpy(b+header_length,packet,len);
if (my_compress((byte*) b+header_length,&len,&complen))
- {
- DBUG_PRINT("warning",
- ("Compression error; Continuing without compression"));
complen=0;
- }
int3store(&b[NET_HEADER_SIZE],complen);
int3store(b,len);
b[3]=(uchar) (net->compress_pkt_nr++);
@@ -490,27 +544,15 @@ net_real_write(NET *net,const char *packet,ulong len)
*****************************************************************************/
#ifndef NO_ALARM
-/*
- Help function to clear the commuication buffer when we get a too
- big packet
-*/
-static void my_net_skip_rest(NET *net, uint32 remain, thr_alarm_t *alarmed)
+static my_bool net_safe_read(NET *net, char *buff, uint32 length,
+ thr_alarm_t *alarmed)
{
- ALARM alarm_buff;
uint retry_count=0;
- my_bool old_mode;
-
- if (!thr_alarm_in_use(&alarmed))
+ while (length > 0)
{
- if (!thr_alarm(alarmed,net->read_timeout,&alarm_buff) ||
- vio_blocking(net->vio, TRUE, &old_mode) < 0)
- return; /* Can't setup, abort */
- }
- while (remain > 0)
- {
- ulong length;
- if ((int) (length=vio_read(net->vio,(char*) net->buff,remain)) <= 0L)
+ int tmp;
+ if ((tmp=vio_read(net->vio,(char*) net->buff, length)) <= 0)
{
my_bool interrupted = vio_should_retry(net->vio);
if (!thr_got_alarm(&alarmed) && interrupted)
@@ -518,11 +560,60 @@ static void my_net_skip_rest(NET *net, uint32 remain, thr_alarm_t *alarmed)
if (retry_count++ < net->retry_count)
continue;
}
- return;
+ return 1;
}
- remain -= (uint32) length;
- statistic_add(bytes_received,length,&LOCK_bytes_received);
+ length-= tmp;
}
+ return 0;
+}
+
+/*
+ Help function to clear the commuication buffer when we get a too big packet.
+
+ SYNOPSIS
+ my_net_skip_rest()
+ net Communication handle
+ remain Bytes to read
+ alarmed Parameter for thr_alarm()
+ alarm_buff Parameter for thr_alarm()
+
+ RETURN VALUES
+ 0 Was able to read the whole packet
+ 1 Got mailformed packet from client
+*/
+
+static my_bool my_net_skip_rest(NET *net, uint32 remain, thr_alarm_t *alarmed,
+ ALARM *alarm_buff)
+{
+ uint32 old=remain;
+ DBUG_ENTER("my_net_skip_rest");
+ DBUG_PRINT("enter",("bytes_to_skip: %u", (uint) remain));
+
+ if (!thr_alarm_in_use(&alarmed))
+ {
+ my_bool old_mode;
+ if (!thr_alarm(alarmed,net->read_timeout, alarm_buff) ||
+ vio_blocking(net->vio, TRUE, &old_mode) < 0)
+ DBUG_RETURN(1); /* Can't setup, abort */
+ }
+ for (;;)
+ {
+ while (remain > 0)
+ {
+ uint length= min(remain, net->max_packet);
+ if (net_safe_read(net, (char*) net->buff, length, alarmed))
+ DBUG_RETURN(1);
+ statistic_add(bytes_received, length, &LOCK_bytes_received);
+ remain -= (uint32) length;
+ }
+ if (old != MAX_PACKET_LENGTH)
+ break;
+ if (net_safe_read(net, (char*) net->buff, NET_HEADER_SIZE, alarmed))
+ DBUG_RETURN(1);
+ old=remain= uint3korr(net->buff);
+ net->pkt_nr++;
+ }
+ DBUG_RETURN(0);
}
#endif /* NO_ALARM */
@@ -622,9 +713,8 @@ my_real_read(NET *net, ulong *complen)
continue;
}
#endif
- DBUG_PRINT("error",("Couldn't read packet: remain: %lu errno: %d length: %ld alarmed: %d",
- remain,vio_errno(net->vio), length,
- thr_got_alarm(&alarmed)));
+ DBUG_PRINT("error",("Couldn't read packet: remain: %u errno: %d length: %ld",
+ remain, vio_errno(net->vio), length));
len= packet_error;
net->error= 2; /* Close socket */
net->report_error= 1;
@@ -667,7 +757,10 @@ my_real_read(NET *net, ulong *complen)
#ifdef HAVE_COMPRESS
if (net->compress)
{
- /* complen is > 0 if package is really compressed */
+ /*
+ If the packet is compressed then complen > 0 and contains the
+ number of bytes in the uncompressed packet
+ */
*complen=uint3korr(&(net->buff[net->where_b + NET_HEADER_SIZE]));
}
#endif
@@ -681,11 +774,12 @@ my_real_read(NET *net, ulong *complen)
{
if (net_realloc(net,helping))
{
-#ifndef NO_ALARM
- if (i == 1)
- my_net_skip_rest(net, (uint32) len, &alarmed);
+#if defined(MYSQL_SERVER) && !defined(NO_ALARM)
+ if (!net->compress &&
+ !my_net_skip_rest(net, (uint32) len, &alarmed, &alarm_buff))
+ net->error= 3; /* Successfully skiped packet */
#endif
- len= packet_error; /* Return error */
+ len= packet_error; /* Return error and close connection */
goto end;
}
}
@@ -729,7 +823,7 @@ my_net_read(NET *net)
{
#endif
len = my_real_read(net,&complen);
- if (len == MAX_THREE_BYTES)
+ if (len == MAX_PACKET_LENGTH)
{
/* First packet of a multi-packet. Concatenate the packets */
ulong save_pos = net->where_b;
@@ -738,8 +832,8 @@ my_net_read(NET *net)
{
net->where_b += len;
total_length += len;
- len = my_real_read (net,&complen);
- } while (len == MAX_THREE_BYTES);
+ len = my_real_read(net,&complen);
+ } while (len == MAX_PACKET_LENGTH);
if (len != packet_error)
len+= total_length;
net->where_b = save_pos;
@@ -766,7 +860,7 @@ my_net_read(NET *net)
}
else
{
- /* reuse buffer, as there is noting in it that we need */
+ /* reuse buffer, as there is nothing in it that we need */
buf_length=start_of_packet=first_packet_offset=0;
}
for (;;)
@@ -797,7 +891,7 @@ my_net_read(NET *net)
else
start_of_packet+= read_length + NET_HEADER_SIZE;
- if (read_length != MAX_THREE_BYTES) /* last package */
+ if (read_length != MAX_PACKET_LENGTH) /* last package */
{
multi_byte_packet= 0; /* No last zero len packet */
break;
@@ -852,3 +946,6 @@ my_net_read(NET *net)
#endif /* HAVE_COMPRESS */
return len;
}
+
+#endif /* EMBEDDED_LIBRARY */
+
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index 887ce6c561a..43066a29624 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -603,12 +603,14 @@ int SQL_SELECT::test_quick_select(key_map keys_to_use, table_map prev_tables,
records++; /* purecov: inspected */
scan_time=(double) records / TIME_FOR_COMPARE+1;
read_time=(double) head->file->scan_time()+ scan_time + 1.0;
+ if (head->force_index)
+ scan_time= read_time= DBL_MAX;
if (limit < records)
read_time=(double) records+scan_time+1; // Force to use index
else if (read_time <= 2.0 && !force_quick_range)
DBUG_RETURN(0); /* No need for quick select */
- DBUG_PRINT("info",("Time to scan table: %ld",(long) read_time));
+ DBUG_PRINT("info",("Time to scan table: %g", read_time));
keys_to_use&=head->keys_in_use_for_query;
if (keys_to_use)
@@ -2794,7 +2796,7 @@ static void
print_key(KEY_PART *key_part,const char *key,uint used_length)
{
char buff[1024];
- String tmp(buff,sizeof(buff),NULL);
+ String tmp(buff,sizeof(buff),my_charset_bin);
for (uint length=0;
length < used_length ;
diff --git a/sql/opt_sum.cc b/sql/opt_sum.cc
index b1bb36353bf..492834b5bb9 100644
--- a/sql/opt_sum.cc
+++ b/sql/opt_sum.cc
@@ -38,7 +38,7 @@ int opt_sum_query(TABLE_LIST *tables, List<Item> &all_fields,COND *conds)
table_map removed_tables=0;
Item *item;
COND *org_conds= conds;
-
+
/* Add all ON conditions to WHERE condition */
for (TABLE_LIST *tl=tables; tl ; tl= tl->next)
{
@@ -165,10 +165,9 @@ int opt_sum_query(TABLE_LIST *tables, List<Item> &all_fields,COND *conds)
error=table->file->index_last(table->record[0]) !=0;
else
{
- (void)table->file->index_read(table->record[0], key_buff,
+ error = table->file->index_read(table->record[0], key_buff,
ref.key_length,
- HA_READ_AFTER_KEY);
- error=table->file->index_prev(table->record[0]) ||
+ HA_READ_PREFIX_LAST) ||
key_cmp(table,key_buff,ref.key,ref.key_length);
}
if (table->key_read)
diff --git a/sql/password.c b/sql/password.c
index da7a499ba09..9b6189a161c 100644
--- a/sql/password.c
+++ b/sql/password.c
@@ -236,7 +236,7 @@ void password_hash_stage1(char *to, const char *password)
{
if (*password == ' ' || *password == '\t')
continue;/* skip space in password */
- sha1_input(&context,(int8*)&password[0],1);
+ sha1_input(&context,(uint8*) &password[0],1);
}
sha1_result(&context,(uint8*)to);
}
@@ -259,9 +259,9 @@ void password_hash_stage2(char *to,const char *salt)
{
SHA1_CONTEXT context;
sha1_reset(&context);
- sha1_input(&context,(uint8*)salt,4);
- sha1_input(&context,to,SHA1_HASH_SIZE);
- sha1_result(&context,(uint8*)to);
+ sha1_input(&context,(uint8*) salt, 4);
+ sha1_input(&context,(uint8*) to, SHA1_HASH_SIZE);
+ sha1_result(&context,(uint8*) to);
}
@@ -295,14 +295,14 @@ void make_scrambled_password(char *to,const char *password,
else /* New password 4.1 password scrambling */
{
to[0]=PVERSION41_CHAR; /* New passwords have version prefix */
- /* Random returns number from 0 to 1 so this would be good salt generation.*/
+ /* Rnd returns number from 0 to 1 so this would be good salt generation.*/
salt=rnd(rand_st)*65535+1;
/* Use only 2 first bytes from it */
sprintf(to+1,"%04x",salt);
/* First hasing is done without salt */
- password_hash_stage1(digest,password);
+ password_hash_stage1((char*) digest, password);
/* Second stage is done with salt */
- password_hash_stage2(digest,(char*)to+1),
+ password_hash_stage2((char*) digest,(char*)to+1),
/* Print resulting hash into the password*/
sprintf(to+5,
"%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x",
@@ -376,7 +376,7 @@ my_bool validate_password(const char* password, const char* message,
password_hash_stage2(buffer,tmpsalt);
/* Convert password to salt to compare */
- get_salt_from_bin_password(salt_candidate,buffer,salt[0]);
+ get_salt_from_bin_password(salt_candidate,(uchar*) buffer,salt[0]);
/* Now we shall get exactly the same password as we have stored for user */
for (salt_end=salt+5 ; salt < salt_end; )
diff --git a/sql/procedure.h b/sql/procedure.h
index bc1b6062e1d..03a45488b03 100644
--- a/sql/procedure.h
+++ b/sql/procedure.h
@@ -59,7 +59,7 @@ public:
void set(double nr) { value=nr; }
void set(longlong nr) { value=(double) nr; }
void set(const char *str,uint length,CHARSET_INFO *cs)
- { value=my_strntod(cs,str,length,(char**)0); }
+ { int err; value=my_strntod(cs,(char*) str,length,(char**)0,&err); }
double val() { return value; }
longlong val_int() { return (longlong) value; }
String *val_str(String *s) { s->set(value,decimals,thd_charset()); return s; }
@@ -77,7 +77,7 @@ public:
void set(double nr) { value=(longlong) nr; }
void set(longlong nr) { value=nr; }
void set(const char *str,uint length, CHARSET_INFO *cs)
- { value=my_strntoll(cs,str,length,NULL,10); }
+ { int err; value=my_strntoll(cs,str,length,10,NULL,&err); }
double val() { return (double) value; }
longlong val_int() { return value; }
String *val_str(String *s) { s->set(value, thd_charset()); return s; }
@@ -98,13 +98,16 @@ public:
{ str_value.copy(str,length,cs); }
double val()
{
+ int err;
CHARSET_INFO *cs=str_value.charset();
- return my_strntod(cs, str_value.ptr(), str_value.length(),(char**)0);
+ return my_strntod(cs, (char*) str_value.ptr(), str_value.length(),
+ (char**) 0, &err);
}
longlong val_int()
{
+ int err;
CHARSET_INFO *cs=str_value.charset();
- return my_strntoll(cs,str_value.ptr(),str_value.length(),NULL,10);
+ return my_strntoll(cs,str_value.ptr(),str_value.length(),10,NULL,&err);
}
String *val_str(String*)
{
diff --git a/sql/protocol.cc b/sql/protocol.cc
index d7cf9d39b5c..1fb7e85f877 100644
--- a/sql/protocol.cc
+++ b/sql/protocol.cc
@@ -27,6 +27,27 @@
#include <stdarg.h>
#include <assert.h>
+#ifndef EMBEDDED_LIBRARY
+bool Protocol::net_store_data(const char *from, uint length)
+{
+ ulong packet_length=packet->length();
+ if (packet_length+5+length > packet->alloced_length() &&
+ packet->realloc(packet_length+5+length))
+ return 1;
+ char *to=(char*) net_store_length((char*) packet->ptr()+packet_length,
+ (ulonglong) length);
+ memcpy(to,from,length);
+ packet->length((uint) (to+length-packet->ptr()));
+ return 0;
+}
+
+inline bool Protocol::convert_str(const char *from, uint length)
+{
+ convert->store(packet, from, length);
+}
+#endif
+
+
/* Send a error string to client */
void send_error(THD *thd, uint sql_errno, const char *err)
@@ -39,7 +60,9 @@ void send_error(THD *thd, uint sql_errno, const char *err)
err ? err : net->last_error[0] ?
net->last_error : "NULL"));
+#ifndef EMBEDDED_LIBRARY /* TODO query cache in embedded library*/
query_cache_abort(net);
+#endif
thd->query_error= 1; // needed to catch query errors during replication
if (!err)
{
@@ -56,6 +79,12 @@ void send_error(THD *thd, uint sql_errno, const char *err)
}
}
}
+
+#ifdef EMBEDDED_LIBRARY
+ net->last_errno= sql_errno;
+ strmake(net->last_error, err, sizeof(net->last_error)-1);
+#else
+
if (net->vio == 0)
{
if (thd->bootstrap)
@@ -78,6 +107,7 @@ void send_error(THD *thd, uint sql_errno, const char *err)
set_if_smaller(length,MYSQL_ERRMSG_SIZE-1);
}
VOID(net_write_command(net,(uchar) 255, "", 0, (char*) err,length));
+#endif /* EMBEDDED_LIBRARY*/
thd->fatal_error=0; // Error message is given
thd->net.report_error= 0;
DBUG_VOID_RETURN;
@@ -88,6 +118,7 @@ void send_error(THD *thd, uint sql_errno, const char *err)
This is used by mysqld.cc, which doesn't have a THD
*/
+#ifndef EMBEDDED_LIBRARY
void net_send_error(NET *net, uint sql_errno, const char *err)
{
char buff[2];
@@ -100,7 +131,7 @@ void net_send_error(NET *net, uint sql_errno, const char *err)
net_write_command(net,(uchar) 255, buff, 2, err, length);
DBUG_VOID_RETURN;
}
-
+#endif
/*
Send a warning to the end user
@@ -137,14 +168,22 @@ net_printf(THD *thd, uint errcode, ...)
{
va_list args;
uint length,offset;
- const char *format,*text_pos;
+ const char *format;
+#ifndef EMBEDDED_LIBRARY
+ const char *text_pos;
+#else
+ char text_pos[500];
+#endif
int head_length= NET_HEADER_SIZE;
NET *net= &thd->net;
+
DBUG_ENTER("net_printf");
DBUG_PRINT("enter",("message: %u",errcode));
thd->query_error= 1; // needed to catch query errors during replication
+#ifndef EMBEDDED_LIBRARY
query_cache_abort(net); // Safety
+#endif
va_start(args,errcode);
/*
The following is needed to make net_printf() work with 0 argument for
@@ -160,18 +199,24 @@ net_printf(THD *thd, uint errcode, ...)
errcode= ER_UNKNOWN_ERROR;
}
offset= net->return_errno ? 2 : 0;
+#ifndef EMBEDDED_LIBRARY
text_pos=(char*) net->buff+head_length+offset+1;
+#endif
(void) vsprintf(my_const_cast(char*) (text_pos),format,args);
length=(uint) strlen((char*) text_pos);
if (length >= sizeof(net->last_error))
length=sizeof(net->last_error)-1; /* purecov: inspected */
va_end(args);
+#ifndef EMBEDDED_LIBRARY
if (net->vio == 0)
{
if (thd->bootstrap)
{
- /* In bootstrap it's ok to print on stderr */
+ /*
+ In bootstrap it's ok to print on stderr
+ This may also happen when we get an error from a slave thread
+ */
fprintf(stderr,"ERROR: %d %s\n",errcode,text_pos);
thd->fatal_error=1;
}
@@ -184,10 +229,36 @@ net_printf(THD *thd, uint errcode, ...)
if (offset)
int2store(text_pos-2, errcode);
VOID(net_real_write(net,(char*) net->buff,length+head_length+1+offset));
+#else
+ net->last_errno= errcode;
+ strmake(net->last_error, text_pos, length);
+#endif
thd->fatal_error=0; // Error message is given
DBUG_VOID_RETURN;
}
+/*
+ Function called by my_net_init() to set some check variables
+*/
+
+#ifndef EMBEDDED_LIBRARY
+extern "C" {
+void my_net_local_init(NET *net)
+{
+ net->max_packet= (uint) global_system_variables.net_buffer_length;
+ net->read_timeout= (uint) global_system_variables.net_read_timeout;
+ net->write_timeout=(uint) global_system_variables.net_write_timeout;
+ net->retry_count= (uint) global_system_variables.net_retry_count;
+ net->max_packet_size= max(global_system_variables.net_buffer_length,
+ global_system_variables.max_allowed_packet);
+}
+}
+
+#else /* EMBEDDED_LIBRARY */
+void my_net_local_init(NET *net __attribute__(unused))
+{
+}
+#endif /* EMBEDDED_LIBRARY */
/*
Return ok to the client.
@@ -214,6 +285,7 @@ net_printf(THD *thd, uint errcode, ...)
If net->no_send_ok return without sending packet
*/
+#ifndef EMBEDDED_LIBRARY
void
send_ok(THD *thd, ha_rows affected_rows, ulonglong id, const char *message)
@@ -299,6 +371,7 @@ send_eof(THD *thd, bool no_flush)
}
DBUG_VOID_RETURN;
}
+#endif /* EMBEDDED_LIBRARY */
/****************************************************************************
@@ -331,7 +404,7 @@ net_store_length(char *pkg, ulonglong length)
}
*packet++=254;
int8store(packet,length);
- return (char*) packet+9;
+ return (char*) packet+8;
}
@@ -353,23 +426,6 @@ char *net_store_length(char *pkg, uint length)
}
-/*
- Used internally for storing strings in packet
-*/
-
-static bool net_store_data(String *packet, const char *from, uint length)
-{
- ulong packet_length=packet->length();
- if (packet_length+5+length > packet->alloced_length() &&
- packet->realloc(packet_length+5+length))
- return 1;
- char *to=(char*) net_store_length((char*) packet->ptr()+packet_length,
- (ulonglong) length);
- memcpy(to,from,length);
- packet->length((uint) (to+length-packet->ptr()));
- return 0;
-}
-
/****************************************************************************
Functions used by the protocol functions (like send_ok) to store strings
and numbers in the header result packet.
@@ -406,19 +462,6 @@ char *net_store_data(char *to,longlong from)
Function called by my_net_init() to set some check variables
*/
-extern "C" {
-void my_net_local_init(NET *net)
-{
- net->max_packet= (uint) global_system_variables.net_buffer_length;
- net->read_timeout= (uint) global_system_variables.net_read_timeout;
- net->write_timeout=(uint) global_system_variables.net_write_timeout;
- net->retry_count= (uint) global_system_variables.net_retry_count;
- net->max_packet_size= max(global_system_variables.net_buffer_length,
- global_system_variables.max_allowed_packet);
-}
-}
-
-
/*****************************************************************************
Default Protocol functions
*****************************************************************************/
@@ -455,6 +498,7 @@ void Protocol::init(THD *thd_arg)
1 Error (Note that in this case the error is not sent to the client)
*/
+#ifndef EMBEDDED_LIBRARY
bool Protocol::send_fields(List<Item> *list, uint flag)
{
List_iterator_fast<Item> it(*list);
@@ -537,6 +581,14 @@ err:
DBUG_RETURN(1); /* purecov: inspected */
}
+bool Protocol::send_records_num(List<Item> *list, ulonglong records)
+{
+ char *pos;
+ char buff[20];
+ pos=net_store_length(buff, (uint) list->elements);
+ pos=net_store_length(pos, records);
+ return my_net_write(&thd->net, buff,(uint) (pos-buff));
+}
bool Protocol::write()
{
@@ -545,6 +597,9 @@ bool Protocol::write()
}
+#endif /* EMBEDDED_LIBRARY */
+
+
/*
Send \0 end terminated string
@@ -602,6 +657,7 @@ bool Protocol::store(I_List<i_string>* str_list)
****************************************************************************/
+#ifndef EMBEDDED_LIBRARY
void Protocol_simple::prepare_for_resend()
{
packet->length(0);
@@ -619,6 +675,7 @@ bool Protocol_simple::store_null()
buff[0]= (char)251;
return packet->append(buff, sizeof(buff), PACKET_BUFFET_EXTRA_ALLOC);
}
+#endif
bool Protocol_simple::store(const char *from, uint length)
{
@@ -630,8 +687,8 @@ bool Protocol_simple::store(const char *from, uint length)
field_pos++;
#endif
if (convert)
- return convert->store(packet, from, length);
- return net_store_data(packet, from, length);
+ return convert_str(from, length);
+ return net_store_data(from, length);
}
@@ -641,7 +698,7 @@ bool Protocol_simple::store_tiny(longlong from)
DBUG_ASSERT(field_types == 0 || field_types[field_pos++] == MYSQL_TYPE_TINY);
#endif
char buff[20];
- return net_store_data(packet,(char*) buff,
+ return net_store_data((char*) buff,
(uint) (int10_to_str((int) from,buff, -10)-buff));
}
@@ -652,7 +709,7 @@ bool Protocol_simple::store_short(longlong from)
field_types[field_pos++] == MYSQL_TYPE_SHORT);
#endif
char buff[20];
- return net_store_data(packet,(char*) buff,
+ return net_store_data((char*) buff,
(uint) (int10_to_str((int) from,buff, -10)-buff));
}
@@ -662,7 +719,7 @@ bool Protocol_simple::store_long(longlong from)
DBUG_ASSERT(field_types == 0 || field_types[field_pos++] == MYSQL_TYPE_LONG);
#endif
char buff[20];
- return net_store_data(packet,(char*) buff,
+ return net_store_data((char*) buff,
(uint) (int10_to_str((int) from,buff, -10)-buff));
}
@@ -674,7 +731,7 @@ bool Protocol_simple::store_longlong(longlong from, bool unsigned_flag)
field_types[field_pos++] == MYSQL_TYPE_LONGLONG);
#endif
char buff[22];
- return net_store_data(packet,(char*) buff,
+ return net_store_data((char*) buff,
(uint) (longlong10_to_str(from,buff,
unsigned_flag ? 10 : -10)-
buff));
@@ -688,7 +745,7 @@ bool Protocol_simple::store(float from, uint32 decimals, String *buffer)
field_types[field_pos++] == MYSQL_TYPE_FLOAT);
#endif
buffer->set((double) from, decimals, thd->variables.thd_charset);
- return net_store_data(packet,(char*) buffer->ptr(), buffer->length());
+ return net_store_data((char*) buffer->ptr(), buffer->length());
}
bool Protocol_simple::store(double from, uint32 decimals, String *buffer)
@@ -698,7 +755,7 @@ bool Protocol_simple::store(double from, uint32 decimals, String *buffer)
field_types[field_pos++] == MYSQL_TYPE_DOUBLE);
#endif
buffer->set(from, decimals, thd->variables.thd_charset);
- return net_store_data(packet,(char*) buffer->ptr(), buffer->length());
+ return net_store_data((char*) buffer->ptr(), buffer->length());
}
@@ -713,8 +770,8 @@ bool Protocol_simple::store(Field *field)
String tmp(buff,sizeof(buff),default_charset_info);
field->val_str(&tmp,&tmp);
if (convert)
- return convert->store(packet, tmp.ptr(), tmp.length());
- return net_store_data(packet, tmp.ptr(), tmp.length());
+ return convert_str(tmp.ptr(), tmp.length());
+ return net_store_data(tmp.ptr(), tmp.length());
}
@@ -735,7 +792,7 @@ bool Protocol_simple::store(TIME *tm)
(int) tm->hour,
(int) tm->minute,
(int) tm->second));
- return net_store_data(packet, (char*) buff, length);
+ return net_store_data((char*) buff, length);
}
@@ -751,7 +808,7 @@ bool Protocol_simple::store_date(TIME *tm)
(int) tm->year,
(int) tm->month,
(int) tm->day));
- return net_store_data(packet, (char*) buff, length);
+ return net_store_data((char*) buff, length);
}
@@ -768,7 +825,7 @@ bool Protocol_simple::store_time(TIME *tm)
(long) tm->day*3600L+(long) tm->hour,
(int) tm->minute,
(int) tm->second));
- return net_store_data(packet, (char*) buff, length);
+ return net_store_data((char*) buff, length);
}
@@ -792,7 +849,7 @@ bool Protocol_simple::store_time(TIME *tm)
bool Protocol_prep::prepare_for_send(List<Item> *item_list)
{
- field_count= item_list->elements;
+ Protocol::prepare_for_send(item_list);
bit_fields= (field_count+9)/8;
if (packet->alloc(bit_fields+1))
return 1;
@@ -819,11 +876,10 @@ bool Protocol_prep::store(const char *from,uint length)
#endif
field_pos++;
if (convert)
- return convert->store(packet, from, length);
- return net_store_data(packet, from, length);
+ return convert_str(from, length);
+ return net_store_data(from, length);
}
-
bool Protocol_prep::store_null()
{
uint offset= (field_pos+2)/8+1, bit= (1 << ((field_pos+2) & 7));
diff --git a/sql/protocol.h b/sql/protocol.h
index b3ab0a2b31d..f57652af670 100644
--- a/sql/protocol.h
+++ b/sql/protocol.h
@@ -23,7 +23,9 @@
class CONVERT;
class i_string;
class THD;
-
+#ifdef EMBEDDED_LIBRARY
+typedef struct st_mysql_field MYSQL_FIELD;
+#endif
class Protocol
{
protected:
@@ -33,7 +35,14 @@ protected:
#ifndef DEBUG_OFF
enum enum_field_types *field_types;
#endif
-
+ uint field_count;
+ bool net_store_data(const char *from, uint length);
+ bool convert_str(const char *from, uint length);
+#ifdef EMBEDDED_LIBRARY
+ char **next_field;
+ MYSQL_FIELD *next_mysql_field;
+ MEM_ROOT *alloc;
+#endif
public:
CONVERT *convert;
@@ -41,6 +50,7 @@ public:
Protocol(THD *thd) { init(thd); }
void init(THD* thd);
bool send_fields(List<Item> *list, uint flag);
+ bool send_records_num(List<Item> *list, ulonglong records);
bool store(I_List<i_string> *str_list);
bool store(const char *from);
String *storage_packet() { return packet; }
@@ -52,8 +62,12 @@ public:
{ return store_longlong((longlong) from, 0); }
inline bool store(ulonglong from)
{ return store_longlong((longlong) from, 1); }
-
- virtual bool prepare_for_send(List<Item> *item_list) { return 0;}
+
+ virtual bool prepare_for_send(List<Item> *item_list)
+ {
+ field_count=item_list->elements;
+ return 0;
+ }
virtual void prepare_for_resend()=0;
virtual bool store_null()=0;
@@ -97,7 +111,7 @@ public:
class Protocol_prep :public Protocol
{
private:
- uint field_count, bit_fields;
+ uint bit_fields;
public:
Protocol_prep() {}
Protocol_prep(THD *thd) :Protocol(thd) {}
@@ -117,7 +131,6 @@ public:
virtual bool store(Field *field);
};
-
void send_warning(THD *thd, uint sql_errno, const char *err=0);
void net_printf(THD *thd,uint sql_errno, ...);
void send_ok(THD *thd, ha_rows affected_rows=0L, ulonglong id=0L,
diff --git a/sql/repl_failsafe.cc b/sql/repl_failsafe.cc
index 16b2eedd3b2..49b061ae6b4 100644
--- a/sql/repl_failsafe.cc
+++ b/sql/repl_failsafe.cc
@@ -17,6 +17,8 @@
// Sasha Pachev <sasha@mysql.com> is currently in charge of this file
#include "mysql_priv.h"
+#ifdef HAVE_REPLICATION
+
#include "repl_failsafe.h"
#include "sql_repl.h"
#include "slave.h"
@@ -82,7 +84,7 @@ static int init_failsafe_rpl_thread(THD* thd)
#endif
thd->mem_root.free=thd->mem_root.used=0;
- if ((ulong) thd->variables.max_join_size == (ulong) HA_POS_ERROR)
+ if (thd->variables.max_join_size == HA_POS_ERROR)
thd->options|= OPTION_BIG_SELECTS;
thd->proc_info="Thread initialized";
@@ -893,3 +895,6 @@ err:
return error;
}
+
+#endif /* HAVE_REPLICATION */
+
diff --git a/sql/repl_failsafe.h b/sql/repl_failsafe.h
index ef1dc1f8778..72ea0cf2a56 100644
--- a/sql/repl_failsafe.h
+++ b/sql/repl_failsafe.h
@@ -1,3 +1,4 @@
+#ifdef HAVE_REPLICATION
#ifndef REPL_FAILSAFE_H
#define REPL_FAILSAFE_H
@@ -35,3 +36,4 @@ int register_slave(THD* thd, uchar* packet, uint packet_length);
void unregister_slave(THD* thd, bool only_mine, bool need_mutex);
#endif
+#endif /* HAVE_REPLICATION */
diff --git a/sql/set_var.cc b/sql/set_var.cc
index c7dfb63a86f..9208cf2eddd 100644
--- a/sql/set_var.cc
+++ b/sql/set_var.cc
@@ -47,6 +47,7 @@
#endif
#include "mysql_priv.h"
+#include <mysql.h>
#include "slave.h"
#include "sql_acl.h"
#include <my_getopt.h>
@@ -158,11 +159,11 @@ sys_var_thd_ulong sys_max_heap_table_size("max_heap_table_size",
&SV::max_heap_table_size);
sys_var_thd_ulong sys_pseudo_thread_id("pseudo_thread_id",
&SV::pseudo_thread_id);
-sys_var_thd_ulonglong sys_max_join_size("max_join_size",
+sys_var_thd_ha_rows sys_max_join_size("max_join_size",
&SV::max_join_size,
fix_max_join_size);
#ifndef TO_BE_DELETED /* Alias for max_join_size */
-sys_var_thd_ulonglong sys_sql_max_join_size("sql_max_join_size",
+sys_var_thd_ha_rows sys_sql_max_join_size("sql_max_join_size",
&SV::max_join_size,
fix_max_join_size);
#endif
@@ -209,14 +210,18 @@ sys_var_thd_enum sys_query_cache_type("query_cache_type",
sys_var_long_ptr sys_server_id("server_id",&server_id);
sys_var_bool_ptr sys_slave_compressed_protocol("slave_compressed_protocol",
&opt_slave_compressed_protocol);
+#ifdef HAVE_REPLICATION
sys_var_long_ptr sys_slave_net_timeout("slave_net_timeout",
&slave_net_timeout);
+#endif
sys_var_long_ptr sys_slow_launch_time("slow_launch_time",
&slow_launch_time);
sys_var_thd_ulong sys_sort_buffer("sort_buffer_size",
&SV::sortbuff_size);
-sys_var_thd_enum sys_table_type("table_type", &SV::table_type,
- &ha_table_typelib);
+sys_var_thd_sql_mode sys_sql_mode("sql_mode",
+ &SV::sql_mode);
+sys_var_thd_enum sys_table_type("table_type", &SV::table_type,
+ &ha_table_typelib);
sys_var_long_ptr sys_table_cache_size("table_cache",
&table_cache_size);
sys_var_long_ptr sys_thread_cache_size("thread_cache_size",
@@ -284,7 +289,7 @@ static sys_var_thd_bit sys_unique_checks("unique_checks",
/* Local state variables */
-static sys_var_thd_ulonglong sys_select_limit("sql_select_limit",
+static sys_var_thd_ha_rows sys_select_limit("sql_select_limit",
&SV::select_limit);
static sys_var_timestamp sys_timestamp("timestamp");
static sys_var_last_insert_id sys_last_insert_id("last_insert_id");
@@ -300,7 +305,9 @@ static sys_var_readonly sys_warning_count("warning_count",
get_warning_count);
/* alias for last_insert_id() to be compatible with Sybase */
+#ifdef HAVE_REPLICATION
static sys_var_slave_skip_counter sys_slave_skip_counter("sql_slave_skip_counter");
+#endif
static sys_var_rand_seed1 sys_rand_seed1("rand_seed1");
static sys_var_rand_seed2 sys_rand_seed2("rand_seed2");
@@ -383,14 +390,17 @@ sys_var *sys_variables[]=
&sys_safe_updates,
&sys_select_limit,
&sys_server_id,
+#ifdef HAVE_REPLICATION
&sys_slave_compressed_protocol,
&sys_slave_net_timeout,
&sys_slave_skip_counter,
+#endif
&sys_slow_launch_time,
&sys_sort_buffer,
&sys_sql_big_tables,
&sys_sql_low_priority_updates,
&sys_sql_max_join_size,
+ &sys_sql_mode,
&sys_sql_warnings,
&sys_table_cache_size,
&sys_table_type,
@@ -449,6 +459,7 @@ struct show_var_st init_vars[]= {
#ifdef HAVE_INNOBASE_DB
{"innodb_additional_mem_pool_size", (char*) &innobase_additional_mem_pool_size, SHOW_LONG },
{"innodb_buffer_pool_size", (char*) &innobase_buffer_pool_size, SHOW_LONG },
+ {"innodb_buffer_pool_awe_mem_mb", (char*) &innobase_buffer_pool_awe_mem_mb, SHOW_LONG },
{"innodb_data_file_path", (char*) &innobase_data_file_path, SHOW_CHAR_PTR},
{"innodb_data_home_dir", (char*) &innobase_data_home_dir, SHOW_CHAR_PTR},
{"innodb_file_io_threads", (char*) &innobase_file_io_threads, SHOW_LONG },
@@ -478,7 +489,9 @@ struct show_var_st init_vars[]= {
{"log", (char*) &opt_log, SHOW_BOOL},
{"log_update", (char*) &opt_update_log, SHOW_BOOL},
{"log_bin", (char*) &opt_bin_log, SHOW_BOOL},
+#ifdef HAVE_REPLICATION
{"log_slave_updates", (char*) &opt_log_slave_updates, SHOW_MY_BOOL},
+#endif
{"log_slow_queries", (char*) &opt_slow_log, SHOW_BOOL},
{sys_log_warnings.name, (char*) &sys_log_warnings, SHOW_SYS},
{sys_long_query_time.name, (char*) &sys_long_query_time, SHOW_SYS},
@@ -531,7 +544,9 @@ struct show_var_st init_vars[]= {
{"shared_memory_base_name", (char*) &shared_memory_base_name, SHOW_CHAR_PTR},
#endif
{sys_server_id.name, (char*) &sys_server_id, SHOW_SYS},
+#ifdef HAVE_REPLICATION
{sys_slave_net_timeout.name,(char*) &sys_slave_net_timeout, SHOW_SYS},
+#endif
{"skip_external_locking", (char*) &my_disable_locking, SHOW_MY_BOOL},
{"skip_networking", (char*) &opt_disable_networking, SHOW_BOOL},
{"skip_show_database", (char*) &opt_skip_show_db, SHOW_BOOL},
@@ -540,7 +555,7 @@ struct show_var_st init_vars[]= {
{"socket", (char*) &mysql_unix_port, SHOW_CHAR_PTR},
#endif
{sys_sort_buffer.name, (char*) &sys_sort_buffer, SHOW_SYS},
- {"sql_mode", (char*) &opt_sql_mode, SHOW_LONG},
+ {sys_sql_mode.name, (char*) &sys_sql_mode, SHOW_SYS},
{"table_cache", (char*) &table_cache_size, SHOW_LONG},
{sys_table_type.name, (char*) &sys_table_type, SHOW_SYS},
{sys_thread_cache_size.name,(char*) &sys_thread_cache_size, SHOW_SYS},
@@ -606,7 +621,7 @@ static void fix_max_join_size(THD *thd, enum_var_type type)
{
if (type != OPT_GLOBAL)
{
- if (thd->variables.max_join_size == (ulonglong) HA_POS_ERROR)
+ if (thd->variables.max_join_size == HA_POS_ERROR)
thd->options|= OPTION_BIG_SELECTS;
else
thd->options&= ~OPTION_BIG_SELECTS;
@@ -631,6 +646,7 @@ static void fix_tx_isolation(THD *thd, enum_var_type type)
If we are changing the thread variable, we have to copy it to NET too
*/
+#ifdef HAVE_REPLICATION
static void fix_net_read_timeout(THD *thd, enum_var_type type)
{
if (type != OPT_GLOBAL)
@@ -649,6 +665,17 @@ static void fix_net_retry_count(THD *thd, enum_var_type type)
if (type != OPT_GLOBAL)
thd->net.retry_count=thd->variables.net_retry_count;
}
+#else /* HAVE_REPLICATION */
+static void fix_net_read_timeout(THD *thd __attribute__(unused),
+ enum_var_type type __attribute__(unused))
+{}
+static void fix_net_write_timeout(THD *thd __attribute__(unused),
+ enum_var_type type __attribute__(unused))
+{}
+static void fix_net_retry_count(THD *thd __attribute__(unused),
+ enum_var_type type __attribute__(unused))
+{}
+#endif /* HAVE_REPLICATION */
static void fix_query_cache_size(THD *thd, enum_var_type type)
@@ -753,12 +780,7 @@ bool sys_var_thd_ulong::update(THD *thd, set_var *var)
if (option_limits)
tmp= (ulong) getopt_ull_limit_value(tmp, option_limits);
if (var->type == OPT_GLOBAL)
- {
- /* Lock is needed to make things safe on 32 bit systems */
- pthread_mutex_lock(&LOCK_global_system_variables);
global_system_variables.*offset= (ulong) tmp;
- pthread_mutex_unlock(&LOCK_global_system_variables);
- }
else
thd->variables.*offset= (ulong) tmp;
return 0;
@@ -785,10 +807,60 @@ byte *sys_var_thd_ulong::value_ptr(THD *thd, enum_var_type type)
}
+bool sys_var_thd_ha_rows::update(THD *thd, set_var *var)
+{
+ ulonglong tmp= var->value->val_int();
+
+ /* Don't use bigger value than given with --maximum-variable-name=.. */
+ if ((ha_rows) tmp > max_system_variables.*offset)
+ tmp= max_system_variables.*offset;
+
+ if (option_limits)
+ tmp= (ha_rows) getopt_ull_limit_value(tmp, option_limits);
+ if (var->type == OPT_GLOBAL)
+ {
+ /* Lock is needed to make things safe on 32 bit systems */
+ pthread_mutex_lock(&LOCK_global_system_variables);
+ global_system_variables.*offset= (ha_rows) tmp;
+ pthread_mutex_unlock(&LOCK_global_system_variables);
+ }
+ else
+ thd->variables.*offset= (ha_rows) tmp;
+ return 0;
+}
+
+
+void sys_var_thd_ha_rows::set_default(THD *thd, enum_var_type type)
+{
+ if (type == OPT_GLOBAL)
+ {
+ /* We will not come here if option_limits is not set */
+ pthread_mutex_lock(&LOCK_global_system_variables);
+ global_system_variables.*offset= (ha_rows) option_limits->def_value;
+ pthread_mutex_unlock(&LOCK_global_system_variables);
+ }
+ else
+ thd->variables.*offset= global_system_variables.*offset;
+}
+
+
+byte *sys_var_thd_ha_rows::value_ptr(THD *thd, enum_var_type type)
+{
+ if (type == OPT_GLOBAL)
+ return (byte*) &(global_system_variables.*offset);
+ return (byte*) &(thd->variables.*offset);
+}
+
+
bool sys_var_thd_ulonglong::update(THD *thd, set_var *var)
{
if (var->type == OPT_GLOBAL)
+ {
+ /* Lock is needed to make things safe on 32 bit systems */
+ pthread_mutex_lock(&LOCK_global_system_variables);
global_system_variables.*offset= var->value->val_int();
+ pthread_mutex_unlock(&LOCK_global_system_variables);
+ }
else
thd->variables.*offset= var->value->val_int();
return 0;
@@ -798,7 +870,11 @@ bool sys_var_thd_ulonglong::update(THD *thd, set_var *var)
void sys_var_thd_ulonglong::set_default(THD *thd, enum_var_type type)
{
if (type == OPT_GLOBAL)
+ {
+ pthread_mutex_lock(&LOCK_global_system_variables);
global_system_variables.*offset= (ulonglong) option_limits->def_value;
+ pthread_mutex_unlock(&LOCK_global_system_variables);
+ }
else
thd->variables.*offset= global_system_variables.*offset;
}
@@ -873,6 +949,44 @@ err:
return 1;
}
+
+
+bool sys_var::check_set(THD *thd, set_var *var, TYPELIB *enum_names)
+{
+ char buff[80], *value, *error= 0;
+ uint error_len= 0;
+ String str(buff, sizeof(buff), system_charset_info), *res;
+
+ if (var->value->result_type() == STRING_RESULT)
+ {
+ if (!(res= var->value->val_str(&str)))
+ goto err;
+ (long) var->save_result.ulong_value= (ulong)
+ find_set(enum_names, res->c_ptr(), res->length(), &error, &error_len);
+ if (error_len)
+ {
+ strmake(buff, error, min(sizeof(buff), error_len));
+ goto err;
+ }
+ }
+ else
+ {
+ ulonglong tmp= var->value->val_int();
+ if (tmp >= enum_names->count)
+ {
+ llstr(tmp, buff);
+ goto err;
+ }
+ var->save_result.ulong_value= (ulong) tmp; // Save for update
+ }
+ return 0;
+
+err:
+ my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), name, buff);
+ return 1;
+}
+
+
/*
Return an Item for a variable. Used with @@[global.]variable_name
@@ -905,6 +1019,8 @@ Item *sys_var::item(THD *thd, enum_var_type var_type)
return new Item_uint((int32) *(ulong*) value_ptr(thd, var_type));
case SHOW_LONGLONG:
return new Item_int(*(longlong*) value_ptr(thd, var_type));
+ case SHOW_HA_ROWS:
+ return new Item_int((longlong) *(ha_rows*) value_ptr(thd, var_type));
case SHOW_MY_BOOL:
return new Item_int((int32) *(my_bool*) value_ptr(thd, var_type),1);
case SHOW_CHAR:
@@ -947,6 +1063,40 @@ byte *sys_var_thd_enum::value_ptr(THD *thd, enum_var_type type)
}
+byte *sys_var_thd_sql_mode::value_ptr(THD *thd, enum_var_type type)
+{
+ ulong val;
+ char buff[256];
+ String tmp(buff, sizeof(buff), default_charset_info);
+ my_bool found= 0;
+
+ tmp.length(0);
+ val= ((type == OPT_GLOBAL) ? global_system_variables.*offset :
+ thd->variables.*offset);
+ for (uint i= 0; val; val>>= 1, i++)
+ {
+ if (val & 1)
+ {
+ tmp.append(enum_names->type_names[i]);
+ tmp.append(',');
+ }
+ }
+ if (tmp.length())
+ tmp.length(tmp.length() - 1);
+ return (byte*) thd->strdup(tmp.c_ptr());
+}
+
+
+void sys_var_thd_sql_mode::set_default(THD *thd, enum_var_type type)
+{
+ if (type == OPT_GLOBAL)
+ global_system_variables.*offset= 0;
+ else
+ thd->variables.*offset= global_system_variables.*offset;
+}
+
+
+
bool sys_var_thd_bit::update(THD *thd, set_var *var)
{
int res= (*update_func)(thd, var);
@@ -1065,6 +1215,7 @@ byte *sys_var_insert_id::value_ptr(THD *thd, enum_var_type type)
}
+#ifdef HAVE_REPLICATION
bool sys_var_slave_skip_counter::check(THD *thd, set_var *var)
{
int result= 0;
@@ -1100,7 +1251,7 @@ bool sys_var_slave_skip_counter::update(THD *thd, set_var *var)
UNLOCK_ACTIVE_MI;
return 0;
}
-
+#endif /* HAVE_REPLICATION */
bool sys_var_rand_seed1::update(THD *thd, set_var *var)
{
@@ -1371,7 +1522,7 @@ int set_var::check(THD *thd)
return 0;
}
- if (value->check_cols(1) || value->fix_fields(thd, 0, &value))
+ if (value->fix_fields(thd, 0, &value) || value->check_cols(1))
return -1;
if (var->check_update_type(value->result_type()))
{
diff --git a/sql/set_var.h b/sql/set_var.h
index f479cbad042..3b4ec9d5bfe 100644
--- a/sql/set_var.h
+++ b/sql/set_var.h
@@ -28,7 +28,7 @@
class sys_var;
class set_var;
typedef struct system_variables SV;
-extern TYPELIB bool_typelib, delay_key_write_typelib;
+extern TYPELIB bool_typelib, delay_key_write_typelib, sql_mode_typelib;
enum enum_var_type
{
@@ -56,6 +56,7 @@ public:
virtual ~sys_var() {}
virtual bool check(THD *thd, set_var *var) { return 0; }
bool check_enum(THD *thd, set_var *var, TYPELIB *enum_names);
+ bool check_set(THD *thd, set_var *var, TYPELIB *enum_names);
virtual bool update(THD *thd, set_var *var)=0;
virtual void set_default(THD *thd, enum_var_type type) {}
virtual SHOW_TYPE type() { return SHOW_UNDEF; }
@@ -212,6 +213,24 @@ public:
};
+class sys_var_thd_ha_rows :public sys_var_thd
+{
+public:
+ ha_rows SV::*offset;
+ sys_var_thd_ha_rows(const char *name_arg, ha_rows SV::*offset_arg)
+ :sys_var_thd(name_arg), offset(offset_arg)
+ {}
+ sys_var_thd_ha_rows(const char *name_arg, ha_rows SV::*offset_arg,
+ sys_after_update_func func)
+ :sys_var_thd(name_arg,func), offset(offset_arg)
+ {}
+ bool update(THD *thd, set_var *var);
+ void set_default(THD *thd, enum_var_type type);
+ SHOW_TYPE type() { return SHOW_HA_ROWS; }
+ byte *value_ptr(THD *thd, enum_var_type type);
+};
+
+
class sys_var_thd_ulonglong :public sys_var_thd
{
public:
@@ -255,6 +274,7 @@ public:
class sys_var_thd_enum :public sys_var_thd
{
+protected:
ulong SV::*offset;
TYPELIB *enum_names;
public:
@@ -279,6 +299,21 @@ public:
};
+class sys_var_thd_sql_mode :public sys_var_thd_enum
+{
+public:
+ sys_var_thd_sql_mode(const char *name_arg, ulong SV::*offset_arg)
+ :sys_var_thd_enum(name_arg, offset_arg, &sql_mode_typelib)
+ {}
+ bool check(THD *thd, set_var *var)
+ {
+ return check_set(thd, var, enum_names);
+ }
+ void set_default(THD *thd, enum_var_type type);
+ byte *value_ptr(THD *thd, enum_var_type type);
+};
+
+
class sys_var_thd_bit :public sys_var_thd
{
sys_update_func update_func;
@@ -339,6 +374,7 @@ public:
};
+#ifndef EMBEDDED_LIBRARY
class sys_var_slave_skip_counter :public sys_var
{
public:
@@ -351,7 +387,7 @@ public:
type() or value_ptr()
*/
};
-
+#endif
class sys_var_rand_seed1 :public sys_var
{
diff --git a/sql/share/Makefile.am b/sql/share/Makefile.am
index a1b506f1ff5..35202ff4722 100644
--- a/sql/share/Makefile.am
+++ b/sql/share/Makefile.am
@@ -25,8 +25,7 @@ install-data-local:
done
$(mkinstalldirs) $(DESTDIR)$(pkgdatadir)/charsets
$(INSTALL_DATA) $(srcdir)/charsets/README $(DESTDIR)$(pkgdatadir)/charsets/README
- $(INSTALL_DATA) $(srcdir)/charsets/Index.xml $(DESTDIR)$(pkgdatadir)/charsets/Index.xml
- $(INSTALL_DATA) $(srcdir)/charsets/*.conf $(DESTDIR)$(pkgdatadir)/charsets
+ $(INSTALL_DATA) $(srcdir)/charsets/*.xml $(DESTDIR)$(pkgdatadir)/charsets
fix_errors:
for lang in @AVAILABLE_LANGUAGES@; \
diff --git a/sql/share/charsets/Index.xml b/sql/share/charsets/Index.xml
index 9dd8b43f0b4..e6cea7bc615 100644
--- a/sql/share/charsets/Index.xml
+++ b/sql/share/charsets/Index.xml
@@ -6,7 +6,7 @@
This file lists all of the available character sets.
To make maintaining easier please:
- keep records sorted by collation number.
- - change charset-list.max-id when adding a new collation.
+ - change charsets.max-id when adding a new collation.
</description>
<charset name="big5">
@@ -61,7 +61,7 @@ To make maintaining easier please:
<alias>cp850</alias>
<alias>cspc850multilingual</alias>
<alias>ibm850</alias>
- <collation name="dos" id="4" flag="primary">
+ <collation name="pclatin1" id="4" flag="primary">
<order>Dutch</order>
<order>English</order>
<order>French</order>
@@ -76,7 +76,6 @@ To make maintaining easier please:
<charset name="latin1">
<family>Western</family>
<alias>csisolatin1</alias>
- <alias>csisolatin1</alias>
<alias>iso-8859-1</alias>
<alias>iso-ir-100</alias>
<alias>iso_8859-1</alias>
@@ -125,11 +124,11 @@ To make maintaining easier please:
</collation>
</charset>
-<charset name="koi8_ru">
+<charset name="koi8r">
<family>Cyrillic</family>
- <alias>koi8-ru</alias>
+ <alias>koi8-r</alias>
<alias>cskoi8r</alias>
- <collation name="koi8_ru" id="7" order="Russian" flag="primary"/>
+ <collation name="koi8r" id="7" order="Russian" flag="primary"/>
</charset>
<charset name="swe7">
@@ -145,7 +144,7 @@ To make maintaining easier please:
<alias>csascii</alias>
<alias>iso-ir-6</alias>
<alias>iso646-us</alias>
- <collation name="usa7" id="11" order="Egnlish" flag="primary"/>
+ <collation name="ascii" id="11" order="English" flag="primary"/>
</charset>
<charset name="ujis">
@@ -212,11 +211,11 @@ To make maintaining easier please:
<collation name="tis620" id="18" order="Thai" flag="primary" flag="compiled"/>
</charset>
-<charset name="euc_kr">
+<charset name="euckr">
<family>Korean</family>
- <alias>euckr</alias>
+ <alias>euc_kr</alias>
<alias>euc-kr</alias>
- <collation name="euc_kr" id="19" order="Korean" flag="primary" flag="compiled"/>
+ <collation name="euckr" id="19" order="Korean" flag="primary" flag="compiled"/>
</charset>
<charset name="latin7">
@@ -229,10 +228,10 @@ To make maintaining easier please:
<collation name="latvian1" id="42" order="Latvian"/>
</charset>
-<charset name="koi8_ukr">
+<charset name="koi8u">
<family>Cyrillic</family>
<alias>koi8-u</alias>
- <collation name="koi8_ukr" id="22" order="Ukranian" flag="primary"/>
+ <collation name="koi8u" id="22" order="Ukranian" flag="primary"/>
</charset>
<charset name="gb2312">
@@ -256,7 +255,7 @@ To make maintaining easier please:
<family>Central European</family>
<alias>ms-ce</alias>
<alias>windows-1250</alias>
- <collation name="win1250" id="26" flag="primary">
+ <collation name="cp1250" id="26" flag="primary">
<order>Hungarian</order>
<order>Polish</order>
<order>Romanian</order>
@@ -265,7 +264,7 @@ To make maintaining easier please:
<order>Slovenian</order>
<order>Sorbian</order>
</collation>
- <collation name="win1250ch" id="34" order="Czech"/>
+ <collation name="cp1250_czech" id="34" order="Czech"/>
</charset>
<charset name="gbk">
@@ -327,6 +326,7 @@ To make maintaining easier please:
<alias>866</alias>
<alias>csibm866</alias>
<alias>ibm866</alias>
+ <alias>DOSCyrillicRussian</alias>
<collation name="cp866" id="36" order="Russian" flag="primary"/>
</charset>
@@ -445,7 +445,12 @@ To make maintaining easier please:
<family>Arabic</family>
<alias>ms-arab</alias>
<alias>windows-1256</alias>
- <collation name="cp1256" id="57" order="Arabic" flag="primary"/>
+ <collation name="cp1256" id="57" order="Arabic" flag="primary">
+ <order>Arabic</order>
+ <order>Persian</order>
+ <order>Pakistani</order>
+ <order>Urdu</order>
+ </collation>
</charset>
<charset name="binary">
diff --git a/sql/share/charsets/maccebin.conf b/sql/share/charsets/MacCE.xml
index f859e64354c..fe64fd18abc 100644
--- a/sql/share/charsets/maccebin.conf
+++ b/sql/share/charsets/MacCE.xml
@@ -1,9 +1,11 @@
-# Mac OS Central European, binary sort order
-#
-# Czech (cs), Hungarian (hu), Polish (pl), Romanian (ro), Croatian (hr),
-# Slovak (sk), Slovenian (sl), Sorbian.
-#
-# ctype array (must be 257 elements)
+<?xml version='1.0' encoding="utf-8"?>
+
+<charsets>
+
+<charset name="MacCE">
+
+<ctype>
+<map>
00
20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20
20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
@@ -21,8 +23,12 @@
00 00 00 00 00 00 00 00 02 01 02 01 00 00 02 01
02 01 00 00 02 01 02 01 01 02 01 01 02 01 01 01
02 01 01 02 01 02 01 02 01 02 02 01 01 02 01 00
+</map>
+</ctype>
-# to_lower array (must be 256 elements)
+
+<lower>
+<map>
00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
@@ -39,8 +45,12 @@
D0 D1 D2 D3 D4 D5 D6 D7 D8 DA DA DE DC DD DE E0
E0 E4 E2 E3 E4 E6 E6 87 E9 E9 92 EC EC F0 97 99
F0 F3 9C F3 F5 F5 F7 F7 F9 F9 FA FD B8 FD AE FF
+</map>
+</lower>
+
-# to_upper array (must be 256 elements)
+<upper>
+<map>
00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
@@ -57,26 +67,12 @@
D0 D1 D2 D3 D4 D5 D6 D7 CF D9 D9 DB DC DD DB DF
DF E1 E2 E3 E1 E5 E5 E7 E8 E8 EA EB EB ED EE EF
ED F1 F2 F1 F4 F4 F6 F6 F8 F8 B5 FB FC FB FE FF
+</map>
+</upper>
-# sort_order array (must be 256 elements)
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
- 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F
- 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F
- 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
- 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
- A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF
- B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF
- C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
- D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF
- E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
- F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF
-# Unicode mapping (must be 256 elements)
+<unicode>
+<map>
0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F
0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F
0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F
@@ -93,4 +89,121 @@
2013 2014 201C 201D 2018 2019 00F7 25CA 014D 0154 0155 0158 2039 203A 0159 0156
0157 0160 201A 201E 0161 015A 015B 00C1 0164 0165 00CD 017D 017E 016A 00D3 00D4
016B 016E 00DA 016F 0170 0171 0172 0173 00DD 00FD 0137 017B 0141 017C 0122 02C7
+</map>
+</unicode>
+
+
+<collation name="macce">
+<map>
+ 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
+ 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
+ 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
+ 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
+ 40 41 46 47 4A 4C 52 53 55 56 5A 5B 5D 62 62 67
+ 6F 70 71 75 79 81 88 89 8A 8B 8D 90 91 92 93 94
+ 95 41 46 47 4A 4C 52 53 55 56 5A 5B 5D 62 62 67
+ 6F 70 71 75 79 81 88 89 8A 8B 8D 96 97 98 99 9A
+ 41 41 41 4C 41 67 81 41 41 47 41 47 47 47 4C 8D
+ 8D 4A 56 4A 4C 4C 4C 67 4C 67 67 67 81 4C 4C 81
+ A0 A1 4C A3 A4 A5 A6 75 A8 A9 AA 4C AC AD 53 56
+ 56 56 B2 B3 56 5B B6 B7 5D 5D 5D 5D 5D 5D 5D 62
+ 62 62 C2 C3 62 62 C6 C7 C8 C9 CA 62 67 67 67 67
+ D0 D1 D2 D3 D4 D5 D6 D7 67 71 71 71 DC DD 71 71
+ 71 75 E2 E3 75 75 75 41 79 79 56 8D 8D 81 67 67
+ 81 81 81 81 81 81 81 81 8B 8B 5B 8D 5D 8D 53 FF
+</map>
+</collation>
+
+
+<collation name="macce_bin">
+<map>
+ 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
+ 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
+ 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
+ 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
+ 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
+ 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
+ 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F
+ 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F
+ 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
+ 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
+ A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF
+ B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF
+ C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
+ D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF
+ E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
+ F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF
+</map>
+</collation>
+
+
+<collation name="macce_ci_ai">
+<map>
+ 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
+ 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
+ 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
+ 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
+ 40 41 4B 4D 53 57 63 65 69 6B 73 75 79 83 85 8D
+ 9B 9D 9F A7 AE B2 C0 C2 C4 C6 CA D2 D3 D4 D5 D6
+ D7 41 4B 4D 53 57 63 65 69 6B 73 75 79 83 85 8D
+ 9B 9D 9F A7 AE B2 C0 C2 C4 C6 CA D8 D9 DA DB DC
+ 41 41 41 57 41 8D B2 41 41 4D 41 4D 4D 4D 57 CA
+ CA 53 6B 53 57 57 57 8D 57 8D 8D 8D B2 57 57 B2
+ DD DE 57 DF E0 E1 E2 A7 E3 E4 E5 57 E6 E7 65 6B
+ 6B 6B E8 E9 6B 75 EA EB 79 79 79 79 79 79 79 85
+ 85 85 EC ED 85 85 EE EF F0 F1 F2 85 8D 8D 8D 8D
+ F3 F4 F5 F6 F7 F8 F9 FA 8D 9F 9F 9F FB FC 9F 9F
+ 9F A7 FD FE A7 A7 A7 41 BE BE 6B CA CA B2 8D 8D
+ B2 B2 B2 B2 B2 B2 B2 B2 C6 C6 75 CA 79 CA 65 FF
+</map>
+</collation>
+
+
+<collation name="macce_ci_as">
+<map>
+ 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
+ 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
+ 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
+ 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
+ 40 41 4B 4D 53 57 63 65 69 6B 73 75 79 83 85 8D
+ 9B 9D 9F A7 AE B2 C0 C2 C4 C6 CA D2 D3 D4 D5 D6
+ D7 41 4B 4D 53 57 63 65 69 6B 73 75 79 83 85 8D
+ 9B 9D 9F A7 AE B2 C0 C2 C4 C6 CA D8 D9 DA DB DC
+ 45 47 47 59 49 91 B6 43 49 4F 45 4F 51 51 59 CE
+ CE 55 71 55 5B 5B 5D 8F 5D 99 91 97 B8 5F 5F B6
+ DD DE 61 DF E0 E1 E2 AD E3 E4 E5 61 E6 E7 67 6F
+ 6F 6D E8 E9 6D 77 EA EB 7B 81 82 7F 7F 7D 7D 8B
+ 8B 87 EC ED 87 89 EE EF F0 F1 F2 89 93 97 93 95
+ F3 F4 F5 F6 F7 F8 F9 FA 95 A1 A1 A3 FB FC A3 A5
+ A5 A9 FD FE A9 AB AB 43 B0 B0 71 CC CC BC 8F 99
+ BC B4 B8 B4 BA BA BE BE C8 C8 77 D0 7B D0 67 FF
+
+</map>
+</collation>
+
+
+<collation name="macce_cs_as">
+<map>
+ 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
+ 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
+ 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
+ 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
+ 40 41 4B 4D 53 57 63 65 69 6B 73 75 79 83 85 8D
+ 9B 9D 9F A7 AE B2 C0 C2 C4 C6 CA D2 D3 D4 D5 D6
+ D7 42 4C 4E 54 58 64 66 6A 6C 74 76 7A 84 86 8E
+ 9C 9E A0 A8 AF B3 C1 C3 C5 C7 CB D8 D9 DA DB DC
+ 45 47 48 59 49 91 B6 44 4A 4F 46 50 51 52 5A CE
+ CF 55 72 56 5B 5C 5D 90 5E 9A 92 98 B8 5F 60 B7
+ DD DE 61 DF E0 E1 E2 AD E3 E4 E5 62 E6 E7 68 6F
+ 70 6D E8 E9 6E 77 EA EB 7C 81 82 7F 80 7D 7E 8B
+ 8C 87 EC ED 88 89 EE EF F0 F1 F2 8A 93 97 94 95
+ F3 F4 F5 F6 F7 F8 F9 FA 96 A1 A2 A3 FB FC A4 A5
+ A6 A9 FD FE AA AB AC 43 B0 B1 71 CC CD BC 8F 99
+ BD B4 B9 B5 BA BB BE BF C8 C9 78 D0 7B D1 67 FF
+</map>
+</collation>
+
+
+</charset>
+</charsets>
diff --git a/sql/share/charsets/macroman.conf b/sql/share/charsets/MacRoman.xml
index 11cbee40e94..b17860f56b2 100644
--- a/sql/share/charsets/macroman.conf
+++ b/sql/share/charsets/MacRoman.xml
@@ -1,4 +1,11 @@
-# ctype array (must be 257 elements)
+<?xml version='1.0' encoding="utf-8"?>
+
+<charsets>
+
+<charset name="MacRoman">
+
+<ctype>
+<map>
00
20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20
20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
@@ -16,8 +23,11 @@
00 00 00 00 00 00 00 00 02 01 00 00 00 00 00 00
00 00 00 00 00 20 01 01 01 01 01 01 01 01 01 01
00 01 01 01 01 02 00 00 00 00 00 00 00 00 00 00
+</map>
+</ctype>
-# to_lower array (must be 256 elements)
+<lower>
+<map>
00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
@@ -34,8 +44,11 @@
D0 D1 D2 D3 D4 D5 D6 D7 D8 D8 DA DB DC DD DE DF
E0 E1 E2 E3 E4 89 90 87 91 8F 92 94 95 93 97 99
F0 98 9C 9E 9D F5 F6 F7 F8 F9 FA FB FC FD FE FF
+</map>
+</lower>
-# to_upper array (must be 256 elements)
+<upper>
+<map>
00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
@@ -52,26 +65,12 @@
D0 D1 D2 D3 D4 D5 D6 D7 D9 D9 DA DB DC DD DE DF
E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF
+</map>
+</upper>
-# sort_order array (must be 256 elements)
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 41 49 50 52 53 57 59 60 61 67 68 69 70 71 72
- 79 80 81 82 84 85 90 91 92 93 95 A0 A1 A2 A3 A4
- A5 41 49 50 52 53 57 59 60 61 67 68 69 70 71 72
- 79 80 81 82 84 85 90 91 92 93 95 A6 A7 A8 A9 AA
- 41 41 50 53 71 72 85 41 41 41 41 41 41 50 53 53
- 53 53 61 61 61 61 71 72 72 72 72 72 85 85 85 85
- AB AC AD AE AF B0 B1 82 B2 B3 B4 B5 B6 B7 48 72
- B8 B9 BA BB BC BD BE BF C0 C1 C2 C3 C4 C5 48 72
- C6 C7 C8 C9 57 CA CB CC CD CE CF 41 41 72 D0 D1
- D2 D3 D4 D5 D6 D7 D8 D9 93 93 DA DB DC DD DE DF
- E0 E1 E2 E3 E4 41 53 41 53 53 61 61 61 61 72 72
- F0 72 85 85 85 61 F6 F7 F8 F9 FA FB FC FD FE FF
-# Unicode mappping (must be 256 elements)
+<unicode>
+<map>
0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F
0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F
0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F
@@ -88,4 +87,115 @@
2013 2014 201C 201D 2018 2019 00F7 25CA 00FF 0178 2044 20AC 2039 203A FB01 FB02
2021 00B7 201A 201E 2030 00C2 00CA 00C1 00CB 00C8 00CD 00CE 00CF 00CC 00D3 00D4
F8FF 00D2 00DA 00DB 00D9 0131 02C6 02DC 00AF 02D8 02D9 02DA 00B8 02DD 02DB 02C7
+</map>
+</unicode>
+
+<collation name="macroman">
+<map>
+ 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
+ 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
+ 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
+ 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
+ 40 41 49 50 52 53 57 59 60 61 67 68 69 70 71 72
+ 79 80 81 82 84 85 90 91 92 93 95 A0 A1 A2 A3 A4
+ A5 41 49 50 52 53 57 59 60 61 67 68 69 70 71 72
+ 79 80 81 82 84 85 90 91 92 93 95 A6 A7 A8 A9 AA
+ 41 41 50 53 71 72 85 41 41 41 41 41 41 50 53 53
+ 53 53 61 61 61 61 71 72 72 72 72 72 85 85 85 85
+ AB AC AD AE AF B0 B1 82 B2 B3 B4 B5 B6 B7 48 72
+ B8 B9 BA BB BC BD BE BF C0 C1 C2 C3 C4 C5 48 72
+ C6 C7 C8 C9 57 CA CB CC CD CE CF 41 41 72 D0 D1
+ D2 D3 D4 D5 D6 D7 D8 D9 93 93 DA DB DC DD DE DF
+ E0 E1 E2 E3 E4 41 53 41 53 53 61 61 61 61 72 72
+ F0 72 85 85 85 61 F6 F7 F8 F9 FA FB FC FD FE FF
+</map>
+</collation>
+
+<collation name="macroman_bin">
+<map>
+ 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
+ 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
+ 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
+ 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
+ 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
+ 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
+ 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F
+ 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F
+ 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
+ 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
+ A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF
+ B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF
+ C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
+ D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF
+ E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
+ F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF
+</map>
+</collation>
+
+<collation name="macroman_ci_ai">
+<map>
+ 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
+ 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
+ 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
+ 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
+ 40 41 51 53 57 59 63 66 68 6A 75 77 79 7B 7D 81
+ 91 93 95 97 9A 9C A6 A8 AA AC B0 B2 B3 B4 B5 B6
+ B7 41 51 53 57 59 63 66 68 6A 75 77 79 7B 7D 81
+ 91 93 95 97 9A 9C A6 A8 AA AC B0 B8 B9 BA BB BC
+ 41 41 53 59 7D 81 9C 41 41 41 41 41 41 53 59 59
+ 59 59 6A 6A 6A 6A 7D 81 81 81 81 81 9C 9C 9C 9C
+ BD BE BF C0 C1 C2 C3 97 C4 C5 C6 C7 C8 C9 41 81
+ CA CB CC CD CE CF D0 D1 D2 D3 D4 D5 D6 D7 41 81
+ D8 D9 DA DB 63 DC DD DE DF E0 E1 41 41 81 81 81
+ E2 E3 E4 E5 E6 E7 E8 E9 AC AC EA EB EC ED EE EF
+ F0 F1 F2 F3 F4 41 59 41 59 59 6A 6A 6A 6A 81 81
+ F0 81 9C 9C 9C 6A F6 F7 F8 F9 FA FB FC FD FE FF
+
+</map>
+</collation>
+
+<collation name="macroman_ci_as">
+<map>
+ 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
+ 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
+ 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
+ 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
+ 40 41 51 53 57 59 63 66 68 6A 75 77 79 7B 7D 81
+ 91 93 95 97 9A 9C A6 A8 AA AC B0 B2 B3 B4 B5 B6
+ B7 41 51 53 57 59 63 66 68 6A 75 77 79 7B 7D 81
+ 91 93 95 97 9A 9C A6 A8 AA AC B0 B8 B9 BA BB BC
+ 4B 4D 55 5D 7F 8B A4 45 43 47 4B 49 4D 55 5D 5B
+ 5F 61 6E 6C 70 72 7F 85 83 87 8B 89 A0 9E A2 A4
+ BD BE BF C0 C1 C2 C3 99 C4 C5 C6 C7 C8 C9 4F 8D
+ CA CB CC CD CE CF D0 D1 D2 D3 D4 D5 D6 D7 4F 8D
+ D8 D9 DA DB 65 DC DD DE DF E0 E1 43 49 89 8F 8F
+ E2 E3 E4 E5 E6 E7 E8 E9 AE AE EA EB EC ED EE EF
+ F0 F1 F2 F3 F4 47 5F 45 61 5B 6E 70 70 6C 85 87
+ F0 83 A0 A2 9E 72 F6 F7 F8 F9 FA FB FC FD FE FF
+</map>
+</collation>
+
+<collation name="macroman_cs_as">
+<map>
+ 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
+ 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
+ 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
+ 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
+ 40 41 51 53 57 59 63 66 68 6A 75 77 79 7B 7D 81
+ 91 93 95 97 9A 9C A6 A8 AA AC B0 B2 B3 B4 B5 B6
+ B7 42 52 54 58 5A 64 67 69 6B 76 78 7A 7C 7E 82
+ 92 94 96 98 9B 9D A7 A9 AB AD B1 B8 B9 BA BB BC
+ 4B 4D 55 5D 7F 8B A4 46 44 48 4C 4A 4E 56 5E 5C
+ 60 62 6F 6D 71 73 80 86 84 88 8C 8A A1 9F A3 A5
+ BD BE BF C0 C1 C2 C3 99 C4 C5 C6 C7 C8 C9 4F 8D
+ CA CB CC CD CE CF D0 D1 D2 D3 D4 D5 D6 D7 50 8E
+ D8 D9 DA DB 65 DC DD DE DF E0 E1 43 49 89 8F 90
+ E2 E3 E4 E5 E6 E7 E8 E9 AF AE EA EB EC ED EE EF
+ F0 F1 F2 F3 F4 47 5F 45 61 5B 6E 70 72 6C 85 87
+ F0 83 A0 A2 9E 74 F6 F7 F8 F9 FA FB FC FD FE FF
+</map>
+</collation>
+
+</charset>
+</charsets>
diff --git a/sql/share/charsets/armscii8.conf b/sql/share/charsets/armscii8.conf
deleted file mode 100644
index 54d2d0fec47..00000000000
--- a/sql/share/charsets/armscii8.conf
+++ /dev/null
@@ -1,93 +0,0 @@
-# Configuration file for the armscii8 (armenian) character set
-
-# ctype array (must have 257 elements)
- 00
- 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20
- 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
- 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
- 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10
- 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01
- 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10
- 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02
- 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 20
- 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
- 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
- 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
- 10 10 01 02 01 02 01 02 01 02 01 02 01 02 01 02
- 01 02 01 02 01 02 01 02 01 02 01 02 01 02 01 02
- 01 02 01 02 01 02 01 02 01 02 01 02 01 02 01 02
- 01 02 01 02 01 02 01 02 01 02 01 02 01 02 01 02
- 01 02 01 02 01 02 01 02 01 02 01 02 01 02 10 10
-
-# to_lower array (must have 256 elements)
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F
- 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F
- 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F
- 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F
- 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
- 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
- A0 A1 A2 A3 A4 A5 A6 A7 B8 A9 AA AB AC AD AE AF
- B0 B1 B3 B3 B5 B5 B7 B7 B9 B9 BB BB BD BD BF BF
- C1 C1 C3 C3 C5 C5 C7 C7 C9 C9 CB CB CD CD CF CF
- D1 D1 D3 D3 D5 D5 D7 D7 D9 D9 DB DB DD DD DF DF
- E1 E1 E3 E3 E5 E5 E7 E7 E9 E9 EB EB ED ED EF EF
- F1 F1 F3 F3 F5 F5 F7 F7 F9 F9 FB FB FD FD FE FF
-
-# to_upper array (must have 256 elements)
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
- 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F
- 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
- 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
- A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF
- B0 B1 B2 B2 B4 B4 B6 B6 B8 B8 BA BA BC BC BE BE
- C0 C0 C2 C2 C4 C4 C6 C6 C8 C8 CA CA CC CC CE CE
- D0 D0 D2 D2 D4 D4 D6 D6 D8 D8 DA DA DC DC DE DE
- E0 E0 E2 E2 E4 E4 E6 E6 E8 E8 EA EA EC EC EE EE
- F0 F0 F2 F2 F4 F4 F6 F6 F8 F8 FA FA FC FC FE FF
-
-# sort_order array (must have 256 elements)
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
- 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F
- 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
- 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
- A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF
- B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF
- C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
- D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF
- E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
- F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF
-
-
-# Unicode mapping (256 elements)
-0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F
-0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F
-0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F
-0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F
-0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F
-0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F
-0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F
-0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F
-0080 0081 0082 0083 0084 0085 0086 0087 0088 0089 008A 008B 008C 008D 008E 008F
-0090 0091 0092 0093 0094 0095 0096 0097 0098 0099 009A 009B 009C 009D 009E 009F
-00A0 2741 00A7 0589 0029 0028 00BB 00AB 2014 002E 055D 002C 002D 055F 2026 055C
-055B 055E 0531 0561 0532 0562 0533 0563 0534 0564 0535 0565 0536 0566 0537 0567
-0538 0568 0539 0569 053A 056A 053B 056B 053C 056C 053D 056D 053E 056E 053F 056F
-0540 0570 0541 0571 0542 0572 0543 0573 0544 0574 0545 0575 0546 0576 0547 0577
-0548 0578 0549 0579 054A 057A 054B 057B 054C 057C 054D 057D 054E 057E 054F 057F
-0550 0580 0551 0581 0552 0582 0553 0583 0554 0584 0555 0585 0556 0586 2019 0027
diff --git a/sql/share/charsets/armscii8.xml b/sql/share/charsets/armscii8.xml
new file mode 100644
index 00000000000..99ab5eb336d
--- /dev/null
+++ b/sql/share/charsets/armscii8.xml
@@ -0,0 +1,119 @@
+<?xml version='1.0' encoding="utf-8"?>
+
+<charsets>
+
+<charset name="armscii8">
+
+<ctype>
+<map>
+ 00
+ 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20
+ 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
+ 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
+ 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10
+ 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01
+ 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10
+ 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02
+ 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 20
+ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+ 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
+ 10 10 01 02 01 02 01 02 01 02 01 02 01 02 01 02
+ 01 02 01 02 01 02 01 02 01 02 01 02 01 02 01 02
+ 01 02 01 02 01 02 01 02 01 02 01 02 01 02 01 02
+ 01 02 01 02 01 02 01 02 01 02 01 02 01 02 01 02
+ 01 02 01 02 01 02 01 02 01 02 01 02 01 02 10 10
+</map>
+</ctype>
+
+
+<lower>
+<map>
+ 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
+ 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
+ 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
+ 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
+ 40 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F
+ 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F
+ 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F
+ 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F
+ 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
+ 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
+ A0 A1 A2 A3 A4 A5 A6 A7 B8 A9 AA AB AC AD AE AF
+ B0 B1 B3 B3 B5 B5 B7 B7 B9 B9 BB BB BD BD BF BF
+ C1 C1 C3 C3 C5 C5 C7 C7 C9 C9 CB CB CD CD CF CF
+ D1 D1 D3 D3 D5 D5 D7 D7 D9 D9 DB DB DD DD DF DF
+ E1 E1 E3 E3 E5 E5 E7 E7 E9 E9 EB EB ED ED EF EF
+ F1 F1 F3 F3 F5 F5 F7 F7 F9 F9 FB FB FD FD FE FF
+</map>
+</lower>
+
+
+<upper>
+<map>
+ 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
+ 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
+ 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
+ 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
+ 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
+ 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
+ 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
+ 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F
+ 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
+ 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
+ A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF
+ B0 B1 B2 B2 B4 B4 B6 B6 B8 B8 BA BA BC BC BE BE
+ C0 C0 C2 C2 C4 C4 C6 C6 C8 C8 CA CA CC CC CE CE
+ D0 D0 D2 D2 D4 D4 D6 D6 D8 D8 DA DA DC DC DE DE
+ E0 E0 E2 E2 E4 E4 E6 E6 E8 E8 EA EA EC EC EE EE
+ F0 F0 F2 F2 F4 F4 F6 F6 F8 F8 FA FA FC FC FE FF
+</map>
+</upper>
+
+
+<unicode>
+<map>
+0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F
+0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F
+0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F
+0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F
+0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F
+0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F
+0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F
+0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F
+0080 0081 0082 0083 0084 0085 0086 0087 0088 0089 008A 008B 008C 008D 008E 008F
+0090 0091 0092 0093 0094 0095 0096 0097 0098 0099 009A 009B 009C 009D 009E 009F
+00A0 2741 00A7 0589 0029 0028 00BB 00AB 2014 002E 055D 002C 002D 055F 2026 055C
+055B 055E 0531 0561 0532 0562 0533 0563 0534 0564 0535 0565 0536 0566 0537 0567
+0538 0568 0539 0569 053A 056A 053B 056B 053C 056C 053D 056D 053E 056E 053F 056F
+0540 0570 0541 0571 0542 0572 0543 0573 0544 0574 0545 0575 0546 0576 0547 0577
+0548 0578 0549 0579 054A 057A 054B 057B 054C 057C 054D 057D 054E 057E 054F 057F
+0550 0580 0551 0581 0552 0582 0553 0583 0554 0584 0555 0585 0556 0586 2019 0027
+</map>
+</unicode>
+
+
+<collation name="armscii8">
+<map>
+ 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
+ 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
+ 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
+ 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
+ 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
+ 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
+ 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
+ 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F
+ 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
+ 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
+ A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF
+ B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF
+ C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
+ D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF
+ E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
+ F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF
+</map>
+</collation>
+
+</charset>
+
+</charsets>
diff --git a/sql/share/charsets/cp1257bin.conf b/sql/share/charsets/ascii.xml
index 032f8a7e05d..67ab57de88f 100644
--- a/sql/share/charsets/cp1257bin.conf
+++ b/sql/share/charsets/ascii.xml
@@ -1,9 +1,11 @@
-#
-# cp1257 character set
-#
-# Binary sorting order
-#
-# ctype array (must be 257 elements)
+<?xml version='1.0' encoding="utf-8"?>
+
+<charsets>
+
+<charset name="ascii">
+
+<ctype>
+<map>
00
20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20
20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
@@ -12,17 +14,21 @@
10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01
01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10
10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02
- 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 00
+ 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 20
+ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
- 00 00 00 00 00 00 00 00 01 00 01 00 00 00 00 01
- 00 00 00 00 00 00 00 00 02 00 02 00 00 00 00 02
- 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
- 01 01 01 01 01 01 01 00 01 01 01 01 01 01 01 02
- 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
- 02 02 02 02 02 02 02 00 02 02 02 02 02 02 02 00
+ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+</map>
+</ctype>
+
-# to_lower array (must be 256 elements)
+<lower>
+<map>
00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
@@ -33,14 +39,18 @@
70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F
80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
- A0 A1 A2 A3 A4 A5 A6 A7 B8 A9 BA AB AC AD AE BF
+ A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF
B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF
- E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
- F0 F1 F2 F3 F4 F5 F6 D7 F8 F9 FA FB FC FD FE DF
+ C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
+ D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF
E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF
+</map>
+</lower>
+
-# to_upper array (must be 256 elements)
+<upper>
+<map>
00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
@@ -51,22 +61,48 @@
50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F
80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
- A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 BA AB AC AD AE AF
- B0 B1 B2 B3 B4 B5 B6 B7 A8 B9 BA BB BC BD BE AF
+ A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF
+ B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF
C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF
- C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
- D0 D1 D2 D3 D4 D5 D6 F7 D8 D9 DA DB DC DD DE FF
+ E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
+ F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF
+</map>
+</upper>
-# sort_order array (must be 256 elements)
+
+<unicode>
+<map>
+0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F
+0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F
+0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F
+0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F
+0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F
+0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F
+0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F
+0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 0000
+0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000
+0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000
+0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000
+0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000
+0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000
+0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000
+0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000
+0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000
+</map>
+</unicode>
+
+
+<collation name="ascii">
+<map>
00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
- 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F
- 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F
+ 50 51 52 53 54 55 56 57 58 59 5A 5C 5D 5B 5E 5F
+ 45 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
+ 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 59 7F
80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF
@@ -75,22 +111,9 @@
D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF
E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF
+</map>
+</collation>
-# Unicode mapping (must be 256 elements)
- 0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F
- 0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F
- 0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F
- 0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F
- 0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F
- 0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F
- 0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F
- 0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F
- 20AC 0000 201A 0000 201E 2026 2020 2021 0000 2030 0000 2039 0000 00A8 02C7 00B8
- 0000 2018 2019 201C 201D 2022 2013 2014 0000 2122 0000 203A 0000 00AF 02DB 0000
- 00A0 0000 00A2 00A3 00A4 0000 00A6 00A7 00D8 00A9 0156 00AB 00AC 00AD 00AE 00C6
- 00B0 00B1 00B2 00B3 00B4 00B5 00B6 00B7 00F8 00B9 0157 00BB 00BC 00BD 00BE 00E6
- 0104 012E 0100 0106 00C4 00C5 0118 0112 010C 00C9 0179 0116 0122 0136 012A 013B
- 0160 0143 0145 00D3 014C 00D5 00D6 00D7 0172 0141 015A 016A 00DC 017B 017D 00DF
- 0105 012F 0101 0107 00E4 00E5 0119 0113 010D 00E9 017A 0117 0123 0137 012B 013C
- 0161 0144 0146 00F3 014D 00F5 00F6 00F7 0173 0142 015B 016B 00FC 017C 017E 02D9
+</charset>
+</charsets>
diff --git a/sql/share/charsets/win1250.conf b/sql/share/charsets/cp1250.xml
index 0a5b5074bde..a863aceffc9 100644
--- a/sql/share/charsets/win1250.conf
+++ b/sql/share/charsets/cp1250.xml
@@ -1,6 +1,11 @@
-# Configuration file for the win1250 character set.
+<?xml version='1.0' encoding="utf-8"?>
-# The ctype array must have 257 elements.
+<charsets>
+
+<charset name="cp1250">
+
+<ctype>
+<map>
00
20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20
20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
@@ -18,8 +23,12 @@
01 01 01 01 01 01 01 10 01 01 01 01 01 01 01 02
02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
02 02 02 02 02 02 02 10 02 02 02 02 02 02 02 10
+</map>
+</ctype>
+
-# The to_lower array must have 256 elements.
+<lower>
+<map>
00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
@@ -36,8 +45,12 @@
F0 F1 F2 F3 F4 F5 F6 D7 F8 F9 FA FB FC FD FE DF
E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF
+</map>
+</lower>
-# The to_upper array must have 256 elements.
+
+<upper>
+<map>
00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
@@ -54,26 +67,12 @@
D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE A7
C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
D0 D1 D2 D3 D4 D5 D6 F7 D8 D9 DA DB DC DD DE FF
+</map>
+</upper>
-# The sort_order array must have 256 elements.
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 41 42 43 46 49 4A 4B 4C 4D 4E 4F 50 52 53 55
- 56 57 58 59 5B 5C 5D 5E 5F 60 61 63 64 65 66 67
- 68 41 42 43 46 49 4A 4B 4C 4D 4E 4F 50 52 53 55
- 56 57 58 59 5B 5C 5D 5E 5F 60 61 7B 7C 7D 7E 7F
- 80 81 82 83 84 85 86 87 88 89 5A 8B 5A 5B 62 62
- 90 91 92 93 94 95 96 97 98 99 5A 9B 5A 5B 62 62
- 20 A1 A2 50 A4 41 A6 59 A8 A9 59 AB AC AD AE 62
- B0 B1 B2 50 B4 B5 B6 B7 B8 41 59 BB 50 BD 50 62
- 58 41 41 41 41 50 45 43 44 49 49 49 49 4D 4D 46
- 47 53 53 55 55 55 55 D7 58 5C 5C 5C 5C 60 5B 59
- 58 41 41 41 41 50 45 43 44 49 49 49 49 4D 4D 46
- 47 53 53 55 55 55 55 F7 58 5C 5C 5C 5C 60 5B FF
-# Unicode mapping table (256 elements)
+<unicode>
+<map>
0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F
0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F
0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F
@@ -90,3 +89,33 @@
0110 0143 0147 00D3 00D4 0150 00D6 00D7 0158 016E 00DA 0170 00DC 00DD 0162 00DF
0155 00E1 00E2 0103 00E4 013A 0107 00E7 010D 00E9 0119 00EB 011B 00ED 00EE 010F
0111 0144 0148 00F3 00F4 0151 00F6 00F7 0159 016F 00FA 0171 00FC 00FD 0163 02D9
+</map>
+</unicode>
+
+
+<collation name="cp1250">
+<map>
+ 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
+ 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
+ 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
+ 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
+ 40 41 42 43 46 49 4A 4B 4C 4D 4E 4F 50 52 53 55
+ 56 57 58 59 5B 5C 5D 5E 5F 60 61 63 64 65 66 67
+ 68 41 42 43 46 49 4A 4B 4C 4D 4E 4F 50 52 53 55
+ 56 57 58 59 5B 5C 5D 5E 5F 60 61 7B 7C 7D 7E 7F
+ 80 81 82 83 84 85 86 87 88 89 5A 8B 5A 5B 62 62
+ 90 91 92 93 94 95 96 97 98 99 5A 9B 5A 5B 62 62
+ 20 A1 A2 50 A4 41 A6 59 A8 A9 59 AB AC AD AE 62
+ B0 B1 B2 50 B4 B5 B6 B7 B8 41 59 BB 50 BD 50 62
+ 58 41 41 41 41 50 45 43 44 49 49 49 49 4D 4D 46
+ 47 53 53 55 55 55 55 D7 58 5C 5C 5C 5C 60 5B 59
+ 58 41 41 41 41 50 45 43 44 49 49 49 49 4D 4D 46
+ 47 53 53 55 55 55 55 F7 58 5C 5C 5C 5C 60 5B FF
+</map>
+</collation>
+
+<collation name="cp1250_czech"/>
+
+</charset>
+
+</charsets>
diff --git a/sql/share/charsets/cp1251.conf b/sql/share/charsets/cp1251.conf
deleted file mode 100644
index ee72c6e7b27..00000000000
--- a/sql/share/charsets/cp1251.conf
+++ /dev/null
@@ -1,93 +0,0 @@
-# Configuration file for the cp1251 character set
-
-# ctype array (must have 257 elements)
- 00
- 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20
- 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
- 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
- 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10
- 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01
- 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10
- 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02
- 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 00
- 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
- 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
- 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00
- 00 00 00 00 00 00 00 00 02 00 00 00 00 00 00 00
- 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
- 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
- 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
- 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
-
-# to_lower array (must have 256 elements)
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F
- 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F
- 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F
- 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F
- 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
- 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
- A0 A1 A2 A3 A4 A5 A6 A7 B8 A9 AA AB AC AD AE AF
- B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF
- E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
- F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF
- E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
- F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF
-
-# to_upper array (must have 256 elements)
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
- 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F
- 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
- 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
- A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF
- B0 B1 B2 B3 B4 B5 B6 B7 A8 B9 BA BB BC BD BE BF
- C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
- D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF
- C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
- D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF
-
-# sort_order array (must have 256 elements)
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- 50 51 52 53 54 55 56 57 58 59 5A 7C 7D 7E 7F 80
- 81 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- 50 51 52 53 54 55 56 57 58 59 5A 82 83 84 85 FF
- FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
- FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
- FF FF FF FF FF FF FF FF 61 FF FF FF FF FF FF FF
- FF FF FF FF FF FF FF FF 61 FF FF FF FF FF FF FF
- 5B 5C 5D 5E 5F 60 62 63 64 65 66 67 68 69 6A 6B
- 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B
- 5B 5C 5D 5E 5F 60 62 63 64 65 66 67 68 69 6A 6B
- 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B
-
-# Unicode mapping (must be 256 elements)
- 0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F
- 0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F
- 0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F
- 0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F
- 0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F
- 0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F
- 0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F
- 0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F
- 0402 0403 201A 0453 201E 2026 2020 2021 0000 2030 0409 2039 040A 040C 040B 040F
- 0452 2018 2019 201C 201D 2022 2013 2014 0000 2122 0459 203A 045A 045C 045B 045F
- 00A0 040E 045E 0408 00A4 0490 00A6 00A7 0401 00A9 0404 00AB 00AC 00AD 00AE 0407
- 00B0 00B1 0406 0456 0491 00B5 00B6 00B7 0451 2116 0454 00BB 0458 0405 0455 0457
- 0410 0411 0412 0413 0414 0415 0416 0417 0418 0419 041A 041B 041C 041D 041E 041F
- 0420 0421 0422 0423 0424 0425 0426 0427 0428 0429 042A 042B 042C 042D 042E 042F
- 0430 0431 0432 0433 0434 0435 0436 0437 0438 0439 043A 043B 043C 043D 043E 043F
- 0440 0441 0442 0443 0444 0445 0446 0447 0448 0449 044A 044B 044C 044D 044E 044F
-
diff --git a/sql/share/charsets/cp1251cias.conf b/sql/share/charsets/cp1251.xml
index 612be640b11..48c525eb797 100644
--- a/sql/share/charsets/cp1251cias.conf
+++ b/sql/share/charsets/cp1251.xml
@@ -1,12 +1,11 @@
-#
-# cp1251
-# Case insensitive, accent sensitive
-# Sort order is correct for Belarusian, Bulgarian, Macedonian,
-# Russian, Serbian, Mongolian languages. Almost good for Ukrainian,
-# except that "CYRILLIC LETTER SOFT SIGN" is not in the end of alphabet,
-# but between YERU and E.
-#
-# ctype array (must be 257 elements)
+<?xml version='1.0' encoding="utf-8"?>
+
+<charsets>
+
+<charset name="cp1251">
+
+<ctype>
+<map>
00
20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20
20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
@@ -24,8 +23,12 @@
01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
+</map>
+</ctype>
+
-# to_lower array (must be 256 elements)
+<lower>
+<map>
00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
@@ -42,8 +45,12 @@
F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF
E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF
+</map>
+</lower>
-# to_upper array (must be 256 elements)
+
+<upper>
+<map>
00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
@@ -60,26 +67,12 @@
D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF
C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF
+</map>
+</upper>
-# sort_order array (must be 256 elements)
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 41 43 45 47 49 4B 4D 4F 51 53 55 57 59 5B 5D
- 5F 61 63 65 67 69 6B 6D 6F 71 73 D3 D4 D5 D6 D7
- D8 41 43 45 47 49 4B 4D 4F 51 53 55 57 59 5B 5D
- 5F 61 63 65 67 69 6B 6D 6F 71 73 D9 DA DB DC DD
- 81 83 DE 83 DF E0 E1 E2 E3 E4 A1 E5 A7 9D B3 C1
- 81 E6 E7 E8 E9 EA EB EC ED EE A1 EF A7 9D B3 C1
- F0 B7 B7 99 F1 7D F2 F3 87 F4 89 F5 F6 F7 F8 95
- F9 FA 93 93 7D FB FC FD 87 FE 89 FF 99 8F 8F 95
- 75 77 79 7B 7F 85 8B 8D 91 97 9B 9F A3 A5 A9 AB
- AD AF B1 B5 B9 BB BD BF C3 C5 C7 C9 CB CD CF D1
- 75 77 79 7B 7F 85 8B 8D 91 97 9B 9F A3 A5 A9 AB
- AD AF B1 B5 B9 BB BD BF C3 C5 C7 C9 CB CD CF D1
-# Unicode mapping (must be 256 elements)
+<unicode>
+<map>
0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F
0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F
0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F
@@ -97,3 +90,127 @@
0430 0431 0432 0433 0434 0435 0436 0437 0438 0439 043A 043B 043C 043D 043E 043F
0440 0441 0442 0443 0444 0445 0446 0447 0448 0449 044A 044B 044C 044D 044E 044F
+</map>
+</unicode>
+
+
+<collation name="cp1251">
+<map>
+ 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
+ 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
+ 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
+ 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
+ 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
+ 50 51 52 53 54 55 56 57 58 59 5A 7C 7D 7E 7F 80
+ 81 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
+ 50 51 52 53 54 55 56 57 58 59 5A 82 83 84 85 FF
+ FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
+ FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
+ FF FF FF FF FF FF FF FF 61 FF FF FF FF FF FF FF
+ FF FF FF FF FF FF FF FF 61 FF FF FF FF FF FF FF
+ 5B 5C 5D 5E 5F 60 62 63 64 65 66 67 68 69 6A 6B
+ 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B
+ 5B 5C 5D 5E 5F 60 62 63 64 65 66 67 68 69 6A 6B
+ 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B
+</map>
+</collation>
+
+
+<collation name="cp1251_bin">
+<map>
+ 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
+ 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
+ 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
+ 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
+ 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
+ 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
+ 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F
+ 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F
+ 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
+ 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
+ A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF
+ B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF
+ C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
+ D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF
+ E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
+ F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF
+</map>
+</collation>
+
+
+<collation name="cp1251_ci_as">
+<map>
+ 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
+ 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
+ 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
+ 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
+ 40 41 43 45 47 49 4B 4D 4F 51 53 55 57 59 5B 5D
+ 5F 61 63 65 67 69 6B 6D 6F 71 73 D3 D4 D5 D6 D7
+ D8 41 43 45 47 49 4B 4D 4F 51 53 55 57 59 5B 5D
+ 5F 61 63 65 67 69 6B 6D 6F 71 73 D9 DA DB DC DD
+ 81 83 DE 83 DF E0 E1 E2 E3 E4 A1 E5 A7 9D B3 C1
+ 81 E6 E7 E8 E9 EA EB EC ED EE A1 EF A7 9D B3 C1
+ F0 B7 B7 99 F1 7D F2 F3 87 F4 89 F5 F6 F7 F8 95
+ F9 FA 93 93 7D FB FC FD 87 FE 89 FF 99 8F 8F 95
+ 75 77 79 7B 7F 85 8B 8D 91 97 9B 9F A3 A5 A9 AB
+ AD AF B1 B5 B9 BB BD BF C3 C5 C7 C9 CB CD CF D1
+ 75 77 79 7B 7F 85 8B 8D 91 97 9B 9F A3 A5 A9 AB
+ AD AF B1 B5 B9 BB BD BF C3 C5 C7 C9 CB CD CF D1
+</map>
+</collation>
+
+
+<collation name="cp1251_cs_as">
+<!--
+# Case insensitive, accent sensitive
+# Sort order is correct for Belarusian, Bulgarian, Macedonian,
+# Russian, Serbian, Mongolian languages. Almost good for Ukrainian,
+# except that "CYRILLIC LETTER SOFT SIGN" is not in the end of alphabet,
+# but between YERU and E.
+-->
+<map>
+ 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
+ 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
+ 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
+ 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
+ 40 41 43 45 47 49 4B 4D 4F 51 53 55 57 59 5B 5D
+ 5F 61 63 65 67 69 6B 6D 6F 71 73 D3 D4 D5 D6 D7
+ D8 42 44 46 48 4A 4C 4E 50 52 54 56 58 5A 5C 5E
+ 60 62 64 66 68 6A 6C 6E 70 72 74 D9 DA DB DC DD
+ 81 83 DE 84 DF E0 E1 E2 E3 E4 A1 E5 A7 9D B3 C1
+ 82 E6 E7 E8 E9 EA EB EC ED EE A2 EF A8 9E B4 C2
+ F0 B7 B8 99 F1 7D F2 F3 87 F4 89 F5 F6 F7 F8 95
+ F9 FA 93 94 7E FB FC FD 88 FE 8A FF 9A 8F 90 96
+ 75 77 79 7B 7F 85 8B 8D 91 97 9B 9F A3 A5 A9 AB
+ AD AF B1 B5 B9 BB BD BF C3 C5 C7 C9 CB CD CF D1
+ 76 78 7A 7C 80 86 8C 8E 92 98 9C A0 A4 A6 AA AC
+ AE B0 B2 B6 BA BC BE C0 C4 C6 C8 CA CC CE D0 D2
+</map>
+</collation>
+
+
+<collation name="win1251ukr">
+<map>
+ 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
+ 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
+ 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
+ 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
+ 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
+ 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
+ 20 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
+ 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F
+ A5 A6 A7 A8 A9 AA AB AC AD AE AF B0 B1 B2 B3 B4
+ B5 B6 B7 B8 B9 BA BB BC BD BE BF C0 C1 C2 C3 C4
+ C5 C6 C7 C8 C9 84 CA CB 88 CC 87 CD CE CF D0 8D
+ D1 D2 8C 8C 84 D3 D4 D5 88 D6 87 D7 D8 D9 DA 8D
+ 80 81 82 83 85 86 89 8A 8B 8E 8F 90 91 92 93 94
+ 95 96 97 98 99 9A 9B 9C 9D 9E 9F A0 A1 A2 A3 A4
+ 80 81 82 83 85 86 89 8A 8B 8E 8F 90 91 92 93 94
+ 95 96 97 98 99 9A 9B 9C 9D 9E 9F A0 A1 A2 A3 A4
+</map>
+</collation>
+
+
+</charset>
+
+</charsets>
diff --git a/sql/share/charsets/cp1251bin.conf b/sql/share/charsets/cp1251bin.conf
deleted file mode 100644
index 4c17fee5934..00000000000
--- a/sql/share/charsets/cp1251bin.conf
+++ /dev/null
@@ -1,95 +0,0 @@
-#
-# cp1251
-# Binary sort order
-#
-# ctype array (must be 257 elements)
- 00
- 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20
- 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
- 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
- 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10
- 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01
- 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10
- 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02
- 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 00
- 01 01 00 02 00 00 00 00 00 00 01 00 01 01 01 01
- 02 00 00 00 00 00 00 00 00 00 02 00 02 02 02 02
- 00 01 02 01 00 01 00 00 01 00 01 00 00 00 00 01
- 00 00 01 02 02 00 00 00 02 00 02 00 02 01 02 02
- 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
- 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
- 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
- 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
-
-# to_lower array (must be 256 elements)
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F
- 70 71 72 73 54 75 76 77 78 79 7A 5B 5C 5D 5E 5F
- 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F
- 70 71 72 73 54 75 76 77 78 79 7A 7B 7C 7D 7E 7F
- 90 83 82 83 84 85 86 87 88 89 9A 8B 9C 9D 9E 9F
- 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
- A0 A2 A2 BC A4 B4 A6 A7 B8 A9 BA AB AC AD AE BF
- B0 B1 B3 B3 B4 B5 B6 B7 B8 B9 BA BB BC BE BE BF
- E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
- F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF
- E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
- F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF
-
-# to_upper array (must be 256 elements)
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- 50 51 52 53 74 55 56 57 58 59 5A 5B 5C 5D 5E 5F
- 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- 50 51 52 53 74 55 56 57 58 59 5A 7B 7C 7D 7E 7F
- 80 81 82 81 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
- 80 91 92 93 94 95 96 97 98 99 8A 9B 8C 9D 8E 8F
- A0 A1 A1 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF
- B0 B1 B2 B2 A5 B5 B6 B7 A8 B9 AA BB A3 BD BD AF
- C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
- D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF
- C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
- D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF
-
-# sort_order array (must be 256 elements)
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
- 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F
- 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F
- 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
- 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
- A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF
- B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF
- C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
- D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF
- E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
- F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF
-
-# Unicode mapping (must be 256 elements)
- 0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F
- 0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F
- 0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F
- 0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F
- 0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F
- 0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F
- 0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F
- 0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F
- 0402 0403 201A 0453 201E 2026 2020 2021 0000 2030 0409 2039 040A 040C 040B 040F
- 0452 2018 2019 201C 201D 2022 2013 2014 0000 2122 0459 203A 045A 045C 045B 045F
- 00A0 040E 045E 0408 00A4 0490 00A6 00A7 0401 00A9 0404 00AB 00AC 00AD 00AE 0407
- 00B0 00B1 0406 0456 0491 00B5 00B6 00B7 0451 2116 0454 00BB 0458 0405 0455 0457
- 0410 0411 0412 0413 0414 0415 0416 0417 0418 0419 041A 041B 041C 041D 041E 041F
- 0420 0421 0422 0423 0424 0425 0426 0427 0428 0429 042A 042B 042C 042D 042E 042F
- 0430 0431 0432 0433 0434 0435 0436 0437 0438 0439 043A 043B 043C 043D 043E 043F
- 0440 0441 0442 0443 0444 0445 0446 0447 0448 0449 044A 044B 044C 044D 044E 044F
-
diff --git a/sql/share/charsets/cp1251csas.conf b/sql/share/charsets/cp1251csas.conf
deleted file mode 100644
index b6b2f853ea9..00000000000
--- a/sql/share/charsets/cp1251csas.conf
+++ /dev/null
@@ -1,99 +0,0 @@
-#
-# cp1251
-# Case sensitive, accent sensitive
-# Sort order is correct for Belarusian, Bulgarian, Macedonian,
-# Russian, Serbian, Mongolian languages. Almost good for Ukrainian,
-# except that "CYRILLIC LETTER SOFT SIGN" is not in the end of alphabet,
-# but between YERU and E.
-#
-# ctype array (must be 257 elements)
- 00
- 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20
- 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
- 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
- 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10
- 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01
- 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10
- 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02
- 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 00
- 01 01 00 02 00 00 00 00 00 00 01 00 01 01 01 01
- 02 00 00 00 00 00 00 00 00 00 02 00 02 02 02 02
- 00 01 02 01 00 01 00 00 01 00 01 00 00 00 00 01
- 00 00 01 02 02 00 00 00 02 00 02 00 02 01 02 02
- 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
- 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
- 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
- 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
-
-# to_lower array (must be 256 elements)
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F
- 70 71 72 73 54 75 76 77 78 79 7A 5B 5C 5D 5E 5F
- 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F
- 70 71 72 73 54 75 76 77 78 79 7A 7B 7C 7D 7E 7F
- 90 83 82 83 84 85 86 87 88 89 9A 8B 9C 9D 9E 9F
- 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
- A0 A2 A2 BC A4 B4 A6 A7 B8 A9 BA AB AC AD AE BF
- B0 B1 B3 B3 B4 B5 B6 B7 B8 B9 BA BB BC BE BE BF
- E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
- F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF
- E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
- F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF
-
-# to_upper array (must be 256 elements)
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- 50 51 52 53 74 55 56 57 58 59 5A 5B 5C 5D 5E 5F
- 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- 50 51 52 53 74 55 56 57 58 59 5A 7B 7C 7D 7E 7F
- 80 81 82 81 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
- 80 91 92 93 94 95 96 97 98 99 8A 9B 8C 9D 8E 8F
- A0 A1 A1 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF
- B0 B1 B2 B2 A5 B5 B6 B7 A8 B9 AA BB A3 BD BD AF
- C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
- D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF
- C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
- D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF
-
-# sort_order array (must be 256 elements)
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 41 43 45 47 49 4B 4D 4F 51 53 55 57 59 5B 5D
- 5F 61 63 65 67 69 6B 6D 6F 71 73 D3 D4 D5 D6 D7
- D8 42 44 46 48 4A 4C 4E 50 52 54 56 58 5A 5C 5E
- 60 62 64 66 68 6A 6C 6E 70 72 74 D9 DA DB DC DD
- 81 83 DE 84 DF E0 E1 E2 E3 E4 A1 E5 A7 9D B3 C1
- 82 E6 E7 E8 E9 EA EB EC ED EE A2 EF A8 9E B4 C2
- F0 B7 B8 99 F1 7D F2 F3 87 F4 89 F5 F6 F7 F8 95
- F9 FA 93 94 7E FB FC FD 88 FE 8A FF 9A 8F 90 96
- 75 77 79 7B 7F 85 8B 8D 91 97 9B 9F A3 A5 A9 AB
- AD AF B1 B5 B9 BB BD BF C3 C5 C7 C9 CB CD CF D1
- 76 78 7A 7C 80 86 8C 8E 92 98 9C A0 A4 A6 AA AC
- AE B0 B2 B6 BA BC BE C0 C4 C6 C8 CA CC CE D0 D2
-
-# Unicode mapping (must be 256 elements)
- 0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F
- 0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F
- 0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F
- 0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F
- 0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F
- 0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F
- 0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F
- 0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F
- 0402 0403 201A 0453 201E 2026 2020 2021 0000 2030 0409 2039 040A 040C 040B 040F
- 0452 2018 2019 201C 201D 2022 2013 2014 0000 2122 0459 203A 045A 045C 045B 045F
- 00A0 040E 045E 0408 00A4 0490 00A6 00A7 0401 00A9 0404 00AB 00AC 00AD 00AE 0407
- 00B0 00B1 0406 0456 0491 00B5 00B6 00B7 0451 2116 0454 00BB 0458 0405 0455 0457
- 0410 0411 0412 0413 0414 0415 0416 0417 0418 0419 041A 041B 041C 041D 041E 041F
- 0420 0421 0422 0423 0424 0425 0426 0427 0428 0429 042A 042B 042C 042D 042E 042F
- 0430 0431 0432 0433 0434 0435 0436 0437 0438 0439 043A 043B 043C 043D 043E 043F
- 0440 0441 0442 0443 0444 0445 0446 0447 0448 0449 044A 044B 044C 044D 044E 044F
-
diff --git a/sql/share/charsets/cp1256.conf b/sql/share/charsets/cp1256.xml
index 6072551813c..4947839a728 100644
--- a/sql/share/charsets/cp1256.conf
+++ b/sql/share/charsets/cp1256.xml
@@ -1,7 +1,13 @@
-#
-# Arabic, Persian, Pakistani, Urdu
-#
-# ctype array (must be 257 elements)
+<?xml version='1.0' encoding="utf-8"?>
+
+<!-- Arabic, Persian, Pakistani, Urdu -->
+
+<charsets>
+
+<charset name="">
+
+<ctype>
+<map>
00
20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20
20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
@@ -19,8 +25,12 @@
03 03 03 03 03 03 03 00 03 03 03 03 03 03 03 03
02 03 02 03 03 03 03 02 02 02 02 02 03 03 02 02
03 03 03 03 02 03 03 00 03 02 03 02 02 00 00 00
+</map>
+</ctype>
+
-# to_lower array (must be 256 elements)
+<lower>
+<map>
00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
@@ -37,8 +47,12 @@
D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF
E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF
+</map>
+</lower>
+
-# to_upper array (must be 256 elements)
+<upper>
+<map>
00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
@@ -55,26 +69,12 @@
D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF
E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF
+</map>
+</upper>
-# sort_order array (must be 256 elements)
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 41 45 47 4A 4C 52 55 57 59 5D 5F 61 63 65 67
- 6C 6E 70 72 74 76 7B 7D 7F 81 83 B9 BA BB BC BD
- BE 41 45 47 4A 4C 52 55 57 59 5D 5F 61 63 65 67
- 6C 6E 70 72 74 76 7B 7D 7F 81 83 BF C0 C1 C2 C3
- C4 8E C5 54 C6 C7 C8 C9 CA CB CC CD 6A 92 99 CE
- A5 CF D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 6A DA DB DC
- DD B6 DE DF E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB
- EC ED EE EF F0 F1 F2 F3 F4 F5 B7 F6 F7 F8 F9 B8
- FA 85 86 87 88 89 8A 8B 8C 8D 9F 90 91 93 94 95
- 96 97 98 9A 9B 9C 9D FB 9E 9F A0 A1 AD A2 A3 A4
- 43 A6 44 A7 A8 A9 AA 49 4E 4F 50 51 AB AC 5B 5C
- AE AF B0 B1 69 B2 B3 FC B4 78 B5 79 7A FD FE FF
-# Unicode mapping (must be 256 elements)
+<unicode>
+<map>
0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F
0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F
0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F
@@ -91,4 +91,33 @@
0630 0631 0632 0633 0634 0635 0636 00D7 0637 0638 0639 063A 0640 0641 0642 0643
00E0 0644 00E2 0645 0646 0647 0648 00E7 00E8 00E9 00EA 00EB 0649 064A 00EE 00EF
064B 064C 064D 064E 00F4 064F 0650 00F7 0651 00F9 0652 00FB 00FC 200E 200F 0000
+</map>
+</unicode>
+
+
+<collation name="cp1256">
+<map>
+ 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
+ 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
+ 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
+ 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
+ 40 41 45 47 4A 4C 52 55 57 59 5D 5F 61 63 65 67
+ 6C 6E 70 72 74 76 7B 7D 7F 81 83 B9 BA BB BC BD
+ BE 41 45 47 4A 4C 52 55 57 59 5D 5F 61 63 65 67
+ 6C 6E 70 72 74 76 7B 7D 7F 81 83 BF C0 C1 C2 C3
+ C4 8E C5 54 C6 C7 C8 C9 CA CB CC CD 6A 92 99 CE
+ A5 CF D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 6A DA DB DC
+ DD B6 DE DF E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB
+ EC ED EE EF F0 F1 F2 F3 F4 F5 B7 F6 F7 F8 F9 B8
+ FA 85 86 87 88 89 8A 8B 8C 8D 9F 90 91 93 94 95
+ 96 97 98 9A 9B 9C 9D FB 9E 9F A0 A1 AD A2 A3 A4
+ 43 A6 44 A7 A8 A9 AA 49 4E 4F 50 51 AB AC 5B 5C
+ AE AF B0 B1 69 B2 B3 FC B4 78 B5 79 7A FD FE FF
+</map>
+</collation>
+
+
+</charset>
+
+</charsets>
diff --git a/sql/share/charsets/cp1257.conf b/sql/share/charsets/cp1257.conf
deleted file mode 100644
index 8338f99c83b..00000000000
--- a/sql/share/charsets/cp1257.conf
+++ /dev/null
@@ -1,92 +0,0 @@
-# Configuration file for the cp1257 character set.
-
-# The ctype array must have 257 elements.
- 00
- 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20
- 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
- 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
- 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10
- 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01
- 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10
- 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02
- 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 00
- 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
- 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
- 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
- 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
- 01 01 00 00 00 00 01 00 01 00 00 01 00 00 00 00
- 01 00 00 00 00 00 00 00 01 00 00 01 00 00 01 00
- 02 02 00 00 00 00 02 00 02 00 00 02 00 00 00 00
- 02 00 00 00 00 00 00 00 02 00 00 02 00 00 02 00
-
-# The to_lower array must have 256 elements.
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F
- 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F
- 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F
- 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F
- 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
- 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
- A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF
- B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF
- E0 E1 C2 C3 C4 C5 E6 C7 E8 C9 CA EB CC CD CE CF
- F0 D1 D2 D3 D4 D5 D6 D7 F8 D9 DA FB DC DD FE DF
- E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
- F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF
-
-# The to_upper array must have 256 elements.
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
- 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F
- 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
- 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
- A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF
- B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF
- C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
- D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF
- C0 C1 E2 E3 E4 E5 C6 E7 C8 E9 EA CB EC ED EE EF
- D0 F1 F2 F3 F4 F5 F6 F7 D8 F9 FA DB FC FD DE FF
-
-# The sort_order array must have 256 elements.
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 41 43 44 46 47 4A 4B 4C 4D 50 51 52 53 54 55
- 56 57 58 59 5B 5C 5F 60 61 4E FF 62 63 64 65 66
- 67 41 43 44 46 47 4A 4B 4C 4D 50 51 52 53 54 55
- 56 57 58 59 5B 5C 5F 60 61 4E FF 68 69 6A 6B FF
- FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
- FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
- FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
- FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
- 42 4F FF FF FF FF 48 FF 45 FF FF 49 FF FF FF FF
- 5A FF FF FF FF FF FF FF 5E FF FF 5D FF FF FF FF
- FF 4F FF FF FF FF 48 FF 45 FF FF 49 FF FF FF FF
- 5A FF FF FF FF FF FF FF 5E FF FF 5D FF FF FF FF
-
-# Unicode mapping (256 elements)
-0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F
-0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F
-0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F
-0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F
-0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F
-0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F
-0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F
-0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F
-20AC 0000 201A 0000 201E 2026 2020 2021 0000 2030 0000 2039 0000 00A8 02C7 00B8
-0000 2018 2019 201C 201D 2022 2013 2014 0000 2122 0000 203A 0000 00AF 02DB 0000
-00A0 0000 00A2 00A3 00A4 0000 00A6 00A7 00D8 00A9 0156 00AB 00AC 00AD 00AE 00C6
-00B0 00B1 00B2 00B3 00B4 00B5 00B6 00B7 00F8 00B9 0157 00BB 00BC 00BD 00BE 00E6
-0104 012E 0100 0106 00C4 00C5 0118 0112 010C 00C9 0179 0116 0122 0136 012A 013B
-0160 0143 0145 00D3 014C 00D5 00D6 00D7 0172 0141 015A 016A 00DC 017B 017D 00DF
-0105 012F 0101 0107 00E4 00E5 0119 0113 010D 00E9 017A 0117 0123 0137 012B 013C
-0161 0144 0146 00F3 014D 00F5 00F6 00F7 0173 0142 015B 016B 00FC 017C 017E 02D9
diff --git a/sql/share/charsets/cp1257.xml b/sql/share/charsets/cp1257.xml
new file mode 100644
index 00000000000..5ac2b746ff9
--- /dev/null
+++ b/sql/share/charsets/cp1257.xml
@@ -0,0 +1,229 @@
+<?xml version='1.0' encoding="utf-8"?>
+
+<charsets>
+
+<charset name="cp1257">
+
+<ctype>
+<map>
+ 00
+ 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20
+ 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
+ 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
+ 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10
+ 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01
+ 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10
+ 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02
+ 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 00
+ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+ 00 00 00 00 00 00 00 00 01 00 01 00 00 00 00 01
+ 00 00 00 00 00 00 00 00 02 00 02 00 00 00 00 02
+ 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
+ 01 01 01 01 01 01 01 00 01 01 01 01 01 01 01 02
+ 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
+ 02 02 02 02 02 02 02 00 02 02 02 02 02 02 02 00
+</map>
+</ctype>
+
+
+<lower>
+<map>
+ 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
+ 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
+ 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
+ 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
+ 40 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F
+ 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F
+ 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F
+ 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F
+ 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
+ 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
+ A0 A1 A2 A3 A4 A5 A6 A7 B8 A9 BA AB AC AD AE BF
+ B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF
+ E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
+ F0 F1 F2 F3 F4 F5 F6 D7 F8 F9 FA FB FC FD FE DF
+ E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
+ F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF
+</map>
+</lower>
+
+
+<upper>
+<map>
+ 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
+ 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
+ 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
+ 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
+ 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
+ 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
+ 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
+ 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F
+ 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
+ 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
+ A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 BA AB AC AD AE AF
+ B0 B1 B2 B3 B4 B5 B6 B7 A8 B9 BA BB BC BD BE AF
+ C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
+ D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF
+ C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
+ D0 D1 D2 D3 D4 D5 D6 F7 D8 D9 DA DB DC DD DE FF
+</map>
+</upper>
+
+
+<unicode>
+<map>
+ 0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F
+ 0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F
+ 0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F
+ 0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F
+ 0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F
+ 0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F
+ 0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F
+ 0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F
+ 20AC 0000 201A 0000 201E 2026 2020 2021 0000 2030 0000 2039 0000 00A8 02C7 00B8
+ 0000 2018 2019 201C 201D 2022 2013 2014 0000 2122 0000 203A 0000 00AF 02DB 0000
+ 00A0 0000 00A2 00A3 00A4 0000 00A6 00A7 00D8 00A9 0156 00AB 00AC 00AD 00AE 00C6
+ 00B0 00B1 00B2 00B3 00B4 00B5 00B6 00B7 00F8 00B9 0157 00BB 00BC 00BD 00BE 00E6
+ 0104 012E 0100 0106 00C4 00C5 0118 0112 010C 00C9 0179 0116 0122 0136 012A 013B
+ 0160 0143 0145 00D3 014C 00D5 00D6 00D7 0172 0141 015A 016A 00DC 017B 017D 00DF
+ 0105 012F 0101 0107 00E4 00E5 0119 0113 010D 00E9 017A 0117 0123 0137 012B 013C
+ 0161 0144 0146 00F3 014D 00F5 00F6 00F7 0173 0142 015B 016B 00FC 017C 017E 02D9
+</map>
+</unicode>
+
+
+<collation name="cp1257">
+<map>
+ 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
+ 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
+ 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
+ 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
+ 40 41 43 44 46 47 4A 4B 4C 4D 50 51 52 53 54 55
+ 56 57 58 59 5B 5C 5F 60 61 4E FF 62 63 64 65 66
+ 67 41 43 44 46 47 4A 4B 4C 4D 50 51 52 53 54 55
+ 56 57 58 59 5B 5C 5F 60 61 4E FF 68 69 6A 6B FF
+ FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
+ FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
+ FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
+ FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
+ 42 4F FF FF FF FF 48 FF 45 FF FF 49 FF FF FF FF
+ 5A FF FF FF FF FF FF FF 5E FF FF 5D FF FF FF FF
+ FF 4F FF FF FF FF 48 FF 45 FF FF 49 FF FF FF FF
+ 5A FF FF FF FF FF FF FF 5E FF FF 5D FF FF FF FF
+</map>
+</collation>
+
+
+<collation name="cp1257_bin">
+<map>
+ 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
+ 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
+ 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
+ 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
+ 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
+ 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
+ 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F
+ 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F
+ 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
+ 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
+ A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF
+ B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF
+ C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
+ D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF
+ E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
+ F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF
+</map>
+</collation>
+
+
+<collation name="cp1257_ci_ai">
+<map>
+ 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
+ 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
+ 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
+ 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
+ 40 41 4D 4F 55 57 61 63 67 69 6F 71 75 7B 7D 83
+ 8F 91 93 97 9E A0 A8 AA AC AE B0 B8 B9 BA BB BC
+ BD 41 4D 4F 55 57 61 63 67 69 6F 71 75 7B 7D 83
+ 8F 91 93 97 9E A0 A8 AA AC AE B0 BE BF C0 C1 C4
+ C5 C6 C7 C8 C9 CA CB CC CD CE CF D0 D1 D2 D3 D4
+ D5 D6 D7 D8 D9 DA DB DC DD DE DF E0 E1 E2 E3 E4
+ E5 E6 E7 E8 E9 EA EB EC 83 ED 93 EE EF F0 F1 41
+ F2 F3 F4 F5 F6 F7 F8 F9 83 FA 93 FB FC FD FE 41
+ 41 69 41 4F 41 41 57 57 4F 57 B0 57 63 71 69 75
+ 97 7D 7D 83 83 83 83 C2 A0 75 97 A0 A0 B0 B0 97
+ 41 69 41 4F 41 41 57 57 4F 57 B0 57 63 71 69 75
+ 97 7D 7D 83 83 83 83 C3 A0 75 97 A0 A0 B0 B0 FF
+</map>
+</collation>
+
+
+<collation name="cp1257_ci_as">
+<map>
+ 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
+ 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
+ 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
+ 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
+ 40 41 4D 4F 55 57 61 63 67 69 6F 71 75 7B 7D 83
+ 8F 91 93 97 9E A0 A8 AA AC AE B0 B8 B9 BA BB BC
+ BD 41 4D 4F 55 57 61 63 67 69 6F 71 75 7B 7D 83
+ 8F 91 93 97 9E A0 A8 AA AC AE B0 BE BF C0 C1 C4
+ C5 C6 C7 C8 C9 CA CB CC CD CE CF D0 D1 D2 D3 D4
+ D5 D6 D7 D8 D9 DA DB DC DD DE DF E0 E1 E2 E3 E4
+ E5 E6 E7 E8 E9 EA EB EC 85 ED 95 EE EF F0 F1 4B
+ F2 F3 F4 F5 F6 F7 F8 F9 85 FA 95 FB FC FD FE 4B
+ 43 6B 45 51 47 49 59 5B 53 5D B2 5F 65 73 6D 77
+ 99 7F 81 87 89 8B 8D C2 A2 79 9B A4 A6 B4 B6 9D
+ 43 6B 45 51 47 49 59 5B 53 5D B2 5F 65 73 6D 77
+ 99 7F 81 87 89 8B 8D C3 A2 79 9B A4 A6 B4 B6 FF
+</map>
+</collation>
+
+
+<collation name="cp1257_cs_as">
+<map>
+ 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
+ 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
+ 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
+ 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
+ 40 41 4D 4F 55 57 61 63 67 69 6F 71 75 7B 7D 83
+ 8F 91 93 97 9E A0 A8 AA AC AE B0 B8 B9 BA BB BC
+ BD 42 4E 50 56 58 62 64 68 6A 70 72 76 7C 7E 84
+ 90 92 94 98 9F A1 A9 AB AD AF B1 BE BF C0 C1 C4
+ C5 C6 C7 C8 C9 CA CB CC CD CE CF D0 D1 D2 D3 D4
+ D5 D6 D7 D8 D9 DA DB DC DD DE DF E0 E1 E2 E3 E4
+ E5 E6 E7 E8 E9 EA EB EC 85 ED 95 EE EF F0 F1 4B
+ F2 F3 F4 F5 F6 F7 F8 F9 86 FA 96 FB FC FD FE 4C
+ 43 6B 45 51 47 49 59 5B 53 5D B2 5F 65 73 6D 77
+ 99 7F 81 87 89 8B 8D C2 A2 79 9B A4 A6 B4 B6 9D
+ 44 6C 46 52 48 4A 5A 5C 54 5E B3 60 66 74 6E 78
+ 9A 80 82 88 8A 8C 8E C3 A3 7A 9C A5 A7 B5 B7 FF
+</map>
+</collation>
+
+
+<collation name="cp1257ltlv">
+<map>
+ 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
+ 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
+ 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
+ 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
+ 40 41 47 49 4D 4F 57 59 5D 5F 65 67 6B 6F 71 75
+ 79 7B 7D 81 85 87 8D 8F 91 93 95 FF FF FF FF FF
+ FF 42 48 4A 4E 50 58 5A 5E 60 66 68 6C 70 72 76
+ 7A 7C 7E 82 86 88 8E 90 92 94 96 FF FF FF FF FF
+ FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
+ FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
+ FF FF FF FF FF FF FF FF FF FF 7F FF FF FF FF FF
+ FF FF FF FF FF FF FF FF FF FF 80 FF FF FF FF FF
+ 45 63 43 FF FF FF 53 51 4B FF FF 55 5B 69 61 6D
+ 83 FF 73 FF 77 FF FF FF 8B FF FF 89 FF 99 97 FF
+ 46 64 44 FF FF FF 54 52 4C FF FF 56 5C 6A 62 6E
+ 84 FF 74 FF 78 FF FF FF 8C FF FF 8A FF 9A 98 FF
+</map>
+</collation>
+
+</charset>
+
+</charsets>
diff --git a/sql/share/charsets/cp1257ltlvciai.conf b/sql/share/charsets/cp1257ltlvciai.conf
deleted file mode 100644
index 246ae4d1fe8..00000000000
--- a/sql/share/charsets/cp1257ltlvciai.conf
+++ /dev/null
@@ -1,97 +0,0 @@
-#
-# cp1257 character set
-#
-# Case-insensitive, accent insensitive sorting order
-# For Latvian and Lithuanian languages
-#
-# ctype array (must be 257 elements)
- 00
- 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20
- 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
- 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
- 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10
- 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01
- 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10
- 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02
- 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 00
- 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
- 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
- 00 00 00 00 00 00 00 00 01 00 01 00 00 00 00 01
- 00 00 00 00 00 00 00 00 02 00 02 00 00 00 00 02
- 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
- 01 01 01 01 01 01 01 00 01 01 01 01 01 01 01 02
- 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
- 02 02 02 02 02 02 02 00 02 02 02 02 02 02 02 00
-
-# to_lower array (must be 256 elements)
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F
- 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F
- 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F
- 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F
- 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
- 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
- A0 A1 A2 A3 A4 A5 A6 A7 B8 A9 BA AB AC AD AE BF
- B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF
- E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
- F0 F1 F2 F3 F4 F5 F6 D7 F8 F9 FA FB FC FD FE DF
- E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
- F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF
-
-# to_upper array (must be 256 elements)
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
- 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F
- 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
- 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
- A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 BA AB AC AD AE AF
- B0 B1 B2 B3 B4 B5 B6 B7 A8 B9 BA BB BC BD BE AF
- C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
- D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF
- C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
- D0 D1 D2 D3 D4 D5 D6 F7 D8 D9 DA DB DC DD DE FF
-
-# sort_order array (must be 256 elements)
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 41 4D 4F 55 57 61 63 67 69 6F 71 75 7B 7D 83
- 8F 91 93 97 9E A0 A8 AA AC AE B0 B8 B9 BA BB BC
- BD 41 4D 4F 55 57 61 63 67 69 6F 71 75 7B 7D 83
- 8F 91 93 97 9E A0 A8 AA AC AE B0 BE BF C0 C1 C4
- C5 C6 C7 C8 C9 CA CB CC CD CE CF D0 D1 D2 D3 D4
- D5 D6 D7 D8 D9 DA DB DC DD DE DF E0 E1 E2 E3 E4
- E5 E6 E7 E8 E9 EA EB EC 83 ED 93 EE EF F0 F1 41
- F2 F3 F4 F5 F6 F7 F8 F9 83 FA 93 FB FC FD FE 41
- 41 69 41 4F 41 41 57 57 4F 57 B0 57 63 71 69 75
- 97 7D 7D 83 83 83 83 C2 A0 75 97 A0 A0 B0 B0 97
- 41 69 41 4F 41 41 57 57 4F 57 B0 57 63 71 69 75
- 97 7D 7D 83 83 83 83 C3 A0 75 97 A0 A0 B0 B0 FF
-
-# Unicode mapping (must be 256 elements)
- 0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F
- 0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F
- 0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F
- 0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F
- 0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F
- 0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F
- 0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F
- 0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F
- 20AC 0000 201A 0000 201E 2026 2020 2021 0000 2030 0000 2039 0000 00A8 02C7 00B8
- 0000 2018 2019 201C 201D 2022 2013 2014 0000 2122 0000 203A 0000 00AF 02DB 0000
- 00A0 0000 00A2 00A3 00A4 0000 00A6 00A7 00D8 00A9 0156 00AB 00AC 00AD 00AE 00C6
- 00B0 00B1 00B2 00B3 00B4 00B5 00B6 00B7 00F8 00B9 0157 00BB 00BC 00BD 00BE 00E6
- 0104 012E 0100 0106 00C4 00C5 0118 0112 010C 00C9 0179 0116 0122 0136 012A 013B
- 0160 0143 0145 00D3 014C 00D5 00D6 00D7 0172 0141 015A 016A 00DC 017B 017D 00DF
- 0105 012F 0101 0107 00E4 00E5 0119 0113 010D 00E9 017A 0117 0123 0137 012B 013C
- 0161 0144 0146 00F3 014D 00F5 00F6 00F7 0173 0142 015B 016B 00FC 017C 017E 02D9
-
diff --git a/sql/share/charsets/cp1257ltlvcias.conf b/sql/share/charsets/cp1257ltlvcias.conf
deleted file mode 100644
index 6e49f5a245d..00000000000
--- a/sql/share/charsets/cp1257ltlvcias.conf
+++ /dev/null
@@ -1,97 +0,0 @@
-#
-# cp1257 character set
-#
-# Case-insensitive, accent sensitive sorting order
-# For Latvian and Lithuanian languages
-#
-# ctype array (must be 257 elements)
- 00
- 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20
- 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
- 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
- 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10
- 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01
- 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10
- 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02
- 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 00
- 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
- 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
- 00 00 00 00 00 00 00 00 01 00 01 00 00 00 00 01
- 00 00 00 00 00 00 00 00 02 00 02 00 00 00 00 02
- 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
- 01 01 01 01 01 01 01 00 01 01 01 01 01 01 01 02
- 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
- 02 02 02 02 02 02 02 00 02 02 02 02 02 02 02 00
-
-# to_lower array (must be 256 elements)
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F
- 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F
- 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F
- 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F
- 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
- 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
- A0 A1 A2 A3 A4 A5 A6 A7 B8 A9 BA AB AC AD AE BF
- B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF
- E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
- F0 F1 F2 F3 F4 F5 F6 D7 F8 F9 FA FB FC FD FE DF
- E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
- F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF
-
-# to_upper array (must be 256 elements)
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
- 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F
- 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
- 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
- A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 BA AB AC AD AE AF
- B0 B1 B2 B3 B4 B5 B6 B7 A8 B9 BA BB BC BD BE AF
- C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
- D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF
- C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
- D0 D1 D2 D3 D4 D5 D6 F7 D8 D9 DA DB DC DD DE FF
-
-# sort_order array (must be 256 elements)
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 41 4D 4F 55 57 61 63 67 69 6F 71 75 7B 7D 83
- 8F 91 93 97 9E A0 A8 AA AC AE B0 B8 B9 BA BB BC
- BD 41 4D 4F 55 57 61 63 67 69 6F 71 75 7B 7D 83
- 8F 91 93 97 9E A0 A8 AA AC AE B0 BE BF C0 C1 C4
- C5 C6 C7 C8 C9 CA CB CC CD CE CF D0 D1 D2 D3 D4
- D5 D6 D7 D8 D9 DA DB DC DD DE DF E0 E1 E2 E3 E4
- E5 E6 E7 E8 E9 EA EB EC 85 ED 95 EE EF F0 F1 4B
- F2 F3 F4 F5 F6 F7 F8 F9 85 FA 95 FB FC FD FE 4B
- 43 6B 45 51 47 49 59 5B 53 5D B2 5F 65 73 6D 77
- 99 7F 81 87 89 8B 8D C2 A2 79 9B A4 A6 B4 B6 9D
- 43 6B 45 51 47 49 59 5B 53 5D B2 5F 65 73 6D 77
- 99 7F 81 87 89 8B 8D C3 A2 79 9B A4 A6 B4 B6 FF
-
-# Unicode mapping (must be 256 elements)
- 0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F
- 0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F
- 0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F
- 0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F
- 0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F
- 0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F
- 0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F
- 0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F
- 20AC 0000 201A 0000 201E 2026 2020 2021 0000 2030 0000 2039 0000 00A8 02C7 00B8
- 0000 2018 2019 201C 201D 2022 2013 2014 0000 2122 0000 203A 0000 00AF 02DB 0000
- 00A0 0000 00A2 00A3 00A4 0000 00A6 00A7 00D8 00A9 0156 00AB 00AC 00AD 00AE 00C6
- 00B0 00B1 00B2 00B3 00B4 00B5 00B6 00B7 00F8 00B9 0157 00BB 00BC 00BD 00BE 00E6
- 0104 012E 0100 0106 00C4 00C5 0118 0112 010C 00C9 0179 0116 0122 0136 012A 013B
- 0160 0143 0145 00D3 014C 00D5 00D6 00D7 0172 0141 015A 016A 00DC 017B 017D 00DF
- 0105 012F 0101 0107 00E4 00E5 0119 0113 010D 00E9 017A 0117 0123 0137 012B 013C
- 0161 0144 0146 00F3 014D 00F5 00F6 00F7 0173 0142 015B 016B 00FC 017C 017E 02D9
-
diff --git a/sql/share/charsets/cp1257ltlvcsas.conf b/sql/share/charsets/cp1257ltlvcsas.conf
deleted file mode 100644
index 32cd1390bd5..00000000000
--- a/sql/share/charsets/cp1257ltlvcsas.conf
+++ /dev/null
@@ -1,97 +0,0 @@
-#
-# cp1257 character set
-#
-# Case-sensitive, accent sensitive sorting order
-# For Latvian and Lithuanian languages
-#
-# ctype array (must be 257 elements)
- 00
- 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20
- 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
- 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
- 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10
- 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01
- 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10
- 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02
- 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 00
- 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
- 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
- 00 00 00 00 00 00 00 00 01 00 01 00 00 00 00 01
- 00 00 00 00 00 00 00 00 02 00 02 00 00 00 00 02
- 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
- 01 01 01 01 01 01 01 00 01 01 01 01 01 01 01 02
- 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
- 02 02 02 02 02 02 02 00 02 02 02 02 02 02 02 00
-
-# to_lower array (must be 256 elements)
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F
- 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F
- 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F
- 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F
- 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
- 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
- A0 A1 A2 A3 A4 A5 A6 A7 B8 A9 BA AB AC AD AE BF
- B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF
- E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
- F0 F1 F2 F3 F4 F5 F6 D7 F8 F9 FA FB FC FD FE DF
- E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
- F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF
-
-# to_upper array (must be 256 elements)
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
- 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F
- 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
- 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
- A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 BA AB AC AD AE AF
- B0 B1 B2 B3 B4 B5 B6 B7 A8 B9 BA BB BC BD BE AF
- C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
- D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF
- C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
- D0 D1 D2 D3 D4 D5 D6 F7 D8 D9 DA DB DC DD DE FF
-
-# sort_order array (must be 256 elements)
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 41 4D 4F 55 57 61 63 67 69 6F 71 75 7B 7D 83
- 8F 91 93 97 9E A0 A8 AA AC AE B0 B8 B9 BA BB BC
- BD 42 4E 50 56 58 62 64 68 6A 70 72 76 7C 7E 84
- 90 92 94 98 9F A1 A9 AB AD AF B1 BE BF C0 C1 C4
- C5 C6 C7 C8 C9 CA CB CC CD CE CF D0 D1 D2 D3 D4
- D5 D6 D7 D8 D9 DA DB DC DD DE DF E0 E1 E2 E3 E4
- E5 E6 E7 E8 E9 EA EB EC 85 ED 95 EE EF F0 F1 4B
- F2 F3 F4 F5 F6 F7 F8 F9 86 FA 96 FB FC FD FE 4C
- 43 6B 45 51 47 49 59 5B 53 5D B2 5F 65 73 6D 77
- 99 7F 81 87 89 8B 8D C2 A2 79 9B A4 A6 B4 B6 9D
- 44 6C 46 52 48 4A 5A 5C 54 5E B3 60 66 74 6E 78
- 9A 80 82 88 8A 8C 8E C3 A3 7A 9C A5 A7 B5 B7 FF
-
-# Unicode mapping (must be 256 elements)
- 0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F
- 0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F
- 0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F
- 0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F
- 0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F
- 0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F
- 0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F
- 0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F
- 20AC 0000 201A 0000 201E 2026 2020 2021 0000 2030 0000 2039 0000 00A8 02C7 00B8
- 0000 2018 2019 201C 201D 2022 2013 2014 0000 2122 0000 203A 0000 00AF 02DB 0000
- 00A0 0000 00A2 00A3 00A4 0000 00A6 00A7 00D8 00A9 0156 00AB 00AC 00AD 00AE 00C6
- 00B0 00B1 00B2 00B3 00B4 00B5 00B6 00B7 00F8 00B9 0157 00BB 00BC 00BD 00BE 00E6
- 0104 012E 0100 0106 00C4 00C5 0118 0112 010C 00C9 0179 0116 0122 0136 012A 013B
- 0160 0143 0145 00D3 014C 00D5 00D6 00D7 0172 0141 015A 016A 00DC 017B 017D 00DF
- 0105 012F 0101 0107 00E4 00E5 0119 0113 010D 00E9 017A 0117 0123 0137 012B 013C
- 0161 0144 0146 00F3 014D 00F5 00F6 00F7 0173 0142 015B 016B 00FC 017C 017E 02D9
-
diff --git a/sql/share/charsets/cp866.conf b/sql/share/charsets/cp866.xml
index 0e4dcb3b9bc..2b050f3c993 100644
--- a/sql/share/charsets/cp866.conf
+++ b/sql/share/charsets/cp866.xml
@@ -1,9 +1,12 @@
-#
-# cp866_DOSCyrillicRussian
-# Case insensitive, accent sensitive.
-#
-#
-# ctype array (must be 257 elements)
+<?xml version='1.0' encoding="utf-8"?>
+
+<charsets>
+
+<charset name="cp866">
+<!-- cp866_DOSCyrillicRussian -->
+
+<ctype>
+<map>
00
20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20
20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
@@ -21,8 +24,12 @@
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
01 02 01 02 01 02 01 02 00 00 00 00 00 00 00 48
+</map>
+</ctype>
-# to_lower array (must be 256 elements)
+
+<lower>
+<map>
00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
@@ -39,8 +46,12 @@
D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF
E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
F1 F1 F3 F3 F5 F5 F7 F7 F8 F9 FA FB FC FD FE FF
+</map>
+</lower>
+
-# to_upper array (must be 256 elements)
+<upper>
+<map>
00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
@@ -57,26 +68,12 @@
D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF
90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
F0 F0 F2 F2 F4 F4 F6 F6 F8 F9 FA FB FC FD FE FF
+</map>
+</upper>
-# sort_order array (must be 256 elements)
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 41 43 45 47 49 4B 4D 4F 51 53 55 57 59 5B 5D
- 5F 61 63 65 67 69 6B 6D 6F 71 73 BD BE BF C0 C1
- C2 41 43 45 47 49 4B 4D 4F 51 54 55 57 59 5B 5D
- 5F 61 63 65 67 69 6B 6D 6F 71 73 C3 C4 C5 C6 C7
- 75 77 79 7B 7D 7F 85 87 89 8D 8F 91 93 95 97 99
- 9B 9D 9F A1 A5 A7 A9 AB AD AF B1 B3 B5 B7 B9 BB
- 75 77 79 7B 7D 7F 85 87 89 8D 8F 91 93 95 97 99
- C8 C9 CA D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF
- E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
- F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF
- 9B 9D 9F A1 A5 A7 A9 AB AD AF B1 B3 B5 B7 B9 BB
- 81 81 83 83 8B 8B A3 A3 CB CC CD CE CF D0 D1 D2
-# Unicode mapping (must be 256 elements)
+<unicode>
+<map>
0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F
0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F
0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F
@@ -93,4 +90,33 @@
2568 2564 2565 2559 2558 2552 2553 256B 256A 2518 250C 2588 2584 258C 2590 2580
0440 0441 0442 0443 0444 0445 0446 0447 0448 0449 044A 044B 044C 044D 044E 044F
0401 0451 0404 0454 0407 0457 040E 045E 00B0 2219 00B7 221A 207F 00B2 25A0 00A0
+</map>
+</unicode>
+
+
+<collation name="cp866">
+<!-- Case insensitive, accent sensitive -->
+<map>
+ 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
+ 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
+ 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
+ 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
+ 40 41 43 45 47 49 4B 4D 4F 51 53 55 57 59 5B 5D
+ 5F 61 63 65 67 69 6B 6D 6F 71 73 BD BE BF C0 C1
+ C2 41 43 45 47 49 4B 4D 4F 51 54 55 57 59 5B 5D
+ 5F 61 63 65 67 69 6B 6D 6F 71 73 C3 C4 C5 C6 C7
+ 75 77 79 7B 7D 7F 85 87 89 8D 8F 91 93 95 97 99
+ 9B 9D 9F A1 A5 A7 A9 AB AD AF B1 B3 B5 B7 B9 BB
+ 75 77 79 7B 7D 7F 85 87 89 8D 8F 91 93 95 97 99
+ C8 C9 CA D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF
+ E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
+ F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF
+ 9B 9D 9F A1 A5 A7 A9 AB AD AF B1 B3 B5 B7 B9 BB
+ 81 81 83 83 8B 8B A3 A3 CB CC CD CE CF D0 D1 D2
+</map>
+</collation>
+
+</charset>
+
+</charsets>
diff --git a/sql/share/charsets/croat.conf b/sql/share/charsets/croat.conf
deleted file mode 100644
index bc8c1a376eb..00000000000
--- a/sql/share/charsets/croat.conf
+++ /dev/null
@@ -1,92 +0,0 @@
-# Configuration file for the croat character set
-
-# ctype array (must have 257 elements)
- 00
- 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20
- 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
- 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
- 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10
- 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01
- 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10
- 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02
- 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 20
- 00 00 00 00 00 00 00 00 00 01 00 00 00 01 00 00
- 00 00 00 00 00 00 00 00 00 02 00 00 00 02 00 00
- 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
- 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
- 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
- 01 01 01 01 01 01 01 10 01 01 01 01 01 01 01 02
- 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
- 02 02 02 02 02 02 02 10 02 02 02 02 02 02 02 02
-
-# to_lower array (must have 256 elements)
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F
- 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F
- 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F
- 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F
- 80 81 82 83 84 85 86 87 88 89 9A 8B 8C 8D 9E 8F
- 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
- A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF
- B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF
- E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
- F0 F1 F2 F3 F4 F5 F6 D7 F8 F9 FA FB FC FD FE DF
- E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
- F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF
-
-# to_upper array (must have 256 elements)
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
- 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F
- 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
- 90 91 92 93 94 95 96 97 98 99 8A 9B 9C 9D 8E 9F
- A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF
- B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF
- C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
- D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF
- C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
- D0 D1 D2 D3 D4 D5 D6 F7 D8 D9 DA DB DC DD DE FF
-
-# sort_order array (must have 256 elements)
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 41 42 43 46 48 49 4A 4B 4C 4D 4E 4F 50 51 52
- 53 54 55 56 58 59 5A 5B 5C 5D 5E 5B 5C 5D 5E 5F
- 60 41 42 43 46 48 49 4A 4B 4C 4D 4E 4F 50 51 52
- 53 54 55 56 58 59 5A 5B 5C 5D 5E 7B 7C 7D 7E 7F
- 80 81 82 83 84 85 86 87 88 89 57 8B 8C 8D 5F 8F
- 90 91 92 93 94 95 96 97 98 99 57 9B 9C 9D 5F 9F
- A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF
- B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF
- 41 41 41 41 5C 5B 45 43 44 45 45 45 49 49 49 49
- 47 4E 4F 4F 4F 4F 5D D7 D8 55 55 55 59 59 DE DF
- 41 41 41 41 5C 5B 45 43 44 45 45 45 49 49 49 49
- 47 4E 4F 4F 4F 4F 5D F7 D8 55 55 55 59 59 DE FF
-
-# Unicode mapping (256 elements)
-0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F
-0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F
-0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F
-0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F
-0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F
-0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F
-0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F
-0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F
-0080 0081 0082 0083 0084 0085 0086 0087 0088 0089 008A 008B 008C 008D 008E 008F
-0090 0091 0092 0093 0094 0095 0096 0097 0098 0099 009A 009B 009C 009D 009E 009F
-00A0 0104 02D8 0141 00A4 013D 015A 00A7 00A8 0160 015E 0164 0179 00AD 017D 017B
-00B0 0105 02DB 0142 00B4 013E 015B 02C7 00B8 0161 015F 0165 017A 02DD 017E 017C
-0154 00C1 00C2 0102 00C4 0139 0106 00C7 010C 00C9 0118 00CB 011A 00CD 00CE 010E
-0110 0143 0147 00D3 00D4 0150 00D6 00D7 0158 016E 00DA 0170 00DC 00DD 0162 00DF
-0155 00E1 00E2 0103 00E4 013A 0107 00E7 010D 00E9 0119 00EB 011B 00ED 00EE 010F
-0111 0144 0148 00F3 00F4 0151 00F6 00F7 0159 016F 00FA 0171 00FC 00FD 0163 02D9
diff --git a/sql/share/charsets/danish.conf b/sql/share/charsets/danish.conf
deleted file mode 100644
index 1543a64d7c3..00000000000
--- a/sql/share/charsets/danish.conf
+++ /dev/null
@@ -1,92 +0,0 @@
-# Configuration file for the danish character set
-
-# ctype array (must have 257 elements)
- 00
- 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20
- 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
- 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
- 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10
- 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01
- 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10
- 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02
- 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 20
- 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
- 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
- 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
- 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
- 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
- 01 01 01 01 01 01 01 10 01 01 01 01 01 01 01 02
- 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
- 02 02 02 02 02 02 02 10 02 02 02 02 02 02 02 02
-
-# to_lower array (must have 256 elements)
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F
- 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F
- 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F
- 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F
- 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
- 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
- A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF
- B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF
- E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
- F0 F1 F2 F3 F4 F5 F6 D7 F8 F9 FA FB FC FD FE DF
- E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
- F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF
-
-# to_upper array (must have 256 elements)
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
- 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F
- 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
- 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
- A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF
- B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF
- C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
- D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF
- C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
- D0 D1 D2 D3 D4 D5 D6 F7 D8 D9 DA DB DC DD DE FF
-
-# sort_order array (must have 256 elements)
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
- 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F
- 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
- 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
- A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF
- B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF
- 41 41 41 41 5B 5D 5B 43 45 45 45 45 49 49 49 49
- 44 4E 4F 4F 4F 4F 5C D7 5C 55 55 55 59 59 DE DF
- 41 41 41 41 5B 5D 5B 43 45 45 45 45 49 49 49 49
- 44 4E 4F 4F 4F 4F 5C F7 5C 55 55 55 59 59 DE FF
-
-# Unicode mapping (256 elements)
-0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F
-0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F
-0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F
-0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F
-0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F
-0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F
-0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F
-0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F
-0080 0081 0082 0083 0084 0085 0086 0087 0088 0089 008A 008B 008C 008D 008E 008F
-0090 0091 0092 0093 0094 0095 0096 0097 0098 0099 009A 009B 009C 009D 009E 009F
-00A0 00A1 00A2 00A3 00A4 00A5 00A6 00A7 00A8 00A9 00AA 00AB 00AC 00AD 00AE 00AF
-00B0 00B1 00B2 00B3 00B4 00B5 00B6 00B7 00B8 00B9 00BA 00BB 00BC 00BD 00BE 00BF
-00C0 00C1 00C2 00C3 00C4 00C5 00C6 00C7 00C8 00C9 00CA 00CB 00CC 00CD 00CE 00CF
-00D0 00D1 00D2 00D3 00D4 00D5 00D6 00D7 00D8 00D9 00DA 00DB 00DC 00DD 00DE 00DF
-00E0 00E1 00E2 00E3 00E4 00E5 00E6 00E7 00E8 00E9 00EA 00EB 00EC 00ED 00EE 00EF
-00F0 00F1 00F2 00F3 00F4 00F5 00F6 00F7 00F8 00F9 00FA 00FB 00FC 00FD 00FE 00FF
diff --git a/sql/share/charsets/dec8.conf b/sql/share/charsets/dec8.xml
index d1ffe45032d..4e76bbffd14 100644
--- a/sql/share/charsets/dec8.conf
+++ b/sql/share/charsets/dec8.xml
@@ -1,6 +1,11 @@
-# Configuration file for the dec8 character set
+<?xml version='1.0' encoding="utf-8"?>
-# ctype array (must have 257 elements)
+<charsets>
+
+<charset name="dec8">
+
+<ctype>
+<map>
00
20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20
20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
@@ -18,8 +23,12 @@
01 01 01 01 01 01 01 10 01 01 01 01 01 01 01 02
02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
02 02 02 02 02 02 02 10 02 02 02 02 02 02 02 02
+</map>
+</ctype>
+
-# to_lower array (must have 256 elements)
+<lower>
+<map>
00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
@@ -36,8 +45,12 @@
F0 F1 F2 F3 F4 F5 F6 D7 F8 F9 FA FB FC FD FE DF
E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF
+</map>
+</lower>
-# to_upper array (must have 256 elements)
+
+<upper>
+<map>
00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
@@ -54,26 +67,12 @@
D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF
C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
D0 D1 D2 D3 D4 D5 D6 F7 D8 D9 DA DB DC DD DE FF
+</map>
+</upper>
-# sort_order array (must have 256 elements)
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
- 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F
- 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
- 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
- A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF
- B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF
- 41 41 41 41 5C 5B 5C 43 45 45 45 45 49 49 49 49
- 44 4E 4F 4F 4F 4F 5D D7 D8 55 55 55 59 59 DE DF
- 41 41 41 41 5C 5B 5C 43 45 45 45 45 49 49 49 49
- 44 4E 4F 4F 4F 4F 5D F7 D8 55 55 55 59 59 DE FF
-# Unicode mapping (256 elements)
+<unicode>
+<map>
0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F
0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F
0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F
@@ -90,3 +89,33 @@
0000 00D1 00D2 00D3 00D4 00D5 00D6 0152 00D8 00D9 00DA 00DB 00DC 0178 0000 00DF
00E0 00E1 00E2 00E3 00E4 00E5 00E6 00E7 00E8 00E9 00EA 00EB 00EC 00ED 00EE 00EF
0000 00F1 00F2 00F3 00F4 00F5 00F6 0153 00F8 00F9 00FA 00FB 00FC 00FF 0000 0000
+</map>
+</unicode>
+
+
+<collation name="dec8">
+<map>
+ 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
+ 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
+ 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
+ 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
+ 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
+ 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
+ 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
+ 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F
+ 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
+ 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
+ A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF
+ B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF
+ 41 41 41 41 5C 5B 5C 43 45 45 45 45 49 49 49 49
+ 44 4E 4F 4F 4F 4F 5D D7 D8 55 55 55 59 59 DE DF
+ 41 41 41 41 5C 5B 5C 43 45 45 45 45 49 49 49 49
+ 44 4E 4F 4F 4F 4F 5D F7 D8 55 55 55 59 59 DE FF
+</map>
+</collation>
+
+
+</charset>
+
+
+</charsets>
diff --git a/sql/share/charsets/dos.conf b/sql/share/charsets/dos.conf
deleted file mode 100644
index 205202711b8..00000000000
--- a/sql/share/charsets/dos.conf
+++ /dev/null
@@ -1,93 +0,0 @@
-# Configuration file for the dos (aka cp437 DOSLatinUS) character set
-
-# ctype array (must have 257 elements)
- 00
- 20 30 30 30 30 30 30 20 20 28 28 28 28 28 30 30
- 30 30 30 30 30 30 30 30 30 30 20 30 30 30 30 30
- 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
- 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10
- 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01
- 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10
- 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02
- 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 30
- 02 02 02 02 02 02 02 02 02 02 02 02 02 02 01 01
- 01 02 01 02 02 02 02 02 02 01 01 10 10 10 10 10
- 02 02 02 02 02 01 10 10 10 10 10 10 10 10 10 10
- 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
- 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
- 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
- 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
- 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 20
-
-# to_lower array (must have 256 elements)
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F
- 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F
- 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F
- 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F
- 87 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 84 86
- 82 91 91 93 94 95 96 97 98 94 81 9B 9C 9D 9E 9F
- A0 A1 A2 A3 A4 A4 A6 A7 A8 A9 AA AB AC AD AE AF
- B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF
- C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
- D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF
- E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
- F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF
-
-# to_upper array (must have 256 elements)
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
- 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F
- 80 9A 90 41 8E 41 8F 80 45 45 45 49 49 49 8E 8F
- 90 92 92 4F 99 4F 55 55 59 99 9A 9B 9C 9D 9E 9F
- 41 49 4F 55 A5 A5 A6 A7 A8 A9 AA AB AC AD AE AF
- B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF
- C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
- D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF
- E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
- F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF
-
-# sort_order array (must have 256 elements)
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
- 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F
- 43 59 45 41 5C 41 5B 43 45 45 45 49 49 49 5C 5B
- 45 5C 5C 4F 5D 4F 55 55 59 5D 59 24 24 24 24 24
- 41 49 4F 55 4E 4E A6 A7 3F A9 AA AB AC 21 22 22
- B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF
- C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
- D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF
- E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
- F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF
-
-# Unicode mapping (256 elements)
-
-0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000a 000b 000c 000d 000e 000f
-0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001a 001b 001c 001d 001e 001f
-0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002a 002b 002c 002d 002e 002f
-0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003a 003b 003c 003d 003e 003f
-0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004a 004b 004c 004d 004e 004f
-0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005a 005b 005c 005d 005e 005f
-0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006a 006b 006c 006d 006e 006f
-0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007a 007b 007c 007d 007e 007f
-00c7 00fc 00e9 00e2 00e4 00e0 00e5 00e7 00ea 00eb 00e8 00ef 00ee 00ec 00c4 00c5
-00c9 00e6 00c6 00f4 00f6 00f2 00fb 00f9 00ff 00d6 00dc 00a2 00a3 00a5 20a7 0192
-00e1 00ed 00f3 00fa 00f1 00d1 00aa 00ba 00bf 2310 00ac 00bd 00bc 00a1 00ab 00bb
-2591 2592 2593 2502 2524 2561 2562 2556 2555 2563 2551 2557 255d 255c 255b 2510
-2514 2534 252c 251c 2500 253c 255e 255f 255a 2554 2569 2566 2560 2550 256c 2567
-2568 2564 2565 2559 2558 2552 2553 256b 256a 2518 250c 2588 2584 258c 2590 2580
-03b1 00df 0393 03c0 03a3 03c3 00b5 03c4 03a6 0398 03a9 03b4 221e 03c6 03b5 2229
-2261 00b1 2265 2264 2320 2321 00f7 2248 00b0 2219 00b7 221a 207f 00b2 25a0 00a0
diff --git a/sql/share/charsets/estonia.conf b/sql/share/charsets/estonia.conf
deleted file mode 100644
index 0226fd1fe82..00000000000
--- a/sql/share/charsets/estonia.conf
+++ /dev/null
@@ -1,92 +0,0 @@
-# Configuration file for the estonia character set.
-
-# The ctype array must have 257 elements.
- 00
- 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20
- 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
- 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
- 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10
- 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01
- 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10
- 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02
- 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 20
- 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
- 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
- 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
- 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
- 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
- 01 01 01 01 01 01 01 10 01 01 01 01 01 01 01 02
- 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
- 02 02 02 02 02 02 02 10 02 02 02 02 02 02 02 02
-
-# The to_lower array must have 256 elements.
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F
- 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F
- 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F
- 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F
- 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
- 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
- A0 A1 A2 A3 A4 A5 A6 A7 B8 A9 BA AB AC AD AE BF
- B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF
- E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
- F0 F1 F2 F3 F4 F5 F6 D7 F8 F9 FA FB FC FD FE DF
- E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
- F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF
-
-# The to_upper array must have 256 elements.
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
- 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F
- 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
- 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
- A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF
- B0 B1 B2 B3 B4 B5 B6 B7 A8 B9 AA BB BC BD BE AF
- C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
- D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF
- C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
- D0 D1 D2 D3 D4 D5 D6 F7 D8 D9 DA DB DC DD DE FF
-
-# The sort_order array must have 256 elements.
- 00 02 03 04 05 06 07 08 09 2E 2F 30 31 32 0A 0B
- 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B
- 2C 33 34 35 36 37 38 27 39 3A 3B 5D 3C 28 3D 3E
- 76 7A 7C 7E 80 81 82 83 84 85 3F 40 5E 5F 60 41
- 42 86 90 92 98 9A A4 A6 AA AC B2 B4 B8 BE C0 C6
- CE D0 D2 D6 E5 E8 EE F0 FA FC DD 43 44 45 46 47
- 48 87 91 93 99 9B A5 A7 AB AD B3 B5 B9 BF C1 C7
- CF D1 D3 D7 E6 E9 EF F1 FB FD DE 49 4A 4B 4C 1C
- 01 1D 57 1E 5A 74 71 72 1F 75 20 5B 21 4E 52 51
- 22 55 56 58 59 73 2A 2B 23 E7 24 5C 25 4F 54 26
- 2D FE 66 67 68 FF 4D 69 CC 6A D4 62 6B 29 6C 8E
- 6D 61 7D 7F 50 6E 6F 70 CD 7B D5 63 77 78 79 8F
- 8C B0 88 94 F4 8A A2 A0 96 9C DF 9E A8 B6 AE BA
- DB C2 C4 C8 CA F2 F6 64 EC BC D8 EA F8 E1 E3 DA
- 8D B1 89 95 F5 8B A3 A1 97 9D E0 9F A9 B7 AF BB
- DC C3 C5 C9 CB F3 F7 65 ED BD D9 EB F9 E2 E4 53
-
-# Unicode mapping (256 elements)
-0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F
-0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F
-0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F
-0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F
-0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F
-0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F
-0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F
-0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F
-0080 0081 0082 0083 0084 0085 0086 0087 0088 0089 008A 008B 008C 008D 008E 008F
-0090 0091 0092 0093 0094 0095 0096 0097 0098 0099 009A 009B 009C 009D 009E 009F
-00A0 201D 00A2 00A3 00A4 201E 00A6 00A7 00D8 00A9 0156 00AB 00AC 00AD 00AE 00C6
-00B0 00B1 00B2 00B3 201C 00B5 00B6 00B7 00F8 00B9 0157 00BB 00BC 00BD 00BE 00E6
-0104 012E 0100 0106 00C4 00C5 0118 0112 010C 00C9 0179 0116 0122 0136 012A 013B
-0160 0143 0145 00D3 014C 00D5 00D6 00D7 0172 0141 015A 016A 00DC 017B 017D 00DF
-0105 012F 0101 0107 00E4 00E5 0119 0113 010D 00E9 017A 0117 0123 0137 012B 013C
-0161 0144 0146 00F3 014D 00F5 00F6 00F7 0173 0142 015B 016B 00FC 017C 017E 2019
diff --git a/sql/share/charsets/german1.conf b/sql/share/charsets/german1.conf
deleted file mode 100644
index 64f27da3499..00000000000
--- a/sql/share/charsets/german1.conf
+++ /dev/null
@@ -1,92 +0,0 @@
-# Configuration file for the german1 character set
-
-# ctype array (must have 257 elements)
- 00
- 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20
- 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
- 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
- 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10
- 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01
- 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10
- 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02
- 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 20
- 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
- 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
- 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
- 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
- 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
- 01 01 01 01 01 01 01 10 01 01 01 01 01 01 01 02
- 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
- 02 02 02 02 02 02 02 10 02 02 02 02 02 02 02 02
-
-# to_lower array (must have 256 elements)
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F
- 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F
- 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F
- 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F
- 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
- 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
- A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF
- B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF
- E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
- F0 F1 F2 F3 F4 F5 F6 D7 F8 F9 FA FB FC FD FE DF
- E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
- F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF
-
-# to_upper array (must have 256 elements)
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
- 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F
- 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
- 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
- A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF
- B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF
- C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
- D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF
- C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
- D0 D1 D2 D3 D4 D5 D6 F7 D8 D9 DA DB DC DD DE FF
-
-# sort_order array (must have 256 elements)
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
- 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F
- 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
- 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
- A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF
- B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF
- 41 41 41 41 41 41 41 43 45 45 45 45 49 49 49 49
- D0 4E 4F 4F 4F 4F 4F D7 4F 55 55 55 55 59 DE 53
- 41 41 41 41 41 41 41 43 45 45 45 45 49 49 49 49
- D0 4E 4F 4F 4F 4F 4F F7 4F 55 55 55 55 59 DE FF
-
-# Unicode mapping (256 elements)
-0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F
-0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F
-0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F
-0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F
-0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F
-0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F
-0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F
-0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F
-0080 0081 0082 0083 0084 0085 0086 0087 0088 0089 008A 008B 008C 008D 008E 008F
-0090 0091 0092 0093 0094 0095 0096 0097 0098 0099 009A 009B 009C 009D 009E 009F
-00A0 00A1 00A2 00A3 00A4 00A5 00A6 00A7 00A8 00A9 00AA 00AB 00AC 00AD 00AE 00AF
-00B0 00B1 00B2 00B3 00B4 00B5 00B6 00B7 00B8 00B9 00BA 00BB 00BC 00BD 00BE 00BF
-00C0 00C1 00C2 00C3 00C4 00C5 00C6 00C7 00C8 00C9 00CA 00CB 00CC 00CD 00CE 00CF
-00D0 00D1 00D2 00D3 00D4 00D5 00D6 00D7 00D8 00D9 00DA 00DB 00DC 00DD 00DE 00DF
-00E0 00E1 00E2 00E3 00E4 00E5 00E6 00E7 00E8 00E9 00EA 00EB 00EC 00ED 00EE 00EF
-00F0 00F1 00F2 00F3 00F4 00F5 00F6 00F7 00F8 00F9 00FA 00FB 00FC 00FD 00FE 00FF
diff --git a/sql/share/charsets/greek.conf b/sql/share/charsets/greek.conf
deleted file mode 100644
index 5eb38e2efbe..00000000000
--- a/sql/share/charsets/greek.conf
+++ /dev/null
@@ -1,93 +0,0 @@
-# Configuration file for the greek character set
-
-# ctype array (must have 257 elements)
- 00
- 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20
- 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
- 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
- 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10
- 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01
- 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10
- 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02
- 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 20
- 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
- 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
- 48 10 10 10 00 00 10 10 10 10 00 10 10 10 00 10
- 10 10 10 10 10 10 01 10 01 01 01 10 01 10 01 01
- 02 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
- 01 01 00 01 01 01 01 01 01 01 01 01 02 02 02 02
- 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
- 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 00
-
-# to_lower array (must have 256 elements)
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F
- 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F
- 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F
- 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F
- 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
- 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
- A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF
- B0 B1 B2 B3 B4 B5 DC B7 DD DE DF BB FC BD FD FE
- C0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
- F0 F1 D2 F3 F4 F5 F6 F7 F8 F9 FA FB DC DD DE DF
- E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
- F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF
-
-# to_upper array (must have 256 elements)
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
- 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F
- 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
- 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
- A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF
- B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF
- DA C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
- D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB C1 C5 C7 C9
- DB C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
- D0 D1 D3 D3 D4 D5 D6 D7 D8 D9 DA DB CF D5 D9 FF
-
-# sort_order array (must have 256 elements)
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
- 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F
- 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
- 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
- A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF
- B0 B1 B2 B3 B4 B5 C1 B7 C5 C7 C9 BB CF BD D5 D9
- C9 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
- D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 C9 D5 C1 C5 C7 C9
- D5 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
- D0 D1 D3 D3 D4 D5 D6 D7 D8 D9 C9 D5 CF D5 D9 FF
-
-# Unicode mapping (256 elements)
-0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F
-0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F
-0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F
-0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F
-0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F
-0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F
-0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F
-0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F
-0080 0081 0082 0083 0084 0085 0086 0087 0088 0089 008A 008B 008C 008D 008E 008F
-0090 0091 0092 0093 0094 0095 0096 0097 0098 0099 009A 009B 009C 009D 009E 009F
-00A0 02BD 02BC 00A3 0000 0000 00A6 00A7 00A8 00A9 0000 00AB 00AC 00AD 0000 2015
-00B0 00B1 00B2 00B3 0384 0385 0386 00B7 0388 0389 038A 00BB 038C 00BD 038E 038F
-0390 0391 0392 0393 0394 0395 0396 0397 0398 0399 039A 039B 039C 039D 039E 039F
-03A0 03A1 0000 03A3 03A4 03A5 03A6 03A7 03A8 03A9 03AA 03AB 03AC 03AD 03AE 03AF
-03B0 03B1 03B2 03B3 03B4 03B5 03B6 03B7 03B8 03B9 03BA 03BB 03BC 03BD 03BE 03BF
-03C0 03C1 03C2 03C3 03C4 03C5 03C6 03C7 03C8 03C9 03CA 03CB 03CC 03CD 03CE 0000
- \ No newline at end of file
diff --git a/sql/share/charsets/greek.xml b/sql/share/charsets/greek.xml
new file mode 100644
index 00000000000..eeb22236675
--- /dev/null
+++ b/sql/share/charsets/greek.xml
@@ -0,0 +1,120 @@
+<?xml version='1.0' encoding="utf-8"?>
+
+<charsets>
+
+<charset name="greek">
+
+<ctype>
+<map>
+ 00
+ 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20
+ 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
+ 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
+ 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10
+ 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01
+ 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10
+ 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02
+ 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 20
+ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+ 48 10 10 10 00 00 10 10 10 10 00 10 10 10 00 10
+ 10 10 10 10 10 10 01 10 01 01 01 10 01 10 01 01
+ 02 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
+ 01 01 00 01 01 01 01 01 01 01 01 01 02 02 02 02
+ 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
+ 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 00
+ </map>
+</ctype>
+
+
+<lower>
+<map>
+ 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
+ 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
+ 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
+ 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
+ 40 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F
+ 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F
+ 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F
+ 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F
+ 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
+ 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
+ A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF
+ B0 B1 B2 B3 B4 B5 DC B7 DD DE DF BB FC BD FD FE
+ C0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
+ F0 F1 D2 F3 F4 F5 F6 F7 F8 F9 FA FB DC DD DE DF
+ E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
+ F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF
+</map>
+</lower>
+
+
+<upper>
+<map>
+ 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
+ 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
+ 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
+ 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
+ 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
+ 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
+ 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
+ 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F
+ 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
+ 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
+ A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF
+ B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF
+ DA C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
+ D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB C1 C5 C7 C9
+ DB C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
+ D0 D1 D3 D3 D4 D5 D6 D7 D8 D9 DA DB CF D5 D9 FF
+</map>
+</upper>
+
+
+<unicode>
+<map>
+0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F
+0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F
+0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F
+0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F
+0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F
+0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F
+0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F
+0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F
+0080 0081 0082 0083 0084 0085 0086 0087 0088 0089 008A 008B 008C 008D 008E 008F
+0090 0091 0092 0093 0094 0095 0096 0097 0098 0099 009A 009B 009C 009D 009E 009F
+00A0 02BD 02BC 00A3 0000 0000 00A6 00A7 00A8 00A9 0000 00AB 00AC 00AD 0000 2015
+00B0 00B1 00B2 00B3 0384 0385 0386 00B7 0388 0389 038A 00BB 038C 00BD 038E 038F
+0390 0391 0392 0393 0394 0395 0396 0397 0398 0399 039A 039B 039C 039D 039E 039F
+03A0 03A1 0000 03A3 03A4 03A5 03A6 03A7 03A8 03A9 03AA 03AB 03AC 03AD 03AE 03AF
+03B0 03B1 03B2 03B3 03B4 03B5 03B6 03B7 03B8 03B9 03BA 03BB 03BC 03BD 03BE 03BF
+03C0 03C1 03C2 03C3 03C4 03C5 03C6 03C7 03C8 03C9 03CA 03CB 03CC 03CD 03CE 0000
+</map>
+</unicode>
+
+
+<collation name="greek">
+<map>
+ 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
+ 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
+ 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
+ 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
+ 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
+ 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
+ 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
+ 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F
+ 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
+ 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
+ A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF
+ B0 B1 B2 B3 B4 B5 C1 B7 C5 C7 C9 BB CF BD D5 D9
+ C9 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
+ D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 C9 D5 C1 C5 C7 C9
+ D5 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
+ D0 D1 D3 D3 D4 D5 D6 D7 D8 D9 C9 D5 CF D5 D9 FF
+</map>
+</collation>
+
+</charset>
+
+</charsets>
+
diff --git a/sql/share/charsets/hebrew.conf b/sql/share/charsets/hebrew.conf
deleted file mode 100644
index 84581f6f1bb..00000000000
--- a/sql/share/charsets/hebrew.conf
+++ /dev/null
@@ -1,93 +0,0 @@
-# Configuration file for the hebrew character set
-
-# ctype array (must have 257 elements)
- 00
- 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20
- 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
- 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
- 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10
- 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01
- 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10
- 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02
- 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 20
- 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
- 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
- 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
- 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
- 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
- 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
- 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
- 02 02 02 02 02 02 02 02 02 02 02 00 00 00 00 00
-
-# to_lower array (must have 256 elements)
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F
- 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F
- 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F
- 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F
- 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
- 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
- A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF
- B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF
- C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
- D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF
- E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
- F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF
-
-# to_upper array (must have 256 elements)
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
- 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F
- 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
- 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
- A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF
- B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF
- C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
- D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF
- E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
- F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF
-
-# sort_order array (must have 256 elements)
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
- 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F
- 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
- 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
- A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF
- B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF
- C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
- D0 D1 D2 D3 D4 D5 D6 F7 D8 D9 DA DB DC DD DE FF
- E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
- F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF
-
-# Unicode mapping (256 elements)
-0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F
-0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F
-0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F
-0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F
-0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F
-0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F
-0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F
-0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F
-0080 0081 0082 0083 0084 0085 0086 0087 0088 0089 008A 008B 008C 008D 008E 008F
-0090 0091 0092 0093 0094 0095 0096 0097 0098 0099 009A 009B 009C 009D 009E 009F
-00A0 0000 00A2 00A3 00A4 00A5 00A6 00A7 00A8 00A9 00D7 00AB 00AC 00AD 00AE 203E
-00B0 00B1 00B2 00B3 00B4 00B5 00B6 00B7 00B8 00B9 00F7 00BB 00BC 00BD 00BE 0000
-0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000
-0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 2017
-05D0 05D1 05D2 05D3 05D4 05D5 05D6 05D7 05D8 05D9 05DA 05DB 05DC 05DD 05DE 05DF
-05E0 05E1 05E2 05E3 05E4 05E5 05E6 05E7 05E8 05E9 05EA 0000 0000 0000 0000 0000
- \ No newline at end of file
diff --git a/sql/share/charsets/latin1bin.conf b/sql/share/charsets/hebrew.xml
index 37e6350bcb2..3bf8bec370e 100644
--- a/sql/share/charsets/latin1bin.conf
+++ b/sql/share/charsets/hebrew.xml
@@ -1,9 +1,11 @@
-#
-# Latin1, accent sensitive, case sensitive
-#
-# Binary sorting order
-#
-# ctype array (must be 257 elements)
+<?xml version='1.0' encoding="utf-8"?>
+
+<charsets>
+
+<charset name="hebrew">
+
+<ctype>
+<map>
00
20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20
20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
@@ -13,16 +15,20 @@
01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10
10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02
02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 20
- 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
- 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
- 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
- 01 01 01 01 01 01 01 00 01 01 01 01 01 01 01 02
+ 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
+ 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
+ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
- 02 02 02 02 02 02 02 00 02 02 02 02 02 02 02 02
+ 02 02 02 02 02 02 02 02 02 02 02 00 00 00 00 00
+ </map>
+</ctype>
+
-# to_lower array (must be 256 elements)
+<lower>
+<map>
00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
@@ -35,12 +41,16 @@
90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF
B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF
- E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
- F0 F1 F2 F3 F4 F5 F6 D7 F8 F9 FA FB FC FD FE DF
+ C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
+ D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF
E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF
+</map>
+</lower>
+
-# to_upper array (must be 256 elements)
+<upper>
+<map>
00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
@@ -55,42 +65,56 @@
B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF
C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF
- C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
- D0 D1 D2 D3 D4 D5 D6 F7 D8 D9 DA DB DC DD DE FF
+ E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
+ F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF
+</map>
+</upper>
+
-# sort_order array (must be 256 elements)
+<unicode>
+<map>
+0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F
+0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F
+0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F
+0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F
+0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F
+0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F
+0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F
+0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F
+0080 0081 0082 0083 0084 0085 0086 0087 0088 0089 008A 008B 008C 008D 008E 008F
+0090 0091 0092 0093 0094 0095 0096 0097 0098 0099 009A 009B 009C 009D 009E 009F
+00A0 0000 00A2 00A3 00A4 00A5 00A6 00A7 00A8 00A9 00D7 00AB 00AC 00AD 00AE 203E
+00B0 00B1 00B2 00B3 00B4 00B5 00B6 00B7 00B8 00B9 00F7 00BB 00BC 00BD 00BE 0000
+0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000
+0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 2017
+05D0 05D1 05D2 05D3 05D4 05D5 05D6 05D7 05D8 05D9 05DA 05DB 05DC 05DD 05DE 05DF
+05E0 05E1 05E2 05E3 05E4 05E5 05E6 05E7 05E8 05E9 05EA 0000 0000 0000 0000 0000
+</map>
+</unicode>
+
+
+<collation name="hebrew">
+<map>
00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
- 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F
- 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F
+ 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
+ 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F
80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF
B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF
C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
- D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF
+ D0 D1 D2 D3 D4 D5 D6 F7 D8 D9 DA DB DC DD DE FF
E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF
+</map>
+</collation>
+
+</charset>
-# Unicode mapping (must be 256 elements)
- 0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F
- 0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F
- 0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F
- 0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F
- 0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F
- 0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F
- 0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F
- 0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F
- 0080 0081 0082 0083 0084 0085 0086 0087 0088 0089 008A 008B 008C 008D 008E 008F
- 0090 0091 0092 0093 0094 0095 0096 0097 0098 0099 009A 009B 009C 009D 009E 009F
- 00A0 00A1 00A2 00A3 00A4 00A5 00A6 00A7 00A8 00A9 00AA 00AB 00AC 00AD 00AE 00AF
- 00B0 00B1 00B2 00B3 00B4 00B5 00B6 00B7 00B8 00B9 00BA 00BB 00BC 00BD 00BE 00BF
- 00C0 00C1 00C2 00C3 00C4 00C5 00C6 00C7 00C8 00C9 00CA 00CB 00CC 00CD 00CE 00CF
- 00D0 00D1 00D2 00D3 00D4 00D5 00D6 00D7 00D8 00D9 00DA 00DB 00DC 00DD 00DE 00DF
- 00E0 00E1 00E2 00E3 00E4 00E5 00E6 00E7 00E8 00E9 00EA 00EB 00EC 00ED 00EE 00EF
- 00F0 00F1 00F2 00F3 00F4 00F5 00F6 00F7 00F8 00F9 00FA 00FB 00FC 00FD 00FE 00FF
+</charsets>
diff --git a/sql/share/charsets/hp8.conf b/sql/share/charsets/hp8.conf
deleted file mode 100644
index 07036d6f186..00000000000
--- a/sql/share/charsets/hp8.conf
+++ /dev/null
@@ -1,93 +0,0 @@
-# Configuration file for the hp8 character set
-
-# ctype array (must have 257 elements)
- 00
- 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20
- 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
- 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
- 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10
- 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01
- 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10
- 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02
- 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 20
- 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
- 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
- 20 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
- 10 20 20 10 10 10 10 10 10 10 10 10 10 10 10 10
- 10 10 10 10 10 02 10 10 10 10 10 10 02 10 02 02
- 01 10 10 01 02 10 10 02 01 10 01 01 01 10 10 10
- 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
- 10 10 20 20 20 20 10 10 10 10 10 10 10 10 10 20
-
-# to_lower array (must have 256 elements)
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F
- 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F
- 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F
- 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F
- 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
- 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
- A0 C8 C0 C9 C1 CD D1 DD A8 A9 AA AB AC CB C3 AF
- B0 B2 B2 B3 B5 B5 B7 B7 B8 B9 BA BB BC BD BE BF
- C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
- D4 D1 D6 D7 D4 D5 D6 D7 CC D9 CE CF C5 DD DE C2
- C4 E2 E2 E4 E4 D5 D9 C6 CA EA EA EC EC C7 EF EF
- F1 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF
-
-# to_upper array (must have 256 elements)
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
- 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F
- 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
- 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
- A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF
- B0 B1 B1 B3 B4 B4 B6 B6 B8 B9 BA BB BC BD BE BF
- A2 A4 DF AE E0 DC E7 ED A1 A3 E8 AD D8 A5 DA DB
- D0 A6 D2 D3 D0 E5 D2 D3 D8 E6 DA DB DC A7 DE DF
- E0 E1 E1 E3 E3 E5 E6 E7 E8 E9 E9 EB EB ED EE EE
- F0 F0 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF
-
-# sort_order array (must have 256 elements)
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- 50 51 52 53 54 55 56 57 58 59 5A 5C 5D 5B 5E 5F
- 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F
- 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
- 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
- A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF
- B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF
- C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
- D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF
- E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
- F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF
-
-# Unicode mapping (256 elements)
-0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F
-0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F
-0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F
-0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F
-0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F
-0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F
-0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F
-0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F
-0080 0081 0082 0083 0084 0085 0086 0087 0088 0089 008A 008B 008C 008D 008E 008F
-0090 0091 0092 0093 0094 0095 0096 0097 0098 0099 009A 009B 009C 009D 009E 009F
-00A0 00C0 00C2 00C8 00CA 00CB 00CE 00CF 00B4 02CB 02C6 00A8 02DC 00D9 00DB 20A4
-00AF 00DD 00FD 00B0 00C7 00E7 00D1 00F1 00A1 00BF 00A4 00A3 00A5 00A7 0192 00A2
-00E2 00EA 00F4 00FB 00E1 00E9 00F3 00FA 00E0 00E8 00F2 00F9 00E4 00EB 00F6 00FC
-00C5 00EE 00D8 00C6 00E5 00ED 00F8 00E6 00C4 00EC 00D6 00DC 00C9 00EF 00DF 00D4
-00C1 00C3 00E3 00D0 00F0 00CD 00CC 00D3 00D2 00D5 00F5 0160 0161 00DA 0178 00FF
-00DE 00FE 00B7 00B5 00B6 00BE 2014 00BC 00BD 00AA 00BA 00AB 25A0 00BB 00B1 0000
-
diff --git a/sql/share/charsets/hp8.xml b/sql/share/charsets/hp8.xml
new file mode 100644
index 00000000000..036f1cd067c
--- /dev/null
+++ b/sql/share/charsets/hp8.xml
@@ -0,0 +1,120 @@
+<?xml version='1.0' encoding="utf-8"?>
+
+<charsets>
+
+<charset name="hp8">
+
+<ctype>
+<map>
+ 00
+ 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20
+ 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
+ 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
+ 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10
+ 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01
+ 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10
+ 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02
+ 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 20
+ 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
+ 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
+ 20 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
+ 10 20 20 10 10 10 10 10 10 10 10 10 10 10 10 10
+ 10 10 10 10 10 02 10 10 10 10 10 10 02 10 02 02
+ 01 10 10 01 02 10 10 02 01 10 01 01 01 10 10 10
+ 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
+ 10 10 20 20 20 20 10 10 10 10 10 10 10 10 10 20
+</map>
+</ctype>
+
+
+<lower>
+<map>
+ 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
+ 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
+ 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
+ 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
+ 40 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F
+ 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F
+ 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F
+ 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F
+ 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
+ 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
+ A0 C8 C0 C9 C1 CD D1 DD A8 A9 AA AB AC CB C3 AF
+ B0 B2 B2 B3 B5 B5 B7 B7 B8 B9 BA BB BC BD BE BF
+ C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
+ D4 D1 D6 D7 D4 D5 D6 D7 CC D9 CE CF C5 DD DE C2
+ C4 E2 E2 E4 E4 D5 D9 C6 CA EA EA EC EC C7 EF EF
+ F1 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF
+</map>
+</lower>
+
+
+<upper>
+<map>
+ 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
+ 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
+ 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
+ 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
+ 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
+ 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
+ 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
+ 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F
+ 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
+ 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
+ A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF
+ B0 B1 B1 B3 B4 B4 B6 B6 B8 B9 BA BB BC BD BE BF
+ A2 A4 DF AE E0 DC E7 ED A1 A3 E8 AD D8 A5 DA DB
+ D0 A6 D2 D3 D0 E5 D2 D3 D8 E6 DA DB DC A7 DE DF
+ E0 E1 E1 E3 E3 E5 E6 E7 E8 E9 E9 EB EB ED EE EE
+ F0 F0 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF
+</map>
+</upper>
+
+
+<unicode>
+<map>
+0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F
+0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F
+0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F
+0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F
+0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F
+0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F
+0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F
+0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F
+0080 0081 0082 0083 0084 0085 0086 0087 0088 0089 008A 008B 008C 008D 008E 008F
+0090 0091 0092 0093 0094 0095 0096 0097 0098 0099 009A 009B 009C 009D 009E 009F
+00A0 00C0 00C2 00C8 00CA 00CB 00CE 00CF 00B4 02CB 02C6 00A8 02DC 00D9 00DB 20A4
+00AF 00DD 00FD 00B0 00C7 00E7 00D1 00F1 00A1 00BF 00A4 00A3 00A5 00A7 0192 00A2
+00E2 00EA 00F4 00FB 00E1 00E9 00F3 00FA 00E0 00E8 00F2 00F9 00E4 00EB 00F6 00FC
+00C5 00EE 00D8 00C6 00E5 00ED 00F8 00E6 00C4 00EC 00D6 00DC 00C9 00EF 00DF 00D4
+00C1 00C3 00E3 00D0 00F0 00CD 00CC 00D3 00D2 00D5 00F5 0160 0161 00DA 0178 00FF
+00DE 00FE 00B7 00B5 00B6 00BE 2014 00BC 00BD 00AA 00BA 00AB 25A0 00BB 00B1 0000
+
+</map>
+</unicode>
+
+
+<collation name="hp8">
+<map>
+ 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
+ 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
+ 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
+ 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
+ 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
+ 50 51 52 53 54 55 56 57 58 59 5A 5C 5D 5B 5E 5F
+ 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
+ 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F
+ 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
+ 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
+ A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF
+ B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF
+ C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
+ D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF
+ E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
+ F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF
+</map>
+</collation>
+
+</charset>
+
+</charsets>
diff --git a/sql/share/charsets/hungarian.conf b/sql/share/charsets/hungarian.conf
deleted file mode 100644
index dffaff9348d..00000000000
--- a/sql/share/charsets/hungarian.conf
+++ /dev/null
@@ -1,92 +0,0 @@
-# Configuration file for the hungarian character set
-
-# ctype array (must have 257 elements)
- 00
- 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20
- 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
- 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
- 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10
- 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01
- 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10
- 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02
- 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 20
- 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20 20
- 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 48
- 01 10 01 10 01 01 10 00 00 01 01 01 01 10 01 01
- 10 02 10 02 10 02 02 10 10 02 02 02 02 10 02 02
- 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
- 10 01 01 01 01 01 01 10 01 01 01 01 01 01 01 10
- 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
- 02 02 02 02 02 02 02 10 02 02 02 02 02 02 02 10
-
-# to_lower array (must have 256 elements)
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F
- 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F
- 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F
- 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F
- 80 81 82 83 84 85 86 87 88 89 8B 8B A1 A1 8E A0
- 82 91 92 93 94 A2 96 A3 96 94 81 9B 9C 9D 9E 9F
- A0 A1 A2 A3 B5 B6 A6 93 A8 B9 BA BB BC AD BE BF
- B0 B1 B2 B3 B4 E1 B6 B7 B8 B9 BA BB BC BD BE BF
- E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
- D0 F1 F2 F3 F4 F5 F6 D7 F8 F9 FA FB FC FD FE DF
- A2 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA 96 EC ED EE EF
- F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF
-
-# to_upper array (must have 256 elements)
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
- 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F
- 80 9A 90 83 84 85 86 87 88 89 8A 8A 8C 8D 8E 8F
- 90 91 92 A7 99 95 98 97 98 99 9A 9B 9C 9D 9E 9F
- 8F 8D 95 97 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF
- B0 A0 B2 A2 B4 B5 A5 B7 B8 A9 AA AB AC BD AE AF
- C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
- D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF
- E0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA EB CC CD CE CF
- F0 D1 D2 D3 D4 D5 D6 F7 D8 D9 DA DB DC DD DE FF
-
-# sort_order array (must have 256 elements)
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 41 47 48 4C 4E 53 54 55 56 5A 5B 5C 60 61 64
- 69 6A 6B 6E 72 75 7A 7B 7C 7D 7F 83 84 85 86 87
- 88 41 47 48 4C 4E 53 54 55 56 5A 5B 5C 60 61 64
- 69 6A 6B 6E 72 75 7A 7B 7C 7D 7F 89 8A 8B 8C 00
- 01 78 4E 04 05 06 07 08 09 0A 67 67 56 56 0F 41
- 4E 12 13 67 67 64 78 75 78 67 78 1C 1D 1E 1F FF
- 41 56 64 75 5E 6F FF 67 FF 70 71 73 80 FF 81 82
- FF 42 FF 5D FF 41 6F FF FF 70 71 73 80 FF 81 82
- 6C 41 44 45 46 5F 49 4B 4A 4E 51 52 50 56 57 4D
- FF 62 63 64 66 67 67 FF 6D 77 75 78 78 7E 74 FF
- 64 41 44 45 46 5F 49 4B 4A 4E 51 78 50 56 58 4D
- FF 62 63 64 66 67 67 FF 6D 77 75 78 78 7E 74 FF
-
-# Unicode mapping (256 elements)
-0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F
-0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F
-0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F
-0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F
-0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F
-0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F
-0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F
-0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F
-0080 0081 0082 0083 0084 0085 0086 0087 0088 0089 008A 008B 008C 008D 008E 008F
-0090 0091 0092 0093 0094 0095 0096 0097 0098 0099 009A 009B 009C 009D 009E 009F
-00A0 0104 02D8 0141 00A4 013D 015A 00A7 00A8 0160 015E 0164 0179 00AD 017D 017B
-00B0 0105 02DB 0142 00B4 013E 015B 02C7 00B8 0161 015F 0165 017A 02DD 017E 017C
-0154 00C1 00C2 0102 00C4 0139 0106 00C7 010C 00C9 0118 00CB 011A 00CD 00CE 010E
-0110 0143 0147 00D3 00D4 0150 00D6 00D7 0158 016E 00DA 0170 00DC 00DD 0162 00DF
-0155 00E1 00E2 0103 00E4 013A 0107 00E7 010D 00E9 0119 00EB 011B 00ED 00EE 010F
-0111 0144 0148 00F3 00F4 0151 00F6 00F7 0159 016F 00FA 0171 00FC 00FD 0163 02D9
diff --git a/sql/share/charsets/keybcs2.conf b/sql/share/charsets/keybcs2.xml
index f272960b683..bdbb364822f 100644
--- a/sql/share/charsets/keybcs2.conf
+++ b/sql/share/charsets/keybcs2.xml
@@ -1,4 +1,11 @@
-# ctype array (must be 257 elements)
+<?xml version='1.0' encoding="utf-8"?>
+
+<charsets>
+
+<charset name="keybcs2">
+
+<ctype>
+<map>
00
20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20
20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
@@ -16,8 +23,12 @@
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
02 02 01 02 01 02 00 02 01 01 01 02 00 02 02 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 48
+</map>
+</ctype>
-# to_lower array (must be 256 elements)
+
+<lower>
+<map>
00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
@@ -34,8 +45,12 @@
D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF
E0 E1 E2 E3 E4 E5 E6 E7 ED E9 EA EB EC ED EE EF
F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF
+</map>
+</lower>
+
-# to_upper array (must be 256 elements)
+<upper>
+<map>
00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
@@ -52,26 +67,12 @@
D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF
E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC E8 EE EF
F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF
+</map>
+</upper>
-# sort_order array (must be 256 elements)
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 41 44 45 47 49 50 51 52 53 54 55 56 57 58 5A
- 5E 5F 60 63 66 68 6C 6D 6E 6F 72 90 91 92 93 94
- 95 41 44 45 47 49 50 51 52 53 54 55 56 57 58 5A
- 5E 5F 60 63 66 68 6C 6D 6E 6F 72 96 97 98 99 9A
- 45 68 49 47 41 47 66 45 49 49 56 53 56 56 41 41
- 49 72 72 5A 5A 5A 68 68 6F 5A 68 63 56 6F 60 66
- 41 53 5A 68 58 58 68 5A 63 60 60 60 A0 A1 A2 A3
- A4 A5 A6 B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC
- BD BE BF C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC
- CD CE CF D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC
- 80 65 83 87 88 89 DD 8A 85 8B 84 81 DE 85 82 DF
- F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF
-# Unicode mappping (must be 256 elements)
+<unicode>
+<map>
0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F
0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F
0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F
@@ -88,4 +89,32 @@
2568 2564 2565 2559 2558 2552 2553 256B 256A 2518 250C 2588 2584 258C 2590 2580
03B1 00DF 0393 03C0 03A3 03C3 00B5 03C4 03A6 0398 03A9 03B4 221E 03C6 03B5 2229
2261 00B1 2265 2264 2320 2321 00F7 2248 00B0 2219 00B7 221A 207F 00B2 25A0 00A0
+</map>
+</unicode>
+
+
+<collation name="keybcs2">
+<map>
+ 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
+ 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
+ 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
+ 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
+ 40 41 44 45 47 49 50 51 52 53 54 55 56 57 58 5A
+ 5E 5F 60 63 66 68 6C 6D 6E 6F 72 90 91 92 93 94
+ 95 41 44 45 47 49 50 51 52 53 54 55 56 57 58 5A
+ 5E 5F 60 63 66 68 6C 6D 6E 6F 72 96 97 98 99 9A
+ 45 68 49 47 41 47 66 45 49 49 56 53 56 56 41 41
+ 49 72 72 5A 5A 5A 68 68 6F 5A 68 63 56 6F 60 66
+ 41 53 5A 68 58 58 68 5A 63 60 60 60 A0 A1 A2 A3
+ A4 A5 A6 B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC
+ BD BE BF C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC
+ CD CE CF D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC
+ 80 65 83 87 88 89 DD 8A 85 8B 84 81 DE 85 82 DF
+ F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF
+</map>
+</collation>
+
+</charset>
+
+</charsets>
diff --git a/sql/share/charsets/koi8_ru.conf b/sql/share/charsets/koi8_ru.conf
deleted file mode 100644
index b1d9755173f..00000000000
--- a/sql/share/charsets/koi8_ru.conf
+++ /dev/null
@@ -1,93 +0,0 @@
-# Configuration file for the koi8_ru character set
-
-# ctype array (must have 257 elements)
- 00
- 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20
- 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
- 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
- 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10
- 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01
- 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10
- 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02
- 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 20
- 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
- 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
- 10 10 10 02 10 10 10 10 10 10 10 10 10 10 10 10
- 10 10 10 01 10 10 10 10 10 10 10 10 10 10 10 10
- 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
- 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
- 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
- 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
-
-# to_lower array (must have 256 elements)
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F
- 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F
- 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F
- 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F
- 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
- 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
- A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF
- B0 B1 B2 A3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF
- C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
- D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF
- C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
- D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF
-
-# to_upper array (must have 256 elements)
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
- 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F
- 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
- 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
- A0 A1 A2 B3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF
- B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF
- E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
- F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF
- E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
- F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF
-
-# sort_order array (must have 256 elements)
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
- 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F
- 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
- 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
- A0 A1 A2 E5 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE
- AF B0 B1 E5 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD
- FE DF E0 F6 E3 E4 F4 E2 F5 E8 E9 EA EB EC ED EE
- EF FF F0 F1 F2 F3 E6 E1 FC FB E7 F8 FD F9 F7 FA
- FE DF E0 F6 E3 E4 F4 E2 F5 E8 E9 EA EB EC ED EE
- EF FF F0 F1 F2 F3 E6 E1 FC FB E7 F8 FD F9 F7 FA
-
-# Unicode mapping table (256 elements)
-
-0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000a 000b 000c 000d 000e 000f
-0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001a 001b 001c 001d 001e 001f
-0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002a 002b 002c 002d 002e 002f
-0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003a 003b 003c 003d 003e 003f
-0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004a 004b 004c 004d 004e 004f
-0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005a 005b 005c 005d 005e 005f
-0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006a 006b 006c 006d 006e 006f
-0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007a 007b 007c 007d 007e 007f
-2500 2502 250c 2510 2514 2518 251c 2524 252c 2534 253c 2580 2584 2588 258c 2590
-2591 2592 2593 2320 25a0 2219 221a 2248 2264 2265 00a0 2321 00b0 00b2 00b7 00f7
-2550 2551 2552 0451 2553 2554 2555 2556 2557 2558 2559 255a 255b 255c 255d 255e
-255f 2560 2561 0401 2562 2563 2564 2565 2566 2567 2568 2569 256a 256b 256c 00a9
-044e 0430 0431 0446 0434 0435 0444 0433 0445 0438 0439 043a 043b 043c 043d 043e
-043f 044f 0440 0441 0442 0443 0436 0432 044c 044b 0437 0448 044d 0449 0447 044a
-042e 0410 0411 0426 0414 0415 0424 0413 0425 0418 0419 041a 041b 041c 041d 041e
-041f 042f 0420 0421 0422 0423 0416 0412 042c 042b 0417 0428 042d 0429 0427 042a
diff --git a/sql/share/charsets/koi8r.xml b/sql/share/charsets/koi8r.xml
new file mode 100644
index 00000000000..dae780f14fc
--- /dev/null
+++ b/sql/share/charsets/koi8r.xml
@@ -0,0 +1,119 @@
+<?xml version='1.0' encoding="utf-8"?>
+
+<charsets>
+
+<charset name="koi8r">
+
+<ctype>
+<map>
+ 00
+ 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20
+ 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
+ 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
+ 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10
+ 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01
+ 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10
+ 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02
+ 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 20
+ 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
+ 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
+ 10 10 10 02 10 10 10 10 10 10 10 10 10 10 10 10
+ 10 10 10 01 10 10 10 10 10 10 10 10 10 10 10 10
+ 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
+ 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
+ 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
+ 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
+</map>
+</ctype>
+
+
+<lower>
+<map>
+ 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
+ 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
+ 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
+ 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
+ 40 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F
+ 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F
+ 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F
+ 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F
+ 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
+ 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
+ A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF
+ B0 B1 B2 A3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF
+ C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
+ D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF
+ C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
+ D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF
+</map>
+</lower>
+
+
+<upper>
+<map>
+ 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
+ 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
+ 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
+ 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
+ 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
+ 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
+ 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
+ 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F
+ 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
+ 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
+ A0 A1 A2 B3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF
+ B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF
+ E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
+ F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF
+ E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
+ F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF
+</map>
+</upper>
+
+
+<unicode>
+<map>
+0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000a 000b 000c 000d 000e 000f
+0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001a 001b 001c 001d 001e 001f
+0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002a 002b 002c 002d 002e 002f
+0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003a 003b 003c 003d 003e 003f
+0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004a 004b 004c 004d 004e 004f
+0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005a 005b 005c 005d 005e 005f
+0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006a 006b 006c 006d 006e 006f
+0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007a 007b 007c 007d 007e 007f
+2500 2502 250c 2510 2514 2518 251c 2524 252c 2534 253c 2580 2584 2588 258c 2590
+2591 2592 2593 2320 25a0 2219 221a 2248 2264 2265 00a0 2321 00b0 00b2 00b7 00f7
+2550 2551 2552 0451 2553 2554 2555 2556 2557 2558 2559 255a 255b 255c 255d 255e
+255f 2560 2561 0401 2562 2563 2564 2565 2566 2567 2568 2569 256a 256b 256c 00a9
+044e 0430 0431 0446 0434 0435 0444 0433 0445 0438 0439 043a 043b 043c 043d 043e
+043f 044f 0440 0441 0442 0443 0436 0432 044c 044b 0437 0448 044d 0449 0447 044a
+042e 0410 0411 0426 0414 0415 0424 0413 0425 0418 0419 041a 041b 041c 041d 041e
+041f 042f 0420 0421 0422 0423 0416 0412 042c 042b 0417 0428 042d 0429 0427 042a
+</map>
+</unicode>
+
+
+<collation name="koi8r">
+<map>
+ 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
+ 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
+ 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
+ 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
+ 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
+ 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
+ 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
+ 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F
+ 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
+ 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
+ A0 A1 A2 E5 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE
+ AF B0 B1 E5 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD
+ FE DF E0 F6 E3 E4 F4 E2 F5 E8 E9 EA EB EC ED EE
+ EF FF F0 F1 F2 F3 E6 E1 FC FB E7 F8 FD F9 F7 FA
+ FE DF E0 F6 E3 E4 F4 E2 F5 E8 E9 EA EB EC ED EE
+ EF FF F0 F1 F2 F3 E6 E1 FC FB E7 F8 FD F9 F7 FA
+</map>
+</collation>
+
+</charset>
+
+</charsets>
diff --git a/sql/share/charsets/koi8_ukr.conf b/sql/share/charsets/koi8u.xml
index 5a552900544..e6cba068997 100644
--- a/sql/share/charsets/koi8_ukr.conf
+++ b/sql/share/charsets/koi8u.xml
@@ -1,6 +1,11 @@
-# Configuration file for the koi8_ukr character set
+<?xml version='1.0' encoding="utf-8"?>
-# ctype array (must have 257 elements)
+<charsets>
+
+<charset name="koi8u">
+
+<ctype>
+<map>
00
20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20
20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
@@ -18,8 +23,12 @@
02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
+</map>
+</ctype>
+
-# to_lower array (must have 256 elements)
+<lower>
+<map>
00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
@@ -36,8 +45,12 @@
D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF
C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF
+</map>
+</lower>
-# to_upper array (must have 256 elements)
+
+<upper>
+<map>
00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
@@ -54,26 +67,12 @@
F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF
E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF
+</map>
+</upper>
-# sort_order array (must have 256 elements)
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
- 20 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F
- A5 A6 A7 A8 A9 AA AB AC AD AE AF B0 B1 B2 B3 B4
- B5 B6 B7 B8 B9 BA BB BC BD BE BF C0 C1 C2 C3 C4
- C5 C6 C7 88 87 C8 8C 8D C9 CA CB CC CD 84 CE CF
- D0 D1 D2 88 87 D3 8C 8D D4 D5 D6 D7 D8 84 D9 DA
- A3 80 81 9B 85 86 99 83 9A 8B 8E 8F 90 91 92 93
- 94 A4 95 96 97 98 89 82 A1 A0 8A 9D A2 9E 9C 9F
- A3 80 81 9B 85 86 99 83 9A 8B 8E 8F 90 91 92 93
- 94 A4 95 96 97 98 89 82 A1 A0 8A 9D A2 9E 9C 9F
-# Unicode mapping (256 elements)
+<unicode>
+<map>
0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F
0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F
0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F
@@ -90,3 +89,32 @@
043F 044F 0440 0441 0442 0443 0436 0432 044C 044B 0437 0448 044D 0449 0447 044A
042E 0410 0411 0426 0414 0415 0424 0413 0425 0418 0419 041A 041B 041C 041D 041E
041F 042F 0420 0421 0422 0423 0416 0412 042C 042B 0417 0428 042D 0429 0427 042A
+</map>
+</unicode>
+
+
+<collation name="koi8u">
+<map>
+ 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
+ 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
+ 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
+ 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
+ 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
+ 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
+ 20 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
+ 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F
+ A5 A6 A7 A8 A9 AA AB AC AD AE AF B0 B1 B2 B3 B4
+ B5 B6 B7 B8 B9 BA BB BC BD BE BF C0 C1 C2 C3 C4
+ C5 C6 C7 88 87 C8 8C 8D C9 CA CB CC CD 84 CE CF
+ D0 D1 D2 88 87 D3 8C 8D D4 D5 D6 D7 D8 84 D9 DA
+ A3 80 81 9B 85 86 99 83 9A 8B 8E 8F 90 91 92 93
+ 94 A4 95 96 97 98 89 82 A1 A0 8A 9D A2 9E 9C 9F
+ A3 80 81 9B 85 86 99 83 9A 8B 8E 8F 90 91 92 93
+ 94 A4 95 96 97 98 89 82 A1 A0 8A 9D A2 9E 9C 9F
+</map>
+</collation>
+
+</charset>
+
+</charsets>
+
diff --git a/sql/share/charsets/latin1.conf b/sql/share/charsets/latin1.conf
deleted file mode 100644
index 7cb5cfb3cfd..00000000000
--- a/sql/share/charsets/latin1.conf
+++ /dev/null
@@ -1,92 +0,0 @@
-# Configuration file for the latin1 character set
-
-# ctype array (must have 257 elements)
- 00
- 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20
- 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
- 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
- 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10
- 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01
- 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10
- 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02
- 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 20
- 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
- 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
- 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
- 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
- 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
- 01 01 01 01 01 01 01 10 01 01 01 01 01 01 01 02
- 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
- 02 02 02 02 02 02 02 10 02 02 02 02 02 02 02 02
-
-# to_lower array (must have 256 elements)
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F
- 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F
- 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F
- 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F
- 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
- 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
- A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF
- B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF
- E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
- F0 F1 F2 F3 F4 F5 F6 D7 F8 F9 FA FB FC FD FE DF
- E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
- F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF
-
-# to_upper array (must have 256 elements)
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
- 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F
- 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
- 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
- A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF
- B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF
- C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
- D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF
- C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
- D0 D1 D2 D3 D4 D5 D6 F7 D8 D9 DA DB DC DD DE FF
-
-# sort_order array (must have 256 elements)
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
- 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F
- 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
- 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
- A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF
- B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF
- 41 41 41 41 5C 5B 5C 43 45 45 45 45 49 49 49 49
- 44 4E 4F 4F 4F 4F 5D D7 D8 55 55 55 59 59 DE DF
- 41 41 41 41 5C 5B 5C 43 45 45 45 45 49 49 49 49
- 44 4E 4F 4F 4F 4F 5D F7 D8 55 55 55 59 59 DE FF
-
-# Unicode mapping (256 elements)
-0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F
-0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F
-0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F
-0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F
-0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F
-0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F
-0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F
-0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F
-0080 0081 0082 0083 0084 0085 0086 0087 0088 0089 008A 008B 008C 008D 008E 008F
-0090 0091 0092 0093 0094 0095 0096 0097 0098 0099 009A 009B 009C 009D 009E 009F
-00A0 00A1 00A2 00A3 00A4 00A5 00A6 00A7 00A8 00A9 00AA 00AB 00AC 00AD 00AE 00AF
-00B0 00B1 00B2 00B3 00B4 00B5 00B6 00B7 00B8 00B9 00BA 00BB 00BC 00BD 00BE 00BF
-00C0 00C1 00C2 00C3 00C4 00C5 00C6 00C7 00C8 00C9 00CA 00CB 00CC 00CD 00CE 00CF
-00D0 00D1 00D2 00D3 00D4 00D5 00D6 00D7 00D8 00D9 00DA 00DB 00DC 00DD 00DE 00DF
-00E0 00E1 00E2 00E3 00E4 00E5 00E6 00E7 00E8 00E9 00EA 00EB 00EC 00ED 00EE 00EF
-00F0 00F1 00F2 00F3 00F4 00F5 00F6 00F7 00F8 00F9 00FA 00FB 00FC 00FD 00FE 00FF
diff --git a/sql/share/charsets/latin1.xml b/sql/share/charsets/latin1.xml
new file mode 100644
index 00000000000..c14e369454e
--- /dev/null
+++ b/sql/share/charsets/latin1.xml
@@ -0,0 +1,233 @@
+<?xml version='1.0' encoding="utf-8"?>
+
+<charsets>
+
+<charset name="latin1">
+
+<ctype>
+<map>
+ 00
+ 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20
+ 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
+ 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
+ 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10
+ 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01
+ 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10
+ 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02
+ 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 20
+ 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
+ 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
+ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+ 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
+ 01 01 01 01 01 01 01 00 01 01 01 01 01 01 01 02
+ 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
+ 02 02 02 02 02 02 02 00 02 02 02 02 02 02 02 02
+</map>
+</ctype>
+
+
+<lower>
+<map>
+ 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
+ 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
+ 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
+ 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
+ 40 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F
+ 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F
+ 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F
+ 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F
+ 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
+ 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
+ A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF
+ B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF
+ E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
+ F0 F1 F2 F3 F4 F5 F6 D7 F8 F9 FA FB FC FD FE DF
+ E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
+ F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF
+</map>
+</lower>
+
+
+<upper>
+<map>
+ 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
+ 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
+ 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
+ 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
+ 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
+ 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
+ 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
+ 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F
+ 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
+ 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
+ A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF
+ B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF
+ C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
+ D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF
+ C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
+ D0 D1 D2 D3 D4 D5 D6 F7 D8 D9 DA DB DC DD DE FF
+</map>
+</upper>
+
+
+<unicode>
+<map>
+ 0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F
+ 0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F
+ 0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F
+ 0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F
+ 0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F
+ 0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F
+ 0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F
+ 0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F
+ 0080 0081 0082 0083 0084 0085 0086 0087 0088 0089 008A 008B 008C 008D 008E 008F
+ 0090 0091 0092 0093 0094 0095 0096 0097 0098 0099 009A 009B 009C 009D 009E 009F
+ 00A0 00A1 00A2 00A3 00A4 00A5 00A6 00A7 00A8 00A9 00AA 00AB 00AC 00AD 00AE 00AF
+ 00B0 00B1 00B2 00B3 00B4 00B5 00B6 00B7 00B8 00B9 00BA 00BB 00BC 00BD 00BE 00BF
+ 00C0 00C1 00C2 00C3 00C4 00C5 00C6 00C7 00C8 00C9 00CA 00CB 00CC 00CD 00CE 00CF
+ 00D0 00D1 00D2 00D3 00D4 00D5 00D6 00D7 00D8 00D9 00DA 00DB 00DC 00DD 00DE 00DF
+ 00E0 00E1 00E2 00E3 00E4 00E5 00E6 00E7 00E8 00E9 00EA 00EB 00EC 00ED 00EE 00EF
+ 00F0 00F1 00F2 00F3 00F4 00F5 00F6 00F7 00F8 00F9 00FA 00FB 00FC 00FD 00FE 00FF
+</map>
+</unicode>
+
+
+<collation name="latin1">
+<map>
+ 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
+ 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
+ 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
+ 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
+ 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
+ 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
+ 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
+ 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F
+ 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
+ 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
+ A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF
+ B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF
+ 41 41 41 41 5C 5B 5C 43 45 45 45 45 49 49 49 49
+ 44 4E 4F 4F 4F 4F 5D D7 D8 55 55 55 59 59 DE DF
+ 41 41 41 41 5C 5B 5C 43 45 45 45 45 49 49 49 49
+ 44 4E 4F 4F 4F 4F 5D F7 D8 55 55 55 59 59 DE FF
+</map>
+</collation>
+
+
+<collation name="german1">
+<map>
+ 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
+ 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
+ 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
+ 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
+ 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
+ 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
+ 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
+ 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F
+ 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
+ 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
+ A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF
+ B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF
+ 41 41 41 41 41 41 41 43 45 45 45 45 49 49 49 49
+ D0 4E 4F 4F 4F 4F 4F D7 4F 55 55 55 55 59 DE 53
+ 41 41 41 41 41 41 41 43 45 45 45 45 49 49 49 49
+ D0 4E 4F 4F 4F 4F 4F F7 4F 55 55 55 55 59 DE FF
+</map>
+</collation>
+
+
+<collation name="danish">
+<map>
+ 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
+ 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
+ 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
+ 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
+ 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
+ 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
+ 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
+ 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F
+ 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
+ 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
+ A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF
+ B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF
+ 41 41 41 41 5B 5D 5B 43 45 45 45 45 49 49 49 49
+ 44 4E 4F 4F 4F 4F 5C D7 5C 55 55 55 59 59 DE DF
+ 41 41 41 41 5B 5D 5B 43 45 45 45 45 49 49 49 49
+ 44 4E 4F 4F 4F 4F 5C F7 5C 55 55 55 59 59 DE FF
+</map>
+</collation>
+
+
+<collation name="latin1_de"/>
+
+
+<collation name="latin1_bin">
+<map>
+ 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
+ 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
+ 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
+ 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
+ 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
+ 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
+ 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F
+ 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F
+ 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
+ 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
+ A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF
+ B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF
+ C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
+ D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF
+ E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
+ F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF
+</map>
+</collation>
+
+
+<collation name="latin1_ci_as">
+<map>
+ 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
+ 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
+ 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
+ 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
+ 40 41 51 53 57 5B 65 67 69 6B 75 77 79 7B 7D 81
+ 8F 91 93 95 98 9A A4 A6 A8 AA AF B3 B4 B5 B6 B7
+ B8 41 51 53 57 5B 65 67 69 6B 75 77 79 7B 7D 81
+ 8F 91 93 95 98 9A A4 A6 A8 AA AF B9 BA BB BC BF
+ C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
+ D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF
+ E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
+ F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF
+ 43 45 47 49 4B 4D 4F 55 5D 5F 61 63 6D 6F 71 73
+ 59 7F 83 85 87 89 8B BD 8D 9C 9E A0 A2 AC B1 97
+ 43 45 47 49 4B 4D 4F 55 5D 5F 61 63 6D 6F 71 73
+ 59 7F 83 85 87 89 8B BE 8D 9C 9E A0 A2 AC B1 AE
+</map>
+</collation>
+
+
+<collation name="latin1_cs_as">
+<map>
+ 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
+ 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
+ 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
+ 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
+ 40 41 51 53 57 5B 65 67 69 6B 75 77 79 7B 7D 81
+ 8F 91 93 95 98 9A A4 A6 A8 AA AF B3 B4 B5 B6 B7
+ B8 42 52 54 58 5C 66 68 6A 6C 76 78 7A 7C 7E 82
+ 90 92 94 96 99 9B A5 A7 A9 AB B0 B9 BA BB BC BF
+ C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
+ D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF
+ E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
+ F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF
+ 43 45 47 49 4B 4D 4F 55 5D 5F 61 63 6D 6F 71 73
+ 59 7F 83 85 87 89 8B BD 8D 9C 9E A0 A2 AC B1 97
+ 44 46 48 4A 4C 4E 50 56 5E 60 62 64 6E 70 72 74
+ 5A 80 84 86 88 8A 8C BE 8E 9D 9F A1 A3 AD B2 AE
+</map>
+</collation>
+
+
+</charset>
+
+</charsets>
diff --git a/sql/share/charsets/latin1cias.conf b/sql/share/charsets/latin1cias.conf
deleted file mode 100644
index 3b0e104aafd..00000000000
--- a/sql/share/charsets/latin1cias.conf
+++ /dev/null
@@ -1,97 +0,0 @@
-#
-# Latin1, accent sensitive, case insensitive
-#
-# Sorting for Dutch, English, French, German (Duden),
-# Italian, Latin, Pogtuguese, Spanish
-#
-# ctype array (must be 257 elements)
- 00
- 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20
- 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
- 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
- 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10
- 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01
- 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10
- 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02
- 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 20
- 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
- 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
- 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
- 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
- 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
- 01 01 01 01 01 01 01 00 01 01 01 01 01 01 01 02
- 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
- 02 02 02 02 02 02 02 00 02 02 02 02 02 02 02 02
-
-# to_lower array (must be 256 elements)
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F
- 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F
- 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F
- 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F
- 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
- 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
- A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF
- B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF
- E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
- F0 F1 F2 F3 F4 F5 F6 D7 F8 F9 FA FB FC FD FE DF
- E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
- F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF
-
-# to_upper array (must be 256 elements)
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
- 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F
- 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
- 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
- A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF
- B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF
- C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
- D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF
- C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
- D0 D1 D2 D3 D4 D5 D6 F7 D8 D9 DA DB DC DD DE FF
-
-# sort_order array (must be 256 elements)
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 41 51 53 57 5B 65 67 69 6B 75 77 79 7B 7D 81
- 8F 91 93 95 98 9A A4 A6 A8 AA AF B3 B4 B5 B6 B7
- B8 41 51 53 57 5B 65 67 69 6B 75 77 79 7B 7D 81
- 8F 91 93 95 98 9A A4 A6 A8 AA AF B9 BA BB BC BF
- C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
- D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF
- E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
- F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF
- 43 45 47 49 4B 4D 4F 55 5D 5F 61 63 6D 6F 71 73
- 59 7F 83 85 87 89 8B BD 8D 9C 9E A0 A2 AC B1 97
- 43 45 47 49 4B 4D 4F 55 5D 5F 61 63 6D 6F 71 73
- 59 7F 83 85 87 89 8B BE 8D 9C 9E A0 A2 AC B1 AE
-
-# Unicode mapping (must be 256 elements)
- 0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F
- 0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F
- 0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F
- 0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F
- 0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F
- 0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F
- 0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F
- 0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F
- 0080 0081 0082 0083 0084 0085 0086 0087 0088 0089 008A 008B 008C 008D 008E 008F
- 0090 0091 0092 0093 0094 0095 0096 0097 0098 0099 009A 009B 009C 009D 009E 009F
- 00A0 00A1 00A2 00A3 00A4 00A5 00A6 00A7 00A8 00A9 00AA 00AB 00AC 00AD 00AE 00AF
- 00B0 00B1 00B2 00B3 00B4 00B5 00B6 00B7 00B8 00B9 00BA 00BB 00BC 00BD 00BE 00BF
- 00C0 00C1 00C2 00C3 00C4 00C5 00C6 00C7 00C8 00C9 00CA 00CB 00CC 00CD 00CE 00CF
- 00D0 00D1 00D2 00D3 00D4 00D5 00D6 00D7 00D8 00D9 00DA 00DB 00DC 00DD 00DE 00DF
- 00E0 00E1 00E2 00E3 00E4 00E5 00E6 00E7 00E8 00E9 00EA 00EB 00EC 00ED 00EE 00EF
- 00F0 00F1 00F2 00F3 00F4 00F5 00F6 00F7 00F8 00F9 00FA 00FB 00FC 00FD 00FE 00FF
-
diff --git a/sql/share/charsets/latin1csas.conf b/sql/share/charsets/latin1csas.conf
deleted file mode 100644
index cb3a1285de8..00000000000
--- a/sql/share/charsets/latin1csas.conf
+++ /dev/null
@@ -1,97 +0,0 @@
-#
-# Latin1, accent sensitive, case sensitive
-#
-# Sorting for Dutch, English, French, German (Duden),
-# Italian, Latin, Pogtuguese, Spanish
-#
-# ctype array (must be 257 elements)
- 00
- 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20
- 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
- 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
- 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10
- 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01
- 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10
- 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02
- 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 20
- 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
- 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
- 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
- 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
- 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
- 01 01 01 01 01 01 01 00 01 01 01 01 01 01 01 02
- 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
- 02 02 02 02 02 02 02 00 02 02 02 02 02 02 02 02
-
-# to_lower array (must be 256 elements)
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F
- 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F
- 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F
- 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F
- 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
- 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
- A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF
- B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF
- E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
- F0 F1 F2 F3 F4 F5 F6 D7 F8 F9 FA FB FC FD FE DF
- E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
- F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF
-
-# to_upper array (must be 256 elements)
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
- 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F
- 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
- 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
- A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF
- B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF
- C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
- D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF
- C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
- D0 D1 D2 D3 D4 D5 D6 F7 D8 D9 DA DB DC DD DE FF
-
-# sort_order array (must be 256 elements)
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 41 51 53 57 5B 65 67 69 6B 75 77 79 7B 7D 81
- 8F 91 93 95 98 9A A4 A6 A8 AA AF B3 B4 B5 B6 B7
- B8 42 52 54 58 5C 66 68 6A 6C 76 78 7A 7C 7E 82
- 90 92 94 96 99 9B A5 A7 A9 AB B0 B9 BA BB BC BF
- C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
- D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF
- E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
- F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF
- 43 45 47 49 4B 4D 4F 55 5D 5F 61 63 6D 6F 71 73
- 59 7F 83 85 87 89 8B BD 8D 9C 9E A0 A2 AC B1 97
- 44 46 48 4A 4C 4E 50 56 5E 60 62 64 6E 70 72 74
- 5A 80 84 86 88 8A 8C BE 8E 9D 9F A1 A3 AD B2 AE
-
-# Unicode mapping (must be 256 elements)
- 0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F
- 0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F
- 0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F
- 0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F
- 0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F
- 0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F
- 0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F
- 0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F
- 0080 0081 0082 0083 0084 0085 0086 0087 0088 0089 008A 008B 008C 008D 008E 008F
- 0090 0091 0092 0093 0094 0095 0096 0097 0098 0099 009A 009B 009C 009D 009E 009F
- 00A0 00A1 00A2 00A3 00A4 00A5 00A6 00A7 00A8 00A9 00AA 00AB 00AC 00AD 00AE 00AF
- 00B0 00B1 00B2 00B3 00B4 00B5 00B6 00B7 00B8 00B9 00BA 00BB 00BC 00BD 00BE 00BF
- 00C0 00C1 00C2 00C3 00C4 00C5 00C6 00C7 00C8 00C9 00CA 00CB 00CC 00CD 00CE 00CF
- 00D0 00D1 00D2 00D3 00D4 00D5 00D6 00D7 00D8 00D9 00DA 00DB 00DC 00DD 00DE 00DF
- 00E0 00E1 00E2 00E3 00E4 00E5 00E6 00E7 00E8 00E9 00EA 00EB 00EC 00ED 00EE 00EF
- 00F0 00F1 00F2 00F3 00F4 00F5 00F6 00F7 00F8 00F9 00FA 00FB 00FC 00FD 00FE 00FF
-
diff --git a/sql/share/charsets/latin2.conf b/sql/share/charsets/latin2.conf
deleted file mode 100644
index cc21af9faa1..00000000000
--- a/sql/share/charsets/latin2.conf
+++ /dev/null
@@ -1,92 +0,0 @@
-# Configuration file for the latin2 character set
-
-# ctype array (must have 257 elements)
- 00
- 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20
- 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
- 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
- 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10
- 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01
- 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10
- 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02
- 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 00
- 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
- 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
- 48 01 10 01 10 01 01 10 10 01 01 01 01 10 01 01
- 10 02 10 02 10 02 02 10 10 02 02 02 02 10 02 02
- 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
- 10 01 01 01 01 01 01 10 01 01 01 01 01 01 01 10
- 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
- 02 02 02 02 02 02 02 10 02 02 02 02 02 02 02 10
-
-# to_lower array (must have 256 elements)
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F
- 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F
- 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F
- 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F
- 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
- 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
- A0 B1 A2 B3 A4 B5 B6 A7 A8 B9 BA BB BC AD BE BF
- B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF
- E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
- D0 F1 F2 F3 F4 F5 F6 D7 F8 F9 FA FB FC FD FE DF
- E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
- F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF
-
-# to_upper array (must have 256 elements)
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
- 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F
- 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
- 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
- A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF
- B0 A1 B2 A3 B4 A5 A6 B7 B8 A9 AA AB AC BD AE AF
- C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
- D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF
- C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
- F0 D1 D2 D3 D4 D5 D6 F7 D8 D9 DA DB DC DD DE FF
-
-# sort_order array (must have 256 elements)
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 41 44 45 48 49 4B 4C 4D 4E 4F 50 51 53 54 56
- 58 59 5A 5B 5E 5F 60 61 62 63 64 68 69 6A 6B 6C
- 6D 41 44 45 48 49 4B 4C 4D 4E 4F 50 51 53 54 56
- 58 59 5A 5B 5E 5F 60 61 62 63 64 6E 6F 70 71 FF
- FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
- FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
- FF 42 FF 52 FF 51 5C FF FF 5D 5B 5E 65 FF 67 66
- FF 42 FF 52 FF 51 5C FF FF 5D 5B 5E 65 FF 67 66
- 5A 43 43 43 43 51 46 45 47 49 4A 49 49 4E 4E 48
- FF 55 54 57 56 56 56 FF 5A 5F 5F 5F 5F 63 5E FF
- 5A 43 43 43 43 51 46 45 47 49 4A 49 49 4E 4E 48
- FF 55 54 57 56 56 56 FF 5A 5F 5F 5F 5F 63 5E FF
-
-# Unicode mapping (256 elements)
-0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F
-0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F
-0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F
-0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F
-0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F
-0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F
-0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F
-0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F
-0080 0081 0082 0083 0084 0085 0086 0087 0088 0089 008A 008B 008C 008D 008E 008F
-0090 0091 0092 0093 0094 0095 0096 0097 0098 0099 009A 009B 009C 009D 009E 009F
-00A0 0104 02D8 0141 00A4 013D 015A 00A7 00A8 0160 015E 0164 0179 00AD 017D 017B
-00B0 0105 02DB 0142 00B4 013E 015B 02C7 00B8 0161 015F 0165 017A 02DD 017E 017C
-0154 00C1 00C2 0102 00C4 0139 0106 00C7 010C 00C9 0118 00CB 011A 00CD 00CE 010E
-0110 0143 0147 00D3 00D4 0150 00D6 00D7 0158 016E 00DA 0170 00DC 00DD 0162 00DF
-0155 00E1 00E2 0103 00E4 013A 0107 00E7 010D 00E9 0119 00EB 011B 00ED 00EE 010F
-0111 0144 0148 00F3 00F4 0151 00F6 00F7 0159 016F 00FA 0171 00FC 00FD 0163 02D9
diff --git a/sql/share/charsets/latin2.xml b/sql/share/charsets/latin2.xml
new file mode 100644
index 00000000000..377ab19e8ad
--- /dev/null
+++ b/sql/share/charsets/latin2.xml
@@ -0,0 +1,167 @@
+<?xml version='1.0' encoding="utf-8"?>
+
+<charsets>
+
+<charset name="latin2">
+
+<ctype>
+<map>
+ 00
+ 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20
+ 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
+ 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
+ 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10
+ 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01
+ 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10
+ 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02
+ 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 00
+ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+ 48 01 10 01 10 01 01 10 10 01 01 01 01 10 01 01
+ 10 02 10 02 10 02 02 10 10 02 02 02 02 10 02 02
+ 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
+ 10 01 01 01 01 01 01 10 01 01 01 01 01 01 01 10
+ 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
+ 02 02 02 02 02 02 02 10 02 02 02 02 02 02 02 10
+</map>
+</ctype>
+
+
+<lower>
+<map>
+ 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
+ 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
+ 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
+ 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
+ 40 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F
+ 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F
+ 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F
+ 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F
+ 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
+ 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
+ A0 B1 A2 B3 A4 B5 B6 A7 A8 B9 BA BB BC AD BE BF
+ B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF
+ E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
+ D0 F1 F2 F3 F4 F5 F6 D7 F8 F9 FA FB FC FD FE DF
+ E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
+ F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF
+</map>
+</lower>
+
+
+<upper>
+<map>
+ 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
+ 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
+ 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
+ 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
+ 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
+ 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
+ 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
+ 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F
+ 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
+ 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
+ A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF
+ B0 A1 B2 A3 B4 A5 A6 B7 B8 A9 AA AB AC BD AE AF
+ C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
+ D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF
+ C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
+ F0 D1 D2 D3 D4 D5 D6 F7 D8 D9 DA DB DC DD DE FF
+</map>
+</upper>
+
+
+<unicode>
+<map>
+0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F
+0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F
+0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F
+0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F
+0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F
+0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F
+0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F
+0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F
+0080 0081 0082 0083 0084 0085 0086 0087 0088 0089 008A 008B 008C 008D 008E 008F
+0090 0091 0092 0093 0094 0095 0096 0097 0098 0099 009A 009B 009C 009D 009E 009F
+00A0 0104 02D8 0141 00A4 013D 015A 00A7 00A8 0160 015E 0164 0179 00AD 017D 017B
+00B0 0105 02DB 0142 00B4 013E 015B 02C7 00B8 0161 015F 0165 017A 02DD 017E 017C
+0154 00C1 00C2 0102 00C4 0139 0106 00C7 010C 00C9 0118 00CB 011A 00CD 00CE 010E
+0110 0143 0147 00D3 00D4 0150 00D6 00D7 0158 016E 00DA 0170 00DC 00DD 0162 00DF
+0155 00E1 00E2 0103 00E4 013A 0107 00E7 010D 00E9 0119 00EB 011B 00ED 00EE 010F
+0111 0144 0148 00F3 00F4 0151 00F6 00F7 0159 016F 00FA 0171 00FC 00FD 0163 02D9
+</map>
+</unicode>
+
+
+<collation name="latin2">
+<map>
+ 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
+ 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
+ 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
+ 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
+ 40 41 44 45 48 49 4B 4C 4D 4E 4F 50 51 53 54 56
+ 58 59 5A 5B 5E 5F 60 61 62 63 64 68 69 6A 6B 6C
+ 6D 41 44 45 48 49 4B 4C 4D 4E 4F 50 51 53 54 56
+ 58 59 5A 5B 5E 5F 60 61 62 63 64 6E 6F 70 71 FF
+ FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
+ FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
+ FF 42 FF 52 FF 51 5C FF FF 5D 5B 5E 65 FF 67 66
+ FF 42 FF 52 FF 51 5C FF FF 5D 5B 5E 65 FF 67 66
+ 5A 43 43 43 43 51 46 45 47 49 4A 49 49 4E 4E 48
+ FF 55 54 57 56 56 56 FF 5A 5F 5F 5F 5F 63 5E FF
+ 5A 43 43 43 43 51 46 45 47 49 4A 49 49 4E 4E 48
+ FF 55 54 57 56 56 56 FF 5A 5F 5F 5F 5F 63 5E FF
+</map>
+</collation>
+
+
+<collation name="croat">
+<map>
+ 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
+ 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
+ 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
+ 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
+ 40 41 42 43 46 48 49 4A 4B 4C 4D 4E 4F 50 51 52
+ 53 54 55 56 58 59 5A 5B 5C 5D 5E 5B 5C 5D 5E 5F
+ 60 41 42 43 46 48 49 4A 4B 4C 4D 4E 4F 50 51 52
+ 53 54 55 56 58 59 5A 5B 5C 5D 5E 7B 7C 7D 7E 7F
+ 80 81 82 83 84 85 86 87 88 89 57 8B 8C 8D 5F 8F
+ 90 91 92 93 94 95 96 97 98 99 57 9B 9C 9D 5F 9F
+ A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF
+ B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF
+ 41 41 41 41 5C 5B 45 43 44 45 45 45 49 49 49 49
+ 47 4E 4F 4F 4F 4F 5D D7 D8 55 55 55 59 59 DE DF
+ 41 41 41 41 5C 5B 45 43 44 45 45 45 49 49 49 49
+ 47 4E 4F 4F 4F 4F 5D F7 D8 55 55 55 59 59 DE FF
+</map>
+</collation>
+
+
+<collation name="czech"/>
+
+
+<collation name="hungarian">
+<map>
+ 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
+ 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
+ 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
+ 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
+ 40 41 47 48 4C 4E 53 54 55 56 5A 5B 5C 60 61 64
+ 69 6A 6B 6E 72 75 7A 7B 7C 7D 7F 83 84 85 86 87
+ 88 41 47 48 4C 4E 53 54 55 56 5A 5B 5C 60 61 64
+ 69 6A 6B 6E 72 75 7A 7B 7C 7D 7F 89 8A 8B 8C 00
+ 01 78 4E 04 05 06 07 08 09 0A 67 67 56 56 0F 41
+ 4E 12 13 67 67 64 78 75 78 67 78 1C 1D 1E 1F FF
+ 41 56 64 75 5E 6F FF 67 FF 70 71 73 80 FF 81 82
+ FF 42 FF 5D FF 41 6F FF FF 70 71 73 80 FF 81 82
+ 6C 41 44 45 46 5F 49 4B 4A 4E 51 52 50 56 57 4D
+ FF 62 63 64 66 67 67 FF 6D 77 75 78 78 7E 74 FF
+ 64 41 44 45 46 5F 49 4B 4A 4E 51 78 50 56 58 4D
+ FF 62 63 64 66 67 67 FF 6D 77 75 78 78 7E 74 FF
+</map>
+</collation>
+
+
+</charset>
+
+</charsets>
diff --git a/sql/share/charsets/latin5.conf b/sql/share/charsets/latin5.conf
deleted file mode 100644
index d603d019ce6..00000000000
--- a/sql/share/charsets/latin5.conf
+++ /dev/null
@@ -1,96 +0,0 @@
-# Configuration file for the latin5 (turkish) character set
-
-# Note: all accented characters are compared separately (this
-# is different from the default latin1 character set, where
-# e.g. a = ä = á, etc.).
-
-# ctype array (must have 257 elements)
- 00
- 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20
- 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
- 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
- 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10
- 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01
- 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10
- 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02
- 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 20
- 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
- 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
- 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
- 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
- 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
- 01 01 01 01 01 01 01 10 01 01 01 01 01 01 01 02
- 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
- 02 02 02 02 02 02 02 10 02 02 02 02 02 02 02 02
-
-# to_lower array (must have 256 elements)
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 61 62 63 64 65 66 67 68 FD 6A 6B 6C 6D 6E 6F
- 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F
- 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F
- 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F
- 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
- 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
- A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF
- B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF
- E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
- F0 F1 F2 F3 F4 F5 F6 D7 F8 F9 FA FB FC 69 FE DF
- E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
- F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF
-
-# to_upper array (must have 256 elements)
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
- 60 41 42 43 44 45 46 47 48 DD 4A 4B 4C 4D 4E 4F
- 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F
- 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
- 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
- A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF
- B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF
- C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
- D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF
- C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
- D0 D1 D2 D3 D4 D5 D6 F7 D8 D9 DA DB DC 49 DE FF
-
-# sort_order array (must have 256 elements)
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 41 42 43 45 46 47 48 4A 4B 4D 4E 4F 50 51 52
- 54 55 56 57 59 5A 5C 5D 5E 5F 60 61 62 63 64 65
- 66 41 42 43 45 46 47 48 4A 4C 4D 4E 4F 50 51 52
- 54 55 56 57 59 5A 5C 5D 5E 5F 60 87 88 89 8A 8B
- 8C 8D 8E 8F 90 91 92 93 94 95 96 97 98 99 9A 9B
- 9C 9D 9E 9F A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB
- AC AD AE AF B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB
- BC BD BE BF C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB
- CC CD CE CF D0 D1 D2 44 D3 D4 D5 D6 D7 D8 D9 DA
- 49 DB DC DD DE DF 53 E0 E1 E2 E3 E4 5B 4C 58 E5
- CC CD CE CF D0 D1 D2 44 D3 D4 D5 D6 D7 D8 D9 DA
- 49 DB DC DD DE DF 53 FA E1 E2 E3 E4 5B 4B 58 FF
-
-# Unicode mapping (256 elements)
-0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F
-0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F
-0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F
-0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F
-0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F
-0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F
-0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F
-0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F
-0080 0081 0082 0083 0084 0085 0086 0087 0088 0089 008A 008B 008C 008D 008E 008F
-0090 0091 0092 0093 0094 0095 0096 0097 0098 0099 009A 009B 009C 009D 009E 009F
-00A0 00A1 00A2 00A3 00A4 00A5 00A6 00A7 00A8 00A9 00AA 00AB 00AC 00AD 00AE 00AF
-00B0 00B1 00B2 00B3 00B4 00B5 00B6 00B7 00B8 00B9 00BA 00BB 00BC 00BD 00BE 00BF
-00C0 00C1 00C2 00C3 00C4 00C5 00C6 00C7 00C8 00C9 00CA 00CB 00CC 00CD 00CE 00CF
-011E 00D1 00D2 00D3 00D4 00D5 00D6 00D7 00D8 00D9 00DA 00DB 00DC 0130 015E 00DF
-00E0 00E1 00E2 00E3 00E4 00E5 00E6 00E7 00E8 00E9 00EA 00EB 00EC 00ED 00EE 00EF
-011F 00F1 00F2 00F3 00F4 00F5 00F6 00F7 00F8 00F9 00FA 00FB 00FC 0131 015F 00FF
diff --git a/sql/share/charsets/latin5.xml b/sql/share/charsets/latin5.xml
new file mode 100644
index 00000000000..a072ffc5072
--- /dev/null
+++ b/sql/share/charsets/latin5.xml
@@ -0,0 +1,125 @@
+<?xml version='1.0' encoding="utf-8"?>
+
+<charsets>
+
+<charset name="latin5">
+
+<ctype>
+<map>
+ 00
+ 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20
+ 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
+ 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
+ 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10
+ 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01
+ 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10
+ 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02
+ 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 20
+ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+ 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
+ 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
+ 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
+ 01 01 01 01 01 01 01 10 01 01 01 01 01 01 01 02
+ 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
+ 02 02 02 02 02 02 02 10 02 02 02 02 02 02 02 02
+</map>
+</ctype>
+
+
+<lower>
+<map>
+ 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
+ 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
+ 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
+ 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
+ 40 61 62 63 64 65 66 67 68 FD 6A 6B 6C 6D 6E 6F
+ 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F
+ 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F
+ 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F
+ 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
+ 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
+ A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF
+ B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF
+ E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
+ F0 F1 F2 F3 F4 F5 F6 D7 F8 F9 FA FB FC 69 FE DF
+ E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
+ F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF
+</map>
+</lower>
+
+
+<upper>
+<map>
+ 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
+ 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
+ 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
+ 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
+ 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
+ 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
+ 60 41 42 43 44 45 46 47 48 DD 4A 4B 4C 4D 4E 4F
+ 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F
+ 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
+ 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
+ A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF
+ B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF
+ C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
+ D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF
+ C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
+ D0 D1 D2 D3 D4 D5 D6 F7 D8 D9 DA DB DC 49 DE FF
+</map>
+</upper>
+
+
+<unicode>
+<map>
+0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F
+0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F
+0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F
+0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F
+0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F
+0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F
+0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F
+0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F
+0080 0081 0082 0083 0084 0085 0086 0087 0088 0089 008A 008B 008C 008D 008E 008F
+0090 0091 0092 0093 0094 0095 0096 0097 0098 0099 009A 009B 009C 009D 009E 009F
+00A0 00A1 00A2 00A3 00A4 00A5 00A6 00A7 00A8 00A9 00AA 00AB 00AC 00AD 00AE 00AF
+00B0 00B1 00B2 00B3 00B4 00B5 00B6 00B7 00B8 00B9 00BA 00BB 00BC 00BD 00BE 00BF
+00C0 00C1 00C2 00C3 00C4 00C5 00C6 00C7 00C8 00C9 00CA 00CB 00CC 00CD 00CE 00CF
+011E 00D1 00D2 00D3 00D4 00D5 00D6 00D7 00D8 00D9 00DA 00DB 00DC 0130 015E 00DF
+00E0 00E1 00E2 00E3 00E4 00E5 00E6 00E7 00E8 00E9 00EA 00EB 00EC 00ED 00EE 00EF
+011F 00F1 00F2 00F3 00F4 00F5 00F6 00F7 00F8 00F9 00FA 00FB 00FC 0131 015F 00FF
+</map>
+</unicode>
+
+
+<collation name="latin5">
+<!--
+# Note: all accented characters are compared separately (this
+# is different from the default latin1 character set, where
+# e.g. a = ä = á, etc.).
+-->
+<map>
+ 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
+ 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
+ 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
+ 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
+ 40 41 42 43 45 46 47 48 4A 4B 4D 4E 4F 50 51 52
+ 54 55 56 57 59 5A 5C 5D 5E 5F 60 61 62 63 64 65
+ 66 41 42 43 45 46 47 48 4A 4C 4D 4E 4F 50 51 52
+ 54 55 56 57 59 5A 5C 5D 5E 5F 60 87 88 89 8A 8B
+ 8C 8D 8E 8F 90 91 92 93 94 95 96 97 98 99 9A 9B
+ 9C 9D 9E 9F A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB
+ AC AD AE AF B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB
+ BC BD BE BF C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB
+ CC CD CE CF D0 D1 D2 44 D3 D4 D5 D6 D7 D8 D9 DA
+ 49 DB DC DD DE DF 53 E0 E1 E2 E3 E4 5B 4C 58 E5
+ CC CD CE CF D0 D1 D2 44 D3 D4 D5 D6 D7 D8 D9 DA
+ 49 DB DC DD DE DF 53 FA E1 E2 E3 E4 5B 4B 58 FF
+</map>
+</collation>
+
+
+</charset>
+
+</charsets>
diff --git a/sql/share/charsets/latin7.xml b/sql/share/charsets/latin7.xml
new file mode 100644
index 00000000000..eae4d501f44
--- /dev/null
+++ b/sql/share/charsets/latin7.xml
@@ -0,0 +1,168 @@
+<?xml version='1.0' encoding="utf-8"?>
+
+<charsets>
+
+<charset name="latin7">
+
+<ctype>
+<map>
+ 00
+ 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20
+ 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
+ 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
+ 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10
+ 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01
+ 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10
+ 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02
+ 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 20
+ 01 20 10 20 10 10 00 00 20 10 20 10 20 10 10 10
+ 20 10 10 10 10 10 10 10 20 00 20 10 20 10 10 20
+ 48 20 10 10 10 20 10 10 10 10 01 10 10 10 10 01
+ 10 10 10 10 10 10 10 10 10 10 02 10 10 10 10 02
+ 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
+ 01 01 01 01 01 01 01 10 01 01 01 01 01 01 01 02
+ 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
+ 02 02 02 02 02 02 02 10 02 02 02 02 02 02 02 10
+</map>
+</ctype>
+
+
+<lower>
+<map>
+ 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
+ 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
+ 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
+ 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
+ 40 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F
+ 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F
+ 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F
+ 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F
+ 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
+ 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
+ A0 A1 A2 A3 A4 A5 A6 A7 B8 A9 BA AB AC AD AE BF
+ B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF
+ E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
+ F0 F1 F2 F3 F4 F5 F6 D7 F8 F9 FA FB FC FD FE DF
+ E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
+ F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF
+</map>
+</lower>
+
+
+<upper>
+<map>
+ 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
+ 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
+ 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
+ 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
+ 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
+ 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
+ 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
+ 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F
+ 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
+ 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
+ A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF
+ B0 B1 B2 B3 B4 B5 B6 B7 A8 B9 AA BB BC BD BE AF
+ C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
+ D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF
+ C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
+ D0 D1 D2 D3 D4 D5 D6 F7 D8 D9 DA DB DC DD DE FF
+</map>
+</upper>
+
+
+<unicode>
+<map>
+0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F
+0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F
+0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F
+0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F
+0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F
+0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F
+0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F
+0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F
+0080 0081 0082 0083 0084 0085 0086 0087 0088 0089 008A 008B 008C 008D 008E 008F
+0090 0091 0092 0093 0094 0095 0096 0097 0098 0099 009A 009B 009C 009D 009E 009F
+00A0 201D 00A2 00A3 00A4 201E 00A6 00A7 00D8 00A9 0156 00AB 00AC 00AD 00AE 00C6
+00B0 00B1 00B2 00B3 201C 00B5 00B6 00B7 00F8 00B9 0157 00BB 00BC 00BD 00BE 00E6
+0104 012E 0100 0106 00C4 00C5 0118 0112 010C 00C9 0179 0116 0122 0136 012A 013B
+0160 0143 0145 00D3 014C 00D5 00D6 00D7 0172 0141 015A 016A 00DC 017B 017D 00DF
+0105 012F 0101 0107 00E4 00E5 0119 0113 010D 00E9 017A 0117 0123 0137 012B 013C
+0161 0144 0146 00F3 014D 00F5 00F6 00F7 0173 0142 015B 016B 00FC 017C 017E 2019
+</map>
+</unicode>
+
+
+<collation name="estonia">
+<map>
+ 00 02 03 04 05 06 07 08 09 2E 2F 30 31 32 0A 0B
+ 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B
+ 2C 33 34 35 36 37 38 27 39 3A 3B 5D 3C 28 3D 3E
+ 76 7A 7C 7E 80 81 82 83 84 85 3F 40 5E 5F 60 41
+ 42 86 90 92 98 9A A4 A6 AA AC B2 B4 B8 BE C0 C6
+ CE D0 D2 D6 E5 E8 EE F0 FA FC DD 43 44 45 46 47
+ 48 87 91 93 99 9B A5 A7 AB AD B3 B5 B9 BF C1 C7
+ CF D1 D3 D7 E6 E9 EF F1 FB FD DE 49 4A 4B 4C 1C
+ 01 1D 57 1E 5A 74 71 72 1F 75 20 5B 21 4E 52 51
+ 22 55 56 58 59 73 2A 2B 23 E7 24 5C 25 4F 54 26
+ 2D FE 66 67 68 FF 4D 69 CC 6A D4 62 6B 29 6C 8E
+ 6D 61 7D 7F 50 6E 6F 70 CD 7B D5 63 77 78 79 8F
+ 8C B0 88 94 F4 8A A2 A0 96 9C DF 9E A8 B6 AE BA
+ DB C2 C4 C8 CA F2 F6 64 EC BC D8 EA F8 E1 E3 DA
+ 8D B1 89 95 F5 8B A3 A1 97 9D E0 9F A9 B7 AF BB
+ DC C3 C5 C9 CB F3 F7 65 ED BD D9 EB F9 E2 E4 53
+</map>
+</collation>
+
+
+<collation name="latvian">
+<!-- Created for case-sensitive record search -->
+<!-- by Andis Grasis & Rihards Grasis e-mail:andis@cata.lv -->
+<map>
+ 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
+ 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
+ 30 32 33 34 35 36 37 2B 38 39 3A 5C 3B 2C 3C 3D
+ 76 7A 7C 7E 80 81 82 83 84 85 3E 3F 5D 5E 5F 40
+ 41 86 92 94 9A 9C A6 A8 AC AE B4 B6 BA C0 C2 C8
+ D4 D6 D8 DC E3 E6 EE F0 F2 F4 F6 42 43 44 45 46
+ 47 87 93 95 9B 9D A7 A9 AD AF B5 B7 BB C1 C3 C9
+ D5 D7 D9 DD E4 E7 EF F1 F3 F5 F7 48 49 4A 4B 20
+ 75 21 56 22 59 73 70 71 23 74 24 5A 25 4D 51 50
+ 26 54 55 57 58 72 2E 2F 27 E5 28 5B 29 4E 53 2A
+ 31 FE 65 66 67 FF 4C 68 D3 69 DA 61 6A 2D 6B 90
+ 6C 60 7D 7F 4F 6D 6E 6F D2 7B DB 62 77 78 79 91
+ 8E B2 8A 96 88 8C A4 A2 98 9E F8 A0 AA B8 B0 BE
+ E1 C4 C6 CA CE D0 CC 63 EC BC DE EA E8 FA FC E0
+ 8F B3 8B 97 89 8D A5 A3 99 9F F9 A1 AB B9 B1 BF
+ E2 C5 C7 CB CF D1 CD 64 ED BD DF EB E9 FB FD 52
+</map>
+</collation>
+
+
+<collation name="latvian1">
+<!-- Created for case-insensitive record search -->
+<!-- Created by Andis & Rihards -->
+<map>
+ 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
+ 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
+ 30 32 33 34 35 36 37 2B 38 39 3A 5C 3B 2C 3C 3D
+ 76 7A 7C 7E 80 81 82 83 84 85 3E 3F 5D 5E 5F 40
+ 41 86 92 94 9A 9C A6 A8 AC AE B4 B6 BA C0 C2 C8
+ D4 D6 D8 DC E3 E6 EE F0 F2 F4 F6 42 43 44 45 46
+ 47 86 92 94 9A 9C A6 A8 AC AE B4 B6 BA C0 C2 C8
+ D4 D6 D8 DC E2 E6 EE F0 F2 F4 F6 48 49 4A 4B 20
+ 75 21 56 22 59 73 70 71 23 74 24 5A 25 4D 51 50
+ 26 54 55 57 58 72 2E 2F 27 E5 28 5B 29 4E 53 2A
+ 31 FE 65 66 67 FF 4C 68 2D 69 DA 61 6A 2D 6B 90
+ 6C 60 7D 7F 4F 6D 6E 6F D3 7B DB 62 77 78 79 90
+ 8E B2 8A 96 88 8C A4 A2 98 9E F8 A0 AA B8 B0 BE
+ E1 C4 C6 CA CE D0 CC 63 EC BC DE EA E8 FA FC E0
+ 8E B2 8A 96 88 8C A4 A2 98 9E F8 A0 AA B8 B0 BE
+ E1 C4 C6 CA CE D0 CC 64 EC BC DE EA E8 FA FC 52
+</map>
+</collation>
+
+
+</charset>
+
+</charsets>
diff --git a/sql/share/charsets/latvian.conf b/sql/share/charsets/latvian.conf
deleted file mode 100644
index c3dee95d55c..00000000000
--- a/sql/share/charsets/latvian.conf
+++ /dev/null
@@ -1,95 +0,0 @@
-# Configuration file for the latvian character set.
-# Created for case-sensitive record search
-# Created accord with windows-1257 (iso-8859-4) codepage
-# Created by Andis Grasis & Rihards Grasis e-mail:andis@cata.lv
-
-# The ctype array must have 257 elements.
- 00
- 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20
- 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
- 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
- 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10
- 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01
- 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10
- 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02
- 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 20
- 01 20 10 20 10 10 00 00 20 10 20 10 20 10 10 10
- 20 10 10 10 10 10 10 10 20 00 20 10 20 10 10 20
- 48 20 10 10 10 20 10 10 10 10 01 10 10 10 10 01
- 10 10 10 10 10 10 10 10 10 10 02 10 10 10 10 02
- 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
- 01 01 01 01 01 01 01 10 01 01 01 01 01 01 01 02
- 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
- 02 02 02 02 02 02 02 10 02 02 02 02 02 02 02 10
-
-# The to_lower array must have 256 elements.
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F
- 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F
- 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F
- 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F
- 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
- 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
- A0 A1 A2 A3 A4 A5 A6 A7 B8 A9 BA AB AC AD AE BF
- B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF
- E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
- F0 F1 F2 F3 F4 F5 F6 D7 F8 F9 FA FB FC FD FE DF
- E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
- F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF
-
-# The to_upper array must have 256 elements.
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
- 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F
- 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
- 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
- A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF
- B0 B1 B2 B3 B4 B5 B6 B7 A8 B9 AA BB BC BD BE AF
- C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
- D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF
- C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
- D0 D1 D2 D3 D4 D5 D6 F7 D8 D9 DA DB DC DD DE FF
-
-# The sort_order array must have 256 elements.
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 30 32 33 34 35 36 37 2B 38 39 3A 5C 3B 2C 3C 3D
- 76 7A 7C 7E 80 81 82 83 84 85 3E 3F 5D 5E 5F 40
- 41 86 92 94 9A 9C A6 A8 AC AE B4 B6 BA C0 C2 C8
- D4 D6 D8 DC E3 E6 EE F0 F2 F4 F6 42 43 44 45 46
- 47 87 93 95 9B 9D A7 A9 AD AF B5 B7 BB C1 C3 C9
- D5 D7 D9 DD E4 E7 EF F1 F3 F5 F7 48 49 4A 4B 20
- 75 21 56 22 59 73 70 71 23 74 24 5A 25 4D 51 50
- 26 54 55 57 58 72 2E 2F 27 E5 28 5B 29 4E 53 2A
- 31 FE 65 66 67 FF 4C 68 D3 69 DA 61 6A 2D 6B 90
- 6C 60 7D 7F 4F 6D 6E 6F D2 7B DB 62 77 78 79 91
- 8E B2 8A 96 88 8C A4 A2 98 9E F8 A0 AA B8 B0 BE
- E1 C4 C6 CA CE D0 CC 63 EC BC DE EA E8 FA FC E0
- 8F B3 8B 97 89 8D A5 A3 99 9F F9 A1 AB B9 B1 BF
- E2 C5 C7 CB CF D1 CD 64 ED BD DF EB E9 FB FD 52
-
-# Unicode mapping (256 elements)
-0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F
-0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F
-0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F
-0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F
-0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F
-0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F
-0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F
-0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F
-0080 0081 0082 0083 0084 0085 0086 0087 0088 0089 008A 008B 008C 008D 008E 008F
-0090 0091 0092 0093 0094 0095 0096 0097 0098 0099 009A 009B 009C 009D 009E 009F
-00A0 201D 00A2 00A3 00A4 201E 00A6 00A7 00D8 00A9 0156 00AB 00AC 00AD 00AE 00C6
-00B0 00B1 00B2 00B3 201C 00B5 00B6 00B7 00F8 00B9 0157 00BB 00BC 00BD 00BE 00E6
-0104 012E 0100 0106 00C4 00C5 0118 0112 010C 00C9 0179 0116 0122 0136 012A 013B
-0160 0143 0145 00D3 014C 00D5 00D6 00D7 0172 0141 015A 016A 00DC 017B 017D 00DF
-0105 012F 0101 0107 00E4 00E5 0119 0113 010D 00E9 017A 0117 0123 0137 012B 013C
-0161 0144 0146 00F3 014D 00F5 00F6 00F7 0173 0142 015B 016B 00FC 017C 017E 2019
diff --git a/sql/share/charsets/latvian1.conf b/sql/share/charsets/latvian1.conf
deleted file mode 100644
index 3094525052d..00000000000
--- a/sql/share/charsets/latvian1.conf
+++ /dev/null
@@ -1,94 +0,0 @@
-# Configuration file for the latvian character set.
-# Created for case-insensitive record search
-# Created by Andis & Rihards
-
-# The ctype array must have 257 elements.
- 00
- 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20
- 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
- 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
- 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10
- 10 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
- 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10
- 10 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
- 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 20
- 00 00 10 00 10 10 00 00 00 00 00 10 00 10 10 10
- 00 10 10 10 10 10 10 10 00 00 00 10 00 10 10 00
- 48 00 10 10 10 00 10 10 10 10 01 10 10 10 10 10
- 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
- 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
- 01 01 01 01 01 01 01 10 01 01 01 01 01 01 01 02
- 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
- 02 02 02 02 02 02 02 10 02 02 02 02 02 02 02 10
-
-# The to_lower array must have 256 elements.
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F
- 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F
- 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F
- 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F
- 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
- 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
- A0 A1 A2 A3 A4 A5 A6 A7 B8 A9 BA AB AC AD AE BF
- B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF
- E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
- F0 F1 F2 F3 F4 F5 F6 D7 F8 F9 FA FB FC FD FE DF
- E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
- F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF
-
-# The to_upper array must have 256 elements.
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
- 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F
- 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
- 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
- A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF
- B0 B1 B2 B3 B4 B5 B6 B7 A8 B9 AA BB BC BD BE AF
- C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
- D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF
- C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
- D0 D1 D2 D3 D4 D5 D6 F7 D8 D9 DA DB DC DD DE FF
-
-# The sort_order array must have 256 elements.
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 30 32 33 34 35 36 37 2B 38 39 3A 5C 3B 2C 3C 3D
- 76 7A 7C 7E 80 81 82 83 84 85 3E 3F 5D 5E 5F 40
- 41 86 92 94 9A 9C A6 A8 AC AE B4 B6 BA C0 C2 C8
- D4 D6 D8 DC E3 E6 EE F0 F2 F4 F6 42 43 44 45 46
- 47 86 92 94 9A 9C A6 A8 AC AE B4 B6 BA C0 C2 C8
- D4 D6 D8 DC E2 E6 EE F0 F2 F4 F6 48 49 4A 4B 20
- 75 21 56 22 59 73 70 71 23 74 24 5A 25 4D 51 50
- 26 54 55 57 58 72 2E 2F 27 E5 28 5B 29 4E 53 2A
- 31 FE 65 66 67 FF 4C 68 2D 69 DA 61 6A 2D 6B 90
- 6C 60 7D 7F 4F 6D 6E 6F D3 7B DB 62 77 78 79 90
- 8E B2 8A 96 88 8C A4 A2 98 9E F8 A0 AA B8 B0 BE
- E1 C4 C6 CA CE D0 CC 63 EC BC DE EA E8 FA FC E0
- 8E B2 8A 96 88 8C A4 A2 98 9E F8 A0 AA B8 B0 BE
- E1 C4 C6 CA CE D0 CC 64 EC BC DE EA E8 FA FC 52
-
-# Unicode mapping (256 elements)
-0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F
-0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F
-0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F
-0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F
-0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F
-0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F
-0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F
-0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F
-0080 0081 0082 0083 0084 0085 0086 0087 0088 0089 008A 008B 008C 008D 008E 008F
-0090 0091 0092 0093 0094 0095 0096 0097 0098 0099 009A 009B 009C 009D 009E 009F
-00A0 201D 00A2 00A3 00A4 201E 00A6 00A7 00D8 00A9 0156 00AB 00AC 00AD 00AE 00C6
-00B0 00B1 00B2 00B3 201C 00B5 00B6 00B7 00F8 00B9 0157 00BB 00BC 00BD 00BE 00E6
-0104 012E 0100 0106 00C4 00C5 0118 0112 010C 00C9 0179 0116 0122 0136 012A 013B
-0160 0143 0145 00D3 014C 00D5 00D6 00D7 0172 0141 015A 016A 00DC 017B 017D 00DF
-0105 012F 0101 0107 00E4 00E5 0119 0113 010D 00E9 017A 0117 0123 0137 012B 013C
-0161 0144 0146 00F3 014D 00F5 00F6 00F7 0173 0142 015B 016B 00FC 017C 017E 2019
diff --git a/sql/share/charsets/macce.conf b/sql/share/charsets/macce.conf
deleted file mode 100644
index f3ac08df087..00000000000
--- a/sql/share/charsets/macce.conf
+++ /dev/null
@@ -1,91 +0,0 @@
-# ctype array (must be 257 elements)
- 00
- 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20
- 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
- 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
- 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10
- 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01
- 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10
- 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02
- 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 00
- 01 01 02 01 01 01 01 02 02 01 02 02 01 02 02 01
- 02 01 02 02 01 02 01 02 02 02 02 02 02 01 02 02
- 00 00 01 00 00 00 00 02 00 00 00 02 00 00 02 01
- 02 01 00 00 02 01 00 00 02 01 02 01 02 01 02 01
- 02 01 00 00 02 01 00 00 00 00 00 02 01 01 02 01
- 00 00 00 00 00 00 00 00 02 01 02 01 00 00 02 01
- 02 01 00 00 02 01 02 01 01 02 01 01 02 01 01 01
- 02 01 01 02 01 02 01 02 01 02 02 01 01 02 01 00
-
-# to_lower array (must be 256 elements)
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F
- 70 71 72 73 54 75 76 77 78 79 7A 5B 5C 5D 5E 5F
- 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F
- 70 71 72 73 54 75 76 77 78 79 7A 7B 7C 7D 7E 7F
- 8A 82 82 8E 88 9A 9F 87 88 8B 8A 8B 8D 8D 8E 90
- 90 93 92 93 95 95 98 97 98 99 9A 9B 9C 9E 9E 9F
- A0 A1 AB A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE B0
- B0 B4 B2 B3 B4 FA B6 B7 B8 BA BA BC BC BE BE C0
- C0 C4 C2 C3 C4 CB C6 C7 C8 C9 CA CB CE 9B CE D8
- D0 D1 D2 D3 D4 D5 D6 D7 D8 DA DA DE DC DD DE E0
- E0 E4 E2 E3 E4 E6 E6 87 E9 E9 92 EC EC F0 97 99
- F0 F3 9C F3 F5 F5 F7 F7 F9 F9 FA FD B8 FD AE FF
-
-# to_upper array (must be 256 elements)
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- 50 51 52 53 74 55 56 57 58 59 5A 5B 5C 5D 5E 5F
- 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- 50 51 52 53 74 55 56 57 58 59 5A 7B 7C 7D 7E 7F
- 80 81 81 83 84 85 86 E7 84 89 80 89 8C 8C 83 8F
- 8F 91 EA 91 94 94 96 EE 96 EF 85 CD F2 9D 9D 86
- A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA A2 AC AD FE AF
- AF B1 B2 B3 B1 B5 B6 B7 FC B9 B9 BB BB BD BD BF
- BF C1 C2 C3 C1 C5 C6 C7 C8 C9 CA C5 CC CD CC CF
- D0 D1 D2 D3 D4 D5 D6 D7 CF D9 D9 DB DC DD DB DF
- DF E1 E2 E3 E1 E5 E5 E7 E8 E8 EA EB EB ED EE EF
- ED F1 F2 F1 F4 F4 F6 F6 F8 F8 B5 FB FC FB FE FF
-
-# sort_order array (must be 256 elements)
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 41 46 47 4A 4C 52 53 55 56 5A 5B 5D 62 62 67
- 6F 70 71 75 79 81 88 89 8A 8B 8D 90 91 92 93 94
- 95 41 46 47 4A 4C 52 53 55 56 5A 5B 5D 62 62 67
- 6F 70 71 75 79 81 88 89 8A 8B 8D 96 97 98 99 9A
- 41 41 41 4C 41 67 81 41 41 47 41 47 47 47 4C 8D
- 8D 4A 56 4A 4C 4C 4C 67 4C 67 67 67 81 4C 4C 81
- A0 A1 4C A3 A4 A5 A6 75 A8 A9 AA 4C AC AD 53 56
- 56 56 B2 B3 56 5B B6 B7 5D 5D 5D 5D 5D 5D 5D 62
- 62 62 C2 C3 62 62 C6 C7 C8 C9 CA 62 67 67 67 67
- D0 D1 D2 D3 D4 D5 D6 D7 67 71 71 71 DC DD 71 71
- 71 75 E2 E3 75 75 75 41 79 79 56 8D 8D 81 67 67
- 81 81 81 81 81 81 81 81 8B 8B 5B 8D 5D 8D 53 FF
-
-# Unicode mappping (must be 256 elements)
- 0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F
- 0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F
- 0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F
- 0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F
- 0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F
- 0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F
- 0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F
- 0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F
- 00C4 0100 0101 00C9 0104 00D6 00DC 00E1 0105 010C 00E4 010D 0106 0107 00E9 0179
- 017A 010E 00ED 010F 0112 0113 0116 00F3 0117 00F4 00F6 00F5 00FA 011A 011B 00FC
- 2020 00B0 0118 00A3 00A7 2022 00B6 00DF 00AE 00A9 2122 0119 00A8 2260 0123 012E
- 012F 012A 2264 2265 012B 0136 2202 2211 0142 013B 013C 013D 013E 0139 013A 0145
- 0146 0143 00AC 221A 0144 0147 2206 00AB 00BB 2026 00A0 0148 0150 00D5 0151 014C
- 2013 2014 201C 201D 2018 2019 00F7 25CA 014D 0154 0155 0158 2039 203A 0159 0156
- 0157 0160 201A 201E 0161 015A 015B 00C1 0164 0165 00CD 017D 017E 016A 00D3 00D4
- 016B 016E 00DA 016F 0170 0171 0172 0173 00DD 00FD 0137 017B 0141 017C 0122 02C7
-
diff --git a/sql/share/charsets/macceciai.conf b/sql/share/charsets/macceciai.conf
deleted file mode 100644
index d7cdaddc425..00000000000
--- a/sql/share/charsets/macceciai.conf
+++ /dev/null
@@ -1,96 +0,0 @@
-# Mac OS Central European, case insensitive, accent sensitive
-#
-# Czech (cs), Hungarian (hu), Polish (pl), Romanian (ro), Croatian (hr),
-# Slovak (sk), Slovenian (sl), Sorbian.
-#
-# ctype array (must be 257 elements)
- 00
- 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20
- 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
- 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
- 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10
- 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01
- 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10
- 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02
- 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 00
- 01 01 02 01 01 01 01 02 02 01 02 02 01 02 02 01
- 02 01 02 02 01 02 01 02 02 02 02 02 02 01 02 02
- 00 00 01 00 00 00 00 02 00 00 00 02 00 00 02 01
- 02 01 00 00 02 01 00 00 02 01 02 01 02 01 02 01
- 02 01 00 00 02 01 00 00 00 00 00 02 01 01 02 01
- 00 00 00 00 00 00 00 00 02 01 02 01 00 00 02 01
- 02 01 00 00 02 01 02 01 01 02 01 01 02 01 01 01
- 02 01 01 02 01 02 01 02 01 02 02 01 01 02 01 00
-
-# to_lower array (must be 256 elements)
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F
- 70 71 72 73 54 75 76 77 78 79 7A 5B 5C 5D 5E 5F
- 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F
- 70 71 72 73 54 75 76 77 78 79 7A 7B 7C 7D 7E 7F
- 8A 82 82 8E 88 9A 9F 87 88 8B 8A 8B 8D 8D 8E 90
- 90 93 92 93 95 95 98 97 98 99 9A 9B 9C 9E 9E 9F
- A0 A1 AB A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE B0
- B0 B4 B2 B3 B4 FA B6 B7 B8 BA BA BC BC BE BE C0
- C0 C4 C2 C3 C4 CB C6 C7 C8 C9 CA CB CE 9B CE D8
- D0 D1 D2 D3 D4 D5 D6 D7 D8 DA DA DE DC DD DE E0
- E0 E4 E2 E3 E4 E6 E6 87 E9 E9 92 EC EC F0 97 99
- F0 F3 9C F3 F5 F5 F7 F7 F9 F9 FA FD B8 FD AE FF
-
-# to_upper array (must be 256 elements)
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- 50 51 52 53 74 55 56 57 58 59 5A 5B 5C 5D 5E 5F
- 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- 50 51 52 53 74 55 56 57 58 59 5A 7B 7C 7D 7E 7F
- 80 81 81 83 84 85 86 E7 84 89 80 89 8C 8C 83 8F
- 8F 91 EA 91 94 94 96 EE 96 EF 85 CD F2 9D 9D 86
- A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA A2 AC AD FE AF
- AF B1 B2 B3 B1 B5 B6 B7 FC B9 B9 BB BB BD BD BF
- BF C1 C2 C3 C1 C5 C6 C7 C8 C9 CA C5 CC CD CC CF
- D0 D1 D2 D3 D4 D5 D6 D7 CF D9 D9 DB DC DD DB DF
- DF E1 E2 E3 E1 E5 E5 E7 E8 E8 EA EB EB ED EE EF
- ED F1 F2 F1 F4 F4 F6 F6 F8 F8 B5 FB FC FB FE FF
-
-# sort_order array (must be 256 elements)
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 41 4B 4D 53 57 63 65 69 6B 73 75 79 83 85 8D
- 9B 9D 9F A7 AE B2 C0 C2 C4 C6 CA D2 D3 D4 D5 D6
- D7 41 4B 4D 53 57 63 65 69 6B 73 75 79 83 85 8D
- 9B 9D 9F A7 AE B2 C0 C2 C4 C6 CA D8 D9 DA DB DC
- 41 41 41 57 41 8D B2 41 41 4D 41 4D 4D 4D 57 CA
- CA 53 6B 53 57 57 57 8D 57 8D 8D 8D B2 57 57 B2
- DD DE 57 DF E0 E1 E2 A7 E3 E4 E5 57 E6 E7 65 6B
- 6B 6B E8 E9 6B 75 EA EB 79 79 79 79 79 79 79 85
- 85 85 EC ED 85 85 EE EF F0 F1 F2 85 8D 8D 8D 8D
- F3 F4 F5 F6 F7 F8 F9 FA 8D 9F 9F 9F FB FC 9F 9F
- 9F A7 FD FE A7 A7 A7 41 BE BE 6B CA CA B2 8D 8D
- B2 B2 B2 B2 B2 B2 B2 B2 C6 C6 75 CA 79 CA 65 FF
-
-# Unicode mapping (must be 256 elements)
- 0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F
- 0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F
- 0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F
- 0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F
- 0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F
- 0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F
- 0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F
- 0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F
- 00C4 0100 0101 00C9 0104 00D6 00DC 00E1 0105 010C 00E4 010D 0106 0107 00E9 0179
- 017A 010E 00ED 010F 0112 0113 0116 00F3 0117 00F4 00F6 00F5 00FA 011A 011B 00FC
- 2020 00B0 0118 00A3 00A7 2022 00B6 00DF 00AE 00A9 2122 0119 00A8 2260 0123 012E
- 012F 012A 2264 2265 012B 0136 2202 2211 0142 013B 013C 013D 013E 0139 013A 0145
- 0146 0143 00AC 221A 0144 0147 2206 00AB 00BB 2026 00A0 0148 0150 00D5 0151 014C
- 2013 2014 201C 201D 2018 2019 00F7 25CA 014D 0154 0155 0158 2039 203A 0159 0156
- 0157 0160 201A 201E 0161 015A 015B 00C1 0164 0165 00CD 017D 017E 016A 00D3 00D4
- 016B 016E 00DA 016F 0170 0171 0172 0173 00DD 00FD 0137 017B 0141 017C 0122 02C7
-
diff --git a/sql/share/charsets/maccecias.conf b/sql/share/charsets/maccecias.conf
deleted file mode 100644
index 8cefd4cf9ec..00000000000
--- a/sql/share/charsets/maccecias.conf
+++ /dev/null
@@ -1,96 +0,0 @@
-# Mac OS Central European, case insensitive, accent sensitive
-#
-# Czech (cs), Hungarian (hu), Polish (pl), Romanian (ro), Croatian (hr),
-# Slovak (sk), Slovenian (sl), Sorbian.
-#
-# ctype array (must be 257 elements)
- 00
- 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20
- 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
- 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
- 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10
- 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01
- 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10
- 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02
- 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 00
- 01 01 02 01 01 01 01 02 02 01 02 02 01 02 02 01
- 02 01 02 02 01 02 01 02 02 02 02 02 02 01 02 02
- 00 00 01 00 00 00 00 02 00 00 00 02 00 00 02 01
- 02 01 00 00 02 01 00 00 02 01 02 01 02 01 02 01
- 02 01 00 00 02 01 00 00 00 00 00 02 01 01 02 01
- 00 00 00 00 00 00 00 00 02 01 02 01 00 00 02 01
- 02 01 00 00 02 01 02 01 01 02 01 01 02 01 01 01
- 02 01 01 02 01 02 01 02 01 02 02 01 01 02 01 00
-
-# to_lower array (must be 256 elements)
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F
- 70 71 72 73 54 75 76 77 78 79 7A 5B 5C 5D 5E 5F
- 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F
- 70 71 72 73 54 75 76 77 78 79 7A 7B 7C 7D 7E 7F
- 8A 82 82 8E 88 9A 9F 87 88 8B 8A 8B 8D 8D 8E 90
- 90 93 92 93 95 95 98 97 98 99 9A 9B 9C 9E 9E 9F
- A0 A1 AB A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE B0
- B0 B4 B2 B3 B4 FA B6 B7 B8 BA BA BC BC BE BE C0
- C0 C4 C2 C3 C4 CB C6 C7 C8 C9 CA CB CE 9B CE D8
- D0 D1 D2 D3 D4 D5 D6 D7 D8 DA DA DE DC DD DE E0
- E0 E4 E2 E3 E4 E6 E6 87 E9 E9 92 EC EC F0 97 99
- F0 F3 9C F3 F5 F5 F7 F7 F9 F9 FA FD B8 FD AE FF
-
-# to_upper array (must be 256 elements)
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- 50 51 52 53 74 55 56 57 58 59 5A 5B 5C 5D 5E 5F
- 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- 50 51 52 53 74 55 56 57 58 59 5A 7B 7C 7D 7E 7F
- 80 81 81 83 84 85 86 E7 84 89 80 89 8C 8C 83 8F
- 8F 91 EA 91 94 94 96 EE 96 EF 85 CD F2 9D 9D 86
- A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA A2 AC AD FE AF
- AF B1 B2 B3 B1 B5 B6 B7 FC B9 B9 BB BB BD BD BF
- BF C1 C2 C3 C1 C5 C6 C7 C8 C9 CA C5 CC CD CC CF
- D0 D1 D2 D3 D4 D5 D6 D7 CF D9 D9 DB DC DD DB DF
- DF E1 E2 E3 E1 E5 E5 E7 E8 E8 EA EB EB ED EE EF
- ED F1 F2 F1 F4 F4 F6 F6 F8 F8 B5 FB FC FB FE FF
-
-# sort_order array (must be 256 elements)
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 41 4B 4D 53 57 63 65 69 6B 73 75 79 83 85 8D
- 9B 9D 9F A7 AE B2 C0 C2 C4 C6 CA D2 D3 D4 D5 D6
- D7 41 4B 4D 53 57 63 65 69 6B 73 75 79 83 85 8D
- 9B 9D 9F A7 AE B2 C0 C2 C4 C6 CA D8 D9 DA DB DC
- 45 47 47 59 49 91 B6 43 49 4F 45 4F 51 51 59 CE
- CE 55 71 55 5B 5B 5D 8F 5D 99 91 97 B8 5F 5F B6
- DD DE 61 DF E0 E1 E2 AD E3 E4 E5 61 E6 E7 67 6F
- 6F 6D E8 E9 6D 77 EA EB 7B 81 82 7F 7F 7D 7D 8B
- 8B 87 EC ED 87 89 EE EF F0 F1 F2 89 93 97 93 95
- F3 F4 F5 F6 F7 F8 F9 FA 95 A1 A1 A3 FB FC A3 A5
- A5 A9 FD FE A9 AB AB 43 B0 B0 71 CC CC BC 8F 99
- BC B4 B8 B4 BA BA BE BE C8 C8 77 D0 7B D0 67 FF
-
-# Unicode mapping (must be 256 elements)
- 0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F
- 0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F
- 0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F
- 0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F
- 0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F
- 0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F
- 0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F
- 0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F
- 00C4 0100 0101 00C9 0104 00D6 00DC 00E1 0105 010C 00E4 010D 0106 0107 00E9 0179
- 017A 010E 00ED 010F 0112 0113 0116 00F3 0117 00F4 00F6 00F5 00FA 011A 011B 00FC
- 2020 00B0 0118 00A3 00A7 2022 00B6 00DF 00AE 00A9 2122 0119 00A8 2260 0123 012E
- 012F 012A 2264 2265 012B 0136 2202 2211 0142 013B 013C 013D 013E 0139 013A 0145
- 0146 0143 00AC 221A 0144 0147 2206 00AB 00BB 2026 00A0 0148 0150 00D5 0151 014C
- 2013 2014 201C 201D 2018 2019 00F7 25CA 014D 0154 0155 0158 2039 203A 0159 0156
- 0157 0160 201A 201E 0161 015A 015B 00C1 0164 0165 00CD 017D 017E 016A 00D3 00D4
- 016B 016E 00DA 016F 0170 0171 0172 0173 00DD 00FD 0137 017B 0141 017C 0122 02C7
-
diff --git a/sql/share/charsets/maccecsas.conf b/sql/share/charsets/maccecsas.conf
deleted file mode 100644
index 8cc1de422f2..00000000000
--- a/sql/share/charsets/maccecsas.conf
+++ /dev/null
@@ -1,96 +0,0 @@
-# Mac OS Central European, case sensitive, accent sensitive
-#
-# Czech (cs), Hungarian (hu), Polish (pl), Romanian (ro), Croatian (hr),
-# Slovak (sk), Slovenian (sl), Sorbian.
-#
-# ctype array (must be 257 elements)
- 00
- 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20
- 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
- 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
- 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10
- 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01
- 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10
- 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02
- 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 00
- 01 01 02 01 01 01 01 02 02 01 02 02 01 02 02 01
- 02 01 02 02 01 02 01 02 02 02 02 02 02 01 02 02
- 00 00 01 00 00 00 00 02 00 00 00 02 00 00 02 01
- 02 01 00 00 02 01 00 00 02 01 02 01 02 01 02 01
- 02 01 00 00 02 01 00 00 00 00 00 02 01 01 02 01
- 00 00 00 00 00 00 00 00 02 01 02 01 00 00 02 01
- 02 01 00 00 02 01 02 01 01 02 01 01 02 01 01 01
- 02 01 01 02 01 02 01 02 01 02 02 01 01 02 01 00
-
-# to_lower array (must be 256 elements)
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F
- 70 71 72 73 54 75 76 77 78 79 7A 5B 5C 5D 5E 5F
- 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F
- 70 71 72 73 54 75 76 77 78 79 7A 7B 7C 7D 7E 7F
- 8A 82 82 8E 88 9A 9F 87 88 8B 8A 8B 8D 8D 8E 90
- 90 93 92 93 95 95 98 97 98 99 9A 9B 9C 9E 9E 9F
- A0 A1 AB A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE B0
- B0 B4 B2 B3 B4 FA B6 B7 B8 BA BA BC BC BE BE C0
- C0 C4 C2 C3 C4 CB C6 C7 C8 C9 CA CB CE 9B CE D8
- D0 D1 D2 D3 D4 D5 D6 D7 D8 DA DA DE DC DD DE E0
- E0 E4 E2 E3 E4 E6 E6 87 E9 E9 92 EC EC F0 97 99
- F0 F3 9C F3 F5 F5 F7 F7 F9 F9 FA FD B8 FD AE FF
-
-# to_upper array (must be 256 elements)
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- 50 51 52 53 74 55 56 57 58 59 5A 5B 5C 5D 5E 5F
- 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- 50 51 52 53 74 55 56 57 58 59 5A 7B 7C 7D 7E 7F
- 80 81 81 83 84 85 86 E7 84 89 80 89 8C 8C 83 8F
- 8F 91 EA 91 94 94 96 EE 96 EF 85 CD F2 9D 9D 86
- A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA A2 AC AD FE AF
- AF B1 B2 B3 B1 B5 B6 B7 FC B9 B9 BB BB BD BD BF
- BF C1 C2 C3 C1 C5 C6 C7 C8 C9 CA C5 CC CD CC CF
- D0 D1 D2 D3 D4 D5 D6 D7 CF D9 D9 DB DC DD DB DF
- DF E1 E2 E3 E1 E5 E5 E7 E8 E8 EA EB EB ED EE EF
- ED F1 F2 F1 F4 F4 F6 F6 F8 F8 B5 FB FC FB FE FF
-
-# sort_order array (must be 256 elements)
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 41 4B 4D 53 57 63 65 69 6B 73 75 79 83 85 8D
- 9B 9D 9F A7 AE B2 C0 C2 C4 C6 CA D2 D3 D4 D5 D6
- D7 42 4C 4E 54 58 64 66 6A 6C 74 76 7A 84 86 8E
- 9C 9E A0 A8 AF B3 C1 C3 C5 C7 CB D8 D9 DA DB DC
- 45 47 48 59 49 91 B6 44 4A 4F 46 50 51 52 5A CE
- CF 55 72 56 5B 5C 5D 90 5E 9A 92 98 B8 5F 60 B7
- DD DE 61 DF E0 E1 E2 AD E3 E4 E5 62 E6 E7 68 6F
- 70 6D E8 E9 6E 77 EA EB 7C 81 82 7F 80 7D 7E 8B
- 8C 87 EC ED 88 89 EE EF F0 F1 F2 8A 93 97 94 95
- F3 F4 F5 F6 F7 F8 F9 FA 96 A1 A2 A3 FB FC A4 A5
- A6 A9 FD FE AA AB AC 43 B0 B1 71 CC CD BC 8F 99
- BD B4 B9 B5 BA BB BE BF C8 C9 78 D0 7B D1 67 FF
-
-# Unicode mapping (must be 256 elements)
- 0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F
- 0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F
- 0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F
- 0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F
- 0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F
- 0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F
- 0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F
- 0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F
- 00C4 0100 0101 00C9 0104 00D6 00DC 00E1 0105 010C 00E4 010D 0106 0107 00E9 0179
- 017A 010E 00ED 010F 0112 0113 0116 00F3 0117 00F4 00F6 00F5 00FA 011A 011B 00FC
- 2020 00B0 0118 00A3 00A7 2022 00B6 00DF 00AE 00A9 2122 0119 00A8 2260 0123 012E
- 012F 012A 2264 2265 012B 0136 2202 2211 0142 013B 013C 013D 013E 0139 013A 0145
- 0146 0143 00AC 221A 0144 0147 2206 00AB 00BB 2026 00A0 0148 0150 00D5 0151 014C
- 2013 2014 201C 201D 2018 2019 00F7 25CA 014D 0154 0155 0158 2039 203A 0159 0156
- 0157 0160 201A 201E 0161 015A 015B 00C1 0164 0165 00CD 017D 017E 016A 00D3 00D4
- 016B 016E 00DA 016F 0170 0171 0172 0173 00DD 00FD 0137 017B 0141 017C 0122 02C7
-
diff --git a/sql/share/charsets/macromanbin.conf b/sql/share/charsets/macromanbin.conf
deleted file mode 100644
index d0845c07f2b..00000000000
--- a/sql/share/charsets/macromanbin.conf
+++ /dev/null
@@ -1,96 +0,0 @@
-#
-# Mac OS Roman, accent insensitive, case insensitive
-#
-# Binary sort order
-#
-# ctype array (must be 257 elements)
- 00
- 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20
- 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
- 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
- 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10
- 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01
- 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10
- 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02
- 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 10
- 20 01 01 01 01 01 01 02 02 02 02 02 02 02 02 02
- 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
- 00 00 00 00 00 00 00 02 00 00 00 00 00 00 01 01
- 00 00 00 00 00 00 00 00 00 00 00 00 00 00 02 02
- 00 00 00 00 02 00 00 00 00 00 00 20 01 01 01 02
- 00 00 00 00 00 00 00 00 02 01 00 00 00 00 00 00
- 00 00 00 00 00 20 01 01 01 01 01 01 01 01 01 01
- 00 01 01 01 01 02 00 00 00 00 00 00 00 00 00 00
-
-# to_lower array (must be 256 elements)
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F
- 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F
- 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F
- 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F
- 8A 8C 8D 8E 96 9A 9F 87 88 89 8A 8B 8C 8D 8E 8F
- 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
- A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD BE BF
- B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF
- C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA 88 8B 9B CE CF
- D0 D1 D2 D3 D4 D5 D6 D7 D8 D8 DA DB DC DD DE DF
- E0 E1 E2 E3 E4 89 90 87 91 8F 92 94 95 93 97 99
- F0 98 9C 9E 9D F5 F6 F7 F8 F9 FA FB FC FD FE FF
-
-# to_upper array (must be 256 elements)
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
- 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F
- 80 81 82 83 84 85 86 E7 CB E5 80 CC 81 82 83 E9
- E6 E8 EA ED EB EC 84 EE F1 EF 85 CD F2 F4 F3 86
- A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF
- B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD AE AF
- C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
- D0 D1 D2 D3 D4 D5 D6 D7 D9 D9 DA DB DC DD DE DF
- E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
- F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF
-
-# sort_order array (must be 256 elements)
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
- 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F
- 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F
- 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
- 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
- A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF
- B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF
- C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
- D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF
- E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
- F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF
-
-# Unicode mapping (must be 256 elements)
- 0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F
- 0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F
- 0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F
- 0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F
- 0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F
- 0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F
- 0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F
- 0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F
- 00C4 00C5 00C7 00C9 00D1 00D6 00DC 00E1 00E0 00E2 00E4 00E3 00E5 00E7 00E9 00E8
- 00EA 00EB 00ED 00EC 00EE 00EF 00F1 00F3 00F2 00F4 00F6 00F5 00FA 00F9 00FB 00FC
- 2020 00B0 00A2 00A3 00A7 2022 00B6 00DF 00AE 00A9 2122 00B4 00A8 2260 00C6 00D8
- 221E 00B1 2264 2265 00A5 00B5 2202 2211 220F 03C0 222B 00AA 00BA 03A9 00E6 00F8
- 00BF 00A1 00AC 221A 0192 2248 2206 00AB 00BB 2026 00A0 00C0 00C3 00D5 0152 0153
- 2013 2014 201C 201D 2018 2019 00F7 25CA 00FF 0178 2044 20AC 2039 203A FB01 FB02
- 2021 00B7 201A 201E 2030 00C2 00CA 00C1 00CB 00C8 00CD 00CE 00CF 00CC 00D3 00D4
- F8FF 00D2 00DA 00DB 00D9 0131 02C6 02DC 00AF 02D8 02D9 02DA 00B8 02DD 02DB 02C7
-
diff --git a/sql/share/charsets/macromanciai.conf b/sql/share/charsets/macromanciai.conf
deleted file mode 100644
index 457e6b4f8d9..00000000000
--- a/sql/share/charsets/macromanciai.conf
+++ /dev/null
@@ -1,97 +0,0 @@
-#
-# Mac OS Roman, accent insensitive, case insensitive
-#
-# Sort order: Dutch, English, French, German (Duden),
-# Italian, Latin, Pogtuguese, Spanish
-#
-# ctype array (must be 257 elements)
- 00
- 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20
- 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
- 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
- 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10
- 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01
- 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10
- 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02
- 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 10
- 20 01 01 01 01 01 01 02 02 02 02 02 02 02 02 02
- 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
- 00 00 00 00 00 00 00 02 00 00 00 00 00 00 01 01
- 00 00 00 00 00 00 00 00 00 00 00 00 00 00 02 02
- 00 00 00 00 02 00 00 00 00 00 00 20 01 01 01 02
- 00 00 00 00 00 00 00 00 02 01 00 00 00 00 00 00
- 00 00 00 00 00 20 01 01 01 01 01 01 01 01 01 01
- 00 01 01 01 01 02 00 00 00 00 00 00 00 00 00 00
-
-# to_lower array (must be 256 elements)
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F
- 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F
- 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F
- 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F
- 8A 8C 8D 8E 96 9A 9F 87 88 89 8A 8B 8C 8D 8E 8F
- 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
- A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD BE BF
- B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF
- C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA 88 8B 9B CE CF
- D0 D1 D2 D3 D4 D5 D6 D7 D8 D8 DA DB DC DD DE DF
- E0 E1 E2 E3 E4 89 90 87 91 8F 92 94 95 93 97 99
- F0 98 9C 9E 9D F5 F6 F7 F8 F9 FA FB FC FD FE FF
-
-# to_upper array (must be 256 elements)
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
- 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F
- 80 81 82 83 84 85 86 E7 CB E5 80 CC 81 82 83 E9
- E6 E8 EA ED EB EC 84 EE F1 EF 85 CD F2 F4 F3 86
- A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF
- B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD AE AF
- C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
- D0 D1 D2 D3 D4 D5 D6 D7 D9 D9 DA DB DC DD DE DF
- E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
- F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF
-
-# sort_order array (must be 256 elements)
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 41 51 53 57 59 63 66 68 6A 75 77 79 7B 7D 81
- 91 93 95 97 9A 9C A6 A8 AA AC B0 B2 B3 B4 B5 B6
- B7 41 51 53 57 59 63 66 68 6A 75 77 79 7B 7D 81
- 91 93 95 97 9A 9C A6 A8 AA AC B0 B8 B9 BA BB BC
- 41 41 53 59 7D 81 9C 41 41 41 41 41 41 53 59 59
- 59 59 6A 6A 6A 6A 7D 81 81 81 81 81 9C 9C 9C 9C
- BD BE BF C0 C1 C2 C3 97 C4 C5 C6 C7 C8 C9 41 81
- CA CB CC CD CE CF D0 D1 D2 D3 D4 D5 D6 D7 41 81
- D8 D9 DA DB 63 DC DD DE DF E0 E1 41 41 81 81 81
- E2 E3 E4 E5 E6 E7 E8 E9 AC AC EA EB EC ED EE EF
- F0 F1 F2 F3 F4 41 59 41 59 59 6A 6A 6A 6A 81 81
- F0 81 9C 9C 9C 6A F6 F7 F8 F9 FA FB FC FD FE FF
-
-# Unicode mapping (must be 256 elements)
- 0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F
- 0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F
- 0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F
- 0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F
- 0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F
- 0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F
- 0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F
- 0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F
- 00C4 00C5 00C7 00C9 00D1 00D6 00DC 00E1 00E0 00E2 00E4 00E3 00E5 00E7 00E9 00E8
- 00EA 00EB 00ED 00EC 00EE 00EF 00F1 00F3 00F2 00F4 00F6 00F5 00FA 00F9 00FB 00FC
- 2020 00B0 00A2 00A3 00A7 2022 00B6 00DF 00AE 00A9 2122 00B4 00A8 2260 00C6 00D8
- 221E 00B1 2264 2265 00A5 00B5 2202 2211 220F 03C0 222B 00AA 00BA 03A9 00E6 00F8
- 00BF 00A1 00AC 221A 0192 2248 2206 00AB 00BB 2026 00A0 00C0 00C3 00D5 0152 0153
- 2013 2014 201C 201D 2018 2019 00F7 25CA 00FF 0178 2044 20AC 2039 203A FB01 FB02
- 2021 00B7 201A 201E 2030 00C2 00CA 00C1 00CB 00C8 00CD 00CE 00CF 00CC 00D3 00D4
- F8FF 00D2 00DA 00DB 00D9 0131 02C6 02DC 00AF 02D8 02D9 02DA 00B8 02DD 02DB 02C7
-
diff --git a/sql/share/charsets/macromancias.conf b/sql/share/charsets/macromancias.conf
deleted file mode 100644
index a00d7d412e6..00000000000
--- a/sql/share/charsets/macromancias.conf
+++ /dev/null
@@ -1,97 +0,0 @@
-#
-# Mac OS Roman, accent sensitive, case insensitive
-#
-# Sort order: Dutch, English, French, German (Duden),
-# Italian, Latin, Pogtuguese, Spanish
-#
-# ctype array (must be 257 elements)
- 00
- 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20
- 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
- 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
- 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10
- 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01
- 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10
- 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02
- 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 10
- 20 01 01 01 01 01 01 02 02 02 02 02 02 02 02 02
- 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
- 00 00 00 00 00 00 00 02 00 00 00 00 00 00 01 01
- 00 00 00 00 00 00 00 00 00 00 00 00 00 00 02 02
- 00 00 00 00 02 00 00 00 00 00 00 20 01 01 01 02
- 00 00 00 00 00 00 00 00 02 01 00 00 00 00 00 00
- 00 00 00 00 00 20 01 01 01 01 01 01 01 01 01 01
- 00 01 01 01 01 02 00 00 00 00 00 00 00 00 00 00
-
-# to_lower array (must be 256 elements)
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F
- 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F
- 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F
- 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F
- 8A 8C 8D 8E 96 9A 9F 87 88 89 8A 8B 8C 8D 8E 8F
- 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
- A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD BE BF
- B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF
- C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA 88 8B 9B CE CF
- D0 D1 D2 D3 D4 D5 D6 D7 D8 D8 DA DB DC DD DE DF
- E0 E1 E2 E3 E4 89 90 87 91 8F 92 94 95 93 97 99
- F0 98 9C 9E 9D F5 F6 F7 F8 F9 FA FB FC FD FE FF
-
-# to_upper array (must be 256 elements)
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
- 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F
- 80 81 82 83 84 85 86 E7 CB E5 80 CC 81 82 83 E9
- E6 E8 EA ED EB EC 84 EE F1 EF 85 CD F2 F4 F3 86
- A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF
- B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD AE AF
- C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
- D0 D1 D2 D3 D4 D5 D6 D7 D9 D9 DA DB DC DD DE DF
- E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
- F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF
-
-# sort_order array (must be 256 elements)
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 41 51 53 57 59 63 66 68 6A 75 77 79 7B 7D 81
- 91 93 95 97 9A 9C A6 A8 AA AC B0 B2 B3 B4 B5 B6
- B7 41 51 53 57 59 63 66 68 6A 75 77 79 7B 7D 81
- 91 93 95 97 9A 9C A6 A8 AA AC B0 B8 B9 BA BB BC
- 4B 4D 55 5D 7F 8B A4 45 43 47 4B 49 4D 55 5D 5B
- 5F 61 6E 6C 70 72 7F 85 83 87 8B 89 A0 9E A2 A4
- BD BE BF C0 C1 C2 C3 99 C4 C5 C6 C7 C8 C9 4F 8D
- CA CB CC CD CE CF D0 D1 D2 D3 D4 D5 D6 D7 4F 8D
- D8 D9 DA DB 65 DC DD DE DF E0 E1 43 49 89 8F 8F
- E2 E3 E4 E5 E6 E7 E8 E9 AE AE EA EB EC ED EE EF
- F0 F1 F2 F3 F4 47 5F 45 61 5B 6E 70 70 6C 85 87
- F0 83 A0 A2 9E 72 F6 F7 F8 F9 FA FB FC FD FE FF
-
-# Unicode mapping (must be 256 elements)
- 0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F
- 0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F
- 0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F
- 0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F
- 0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F
- 0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F
- 0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F
- 0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F
- 00C4 00C5 00C7 00C9 00D1 00D6 00DC 00E1 00E0 00E2 00E4 00E3 00E5 00E7 00E9 00E8
- 00EA 00EB 00ED 00EC 00EE 00EF 00F1 00F3 00F2 00F4 00F6 00F5 00FA 00F9 00FB 00FC
- 2020 00B0 00A2 00A3 00A7 2022 00B6 00DF 00AE 00A9 2122 00B4 00A8 2260 00C6 00D8
- 221E 00B1 2264 2265 00A5 00B5 2202 2211 220F 03C0 222B 00AA 00BA 03A9 00E6 00F8
- 00BF 00A1 00AC 221A 0192 2248 2206 00AB 00BB 2026 00A0 00C0 00C3 00D5 0152 0153
- 2013 2014 201C 201D 2018 2019 00F7 25CA 00FF 0178 2044 20AC 2039 203A FB01 FB02
- 2021 00B7 201A 201E 2030 00C2 00CA 00C1 00CB 00C8 00CD 00CE 00CF 00CC 00D3 00D4
- F8FF 00D2 00DA 00DB 00D9 0131 02C6 02DC 00AF 02D8 02D9 02DA 00B8 02DD 02DB 02C7
-
diff --git a/sql/share/charsets/macromancsas.conf b/sql/share/charsets/macromancsas.conf
deleted file mode 100644
index 1f67148680d..00000000000
--- a/sql/share/charsets/macromancsas.conf
+++ /dev/null
@@ -1,97 +0,0 @@
-#
-# Mac OS Roman, accent sensitive, case sensitive
-#
-# Sort order: Dutch, English, French, German (Duden),
-# Italian, Latin, Pogtuguese, Spanish
-#
-# ctype array (must be 257 elements)
- 00
- 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20
- 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
- 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
- 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10
- 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01
- 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10
- 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02
- 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 10
- 20 01 01 01 01 01 01 02 02 02 02 02 02 02 02 02
- 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
- 00 00 00 00 00 00 00 02 00 00 00 00 00 00 01 01
- 00 00 00 00 00 00 00 00 00 00 00 00 00 00 02 02
- 00 00 00 00 02 00 00 00 00 00 00 20 01 01 01 02
- 00 00 00 00 00 00 00 00 02 01 00 00 00 00 00 00
- 00 00 00 00 00 20 01 01 01 01 01 01 01 01 01 01
- 00 01 01 01 01 02 00 00 00 00 00 00 00 00 00 00
-
-# to_lower array (must be 256 elements)
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F
- 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F
- 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F
- 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F
- 8A 8C 8D 8E 96 9A 9F 87 88 89 8A 8B 8C 8D 8E 8F
- 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
- A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD BE BF
- B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF
- C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA 88 8B 9B CE CF
- D0 D1 D2 D3 D4 D5 D6 D7 D8 D8 DA DB DC DD DE DF
- E0 E1 E2 E3 E4 89 90 87 91 8F 92 94 95 93 97 99
- F0 98 9C 9E 9D F5 F6 F7 F8 F9 FA FB FC FD FE FF
-
-# to_upper array (must be 256 elements)
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
- 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F
- 80 81 82 83 84 85 86 E7 CB E5 80 CC 81 82 83 E9
- E6 E8 EA ED EB EC 84 EE F1 EF 85 CD F2 F4 F3 86
- A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF
- B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD AE AF
- C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
- D0 D1 D2 D3 D4 D5 D6 D7 D9 D9 DA DB DC DD DE DF
- E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
- F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF
-
-# sort_order array (must be 256 elements)
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 41 51 53 57 59 63 66 68 6A 75 77 79 7B 7D 81
- 91 93 95 97 9A 9C A6 A8 AA AC B0 B2 B3 B4 B5 B6
- B7 42 52 54 58 5A 64 67 69 6B 76 78 7A 7C 7E 82
- 92 94 96 98 9B 9D A7 A9 AB AD B1 B8 B9 BA BB BC
- 4B 4D 55 5D 7F 8B A4 46 44 48 4C 4A 4E 56 5E 5C
- 60 62 6F 6D 71 73 80 86 84 88 8C 8A A1 9F A3 A5
- BD BE BF C0 C1 C2 C3 99 C4 C5 C6 C7 C8 C9 4F 8D
- CA CB CC CD CE CF D0 D1 D2 D3 D4 D5 D6 D7 50 8E
- D8 D9 DA DB 65 DC DD DE DF E0 E1 43 49 89 8F 90
- E2 E3 E4 E5 E6 E7 E8 E9 AF AE EA EB EC ED EE EF
- F0 F1 F2 F3 F4 47 5F 45 61 5B 6E 70 72 6C 85 87
- F0 83 A0 A2 9E 74 F6 F7 F8 F9 FA FB FC FD FE FF
-
-# Unicode mapping (must be 256 elements)
- 0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F
- 0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F
- 0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F
- 0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F
- 0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F
- 0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F
- 0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F
- 0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F
- 00C4 00C5 00C7 00C9 00D1 00D6 00DC 00E1 00E0 00E2 00E4 00E3 00E5 00E7 00E9 00E8
- 00EA 00EB 00ED 00EC 00EE 00EF 00F1 00F3 00F2 00F4 00F6 00F5 00FA 00F9 00FB 00FC
- 2020 00B0 00A2 00A3 00A7 2022 00B6 00DF 00AE 00A9 2122 00B4 00A8 2260 00C6 00D8
- 221E 00B1 2264 2265 00A5 00B5 2202 2211 220F 03C0 222B 00AA 00BA 03A9 00E6 00F8
- 00BF 00A1 00AC 221A 0192 2248 2206 00AB 00BB 2026 00A0 00C0 00C3 00D5 0152 0153
- 2013 2014 201C 201D 2018 2019 00F7 25CA 00FF 0178 2044 20AC 2039 203A FB01 FB02
- 2021 00B7 201A 201E 2030 00C2 00CA 00C1 00CB 00C8 00CD 00CE 00CF 00CC 00D3 00D4
- F8FF 00D2 00DA 00DB 00D9 0131 02C6 02DC 00AF 02D8 02D9 02DA 00B8 02DD 02DB 02C7
-
diff --git a/sql/share/charsets/pclatin1.xml b/sql/share/charsets/pclatin1.xml
new file mode 100644
index 00000000000..742dcaec459
--- /dev/null
+++ b/sql/share/charsets/pclatin1.xml
@@ -0,0 +1,119 @@
+<?xml version='1.0' encoding="utf-8"?>
+
+<charsets>
+
+<charset name="pclatin1">
+
+<ctype>
+<map>
+ 00
+ 20 30 30 30 30 30 30 20 20 28 28 28 28 28 30 30
+ 30 30 30 30 30 30 30 30 30 30 20 30 30 30 30 30
+ 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
+ 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10
+ 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01
+ 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10
+ 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02
+ 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 30
+ 02 02 02 02 02 02 02 02 02 02 02 02 02 02 01 01
+ 01 02 01 02 02 02 02 02 02 01 01 10 10 10 10 10
+ 02 02 02 02 02 01 10 10 10 10 10 10 10 10 10 10
+ 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
+ 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
+ 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
+ 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
+ 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 20
+</map>
+</ctype>
+
+
+<lower>
+<map>
+ 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
+ 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
+ 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
+ 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
+ 40 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F
+ 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F
+ 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F
+ 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F
+ 87 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 84 86
+ 82 91 91 93 94 95 96 97 98 94 81 9B 9C 9D 9E 9F
+ A0 A1 A2 A3 A4 A4 A6 A7 A8 A9 AA AB AC AD AE AF
+ B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF
+ C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
+ D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF
+ E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
+ F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF
+</map>
+</lower>
+
+
+<upper>
+<map>
+ 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
+ 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
+ 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
+ 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
+ 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
+ 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
+ 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
+ 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F
+ 80 9A 90 41 8E 41 8F 80 45 45 45 49 49 49 8E 8F
+ 90 92 92 4F 99 4F 55 55 59 99 9A 9B 9C 9D 9E 9F
+ 41 49 4F 55 A5 A5 A6 A7 A8 A9 AA AB AC AD AE AF
+ B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF
+ C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
+ D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF
+ E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
+ F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF
+</map>
+</upper>
+
+
+<unicode>
+<map>
+0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000a 000b 000c 000d 000e 000f
+0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001a 001b 001c 001d 001e 001f
+0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002a 002b 002c 002d 002e 002f
+0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003a 003b 003c 003d 003e 003f
+0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004a 004b 004c 004d 004e 004f
+0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005a 005b 005c 005d 005e 005f
+0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006a 006b 006c 006d 006e 006f
+0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007a 007b 007c 007d 007e 007f
+00c7 00fc 00e9 00e2 00e4 00e0 00e5 00e7 00ea 00eb 00e8 00ef 00ee 00ec 00c4 00c5
+00c9 00e6 00c6 00f4 00f6 00f2 00fb 00f9 00ff 00d6 00dc 00a2 00a3 00a5 20a7 0192
+00e1 00ed 00f3 00fa 00f1 00d1 00aa 00ba 00bf 2310 00ac 00bd 00bc 00a1 00ab 00bb
+2591 2592 2593 2502 2524 2561 2562 2556 2555 2563 2551 2557 255d 255c 255b 2510
+2514 2534 252c 251c 2500 253c 255e 255f 255a 2554 2569 2566 2560 2550 256c 2567
+2568 2564 2565 2559 2558 2552 2553 256b 256a 2518 250c 2588 2584 258c 2590 2580
+03b1 00df 0393 03c0 03a3 03c3 00b5 03c4 03a6 0398 03a9 03b4 221e 03c6 03b5 2229
+2261 00b1 2265 2264 2320 2321 00f7 2248 00b0 2219 00b7 221a 207f 00b2 25a0 00a0
+</map>
+</unicode>
+
+
+<collation name="pclatin1">
+<map>
+ 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
+ 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
+ 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
+ 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
+ 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
+ 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
+ 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
+ 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F
+ 43 59 45 41 5C 41 5B 43 45 45 45 49 49 49 5C 5B
+ 45 5C 5C 4F 5D 4F 55 55 59 5D 59 24 24 24 24 24
+ 41 49 4F 55 4E 4E A6 A7 3F A9 AA AB AC 21 22 22
+ B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF
+ C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
+ D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF
+ E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
+ F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF
+</map>
+</collation>
+
+</charset>
+
+</charsets>
diff --git a/sql/share/charsets/pclatin2.conf b/sql/share/charsets/pclatin2.xml
index dea8d085595..4402edcd847 100644
--- a/sql/share/charsets/pclatin2.conf
+++ b/sql/share/charsets/pclatin2.xml
@@ -1,4 +1,11 @@
-# ctype array (must be 257 elements)
+<?xml version='1.0' encoding="utf-8"?>
+
+<charsets>
+
+<charset name="pclatin2">
+
+<ctype>
+<map>
00
20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20
20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
@@ -16,8 +23,12 @@
02 01 01 01 02 01 01 01 02 00 00 00 00 01 01 00
01 02 01 01 02 02 01 02 01 01 02 01 02 01 02 00
00 00 00 00 00 00 00 00 00 00 00 02 01 02 00 48
+</map>
+</ctype>
-# to_lower array (must be 256 elements)
+
+<lower>
+<map>
00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
@@ -34,8 +45,12 @@
D0 D0 D4 89 D4 E5 A1 8C D8 D9 DA DB DC EE 85 DF
A2 E1 93 E4 E4 E5 E7 E7 EA A3 E8 FB EC EC EE EF
F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF
+</map>
+</lower>
+
-# to_upper array (must be 256 elements)
+<upper>
+<map>
00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
@@ -52,26 +67,12 @@
D1 D1 D2 D3 D2 D5 D6 D7 B7 D9 DA DB DC DD DE DF
E0 E1 E2 E3 E3 D5 E6 E6 E8 E9 E8 EB ED ED DD EF
F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA EB FC FC FE FF
+</map>
+</upper>
-# sort_order array (must be 256 elements)
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 41 47 48 4C 4F 54 55 56 57 5A 5B 5C 5E 5F 62
- 67 68 69 6C 71 74 75 76 77 78 7B 90 91 92 93 94
- 95 41 47 48 4C 4F 54 55 56 57 5A 5B 5C 5E 5F 62
- 67 68 69 6C 71 74 75 76 77 78 7B 96 97 98 99 9A
- 48 74 4F 41 41 74 48 48 5C 4F 62 62 57 7B 41 48
- 4F 5C 5C 62 62 5C 5C 6C 6C 62 74 71 71 5C 9E 48
- 41 57 62 74 41 41 7B 7B 4F 4F AA 7B 48 6C AE AF
- B0 B1 B2 B3 B4 41 41 4F 6C B5 BA BB BC 7B 7B BF
- C0 C1 C2 C3 C4 C5 41 41 C8 C9 CA CB CC CD CE CF
- 4C 4C 4C 4F 4C 60 57 57 4F D9 DA DB DC 71 74 DF
- 62 70 62 60 60 60 6C 6C 69 74 69 74 78 78 71 EF
- F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA 74 69 69 FE FF
-# Unicode mappping (must be 256 elements)
+<unicode>
+<map>
0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F
0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F
0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F
@@ -88,4 +89,31 @@
0111 0110 010E 00CB 010F 0147 00CD 00CE 011B 2518 250C 2588 2584 0162 016E 2580
00D3 00DF 00D4 0143 0144 0148 0160 0161 0154 00DA 0155 0170 00FD 00DD 0163 00B4
00AD 02DD 02DB 02C7 02D8 00A7 00F7 00B8 00B0 00A8 02D9 0171 0158 0159 25A0 00A0
+</map>
+</unicode>
+
+
+<collation name="pclatin2">
+<map>
+ 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
+ 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
+ 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
+ 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
+ 40 41 47 48 4C 4F 54 55 56 57 5A 5B 5C 5E 5F 62
+ 67 68 69 6C 71 74 75 76 77 78 7B 90 91 92 93 94
+ 95 41 47 48 4C 4F 54 55 56 57 5A 5B 5C 5E 5F 62
+ 67 68 69 6C 71 74 75 76 77 78 7B 96 97 98 99 9A
+ 48 74 4F 41 41 74 48 48 5C 4F 62 62 57 7B 41 48
+ 4F 5C 5C 62 62 5C 5C 6C 6C 62 74 71 71 5C 9E 48
+ 41 57 62 74 41 41 7B 7B 4F 4F AA 7B 48 6C AE AF
+ B0 B1 B2 B3 B4 41 41 4F 6C B5 BA BB BC 7B 7B BF
+ C0 C1 C2 C3 C4 C5 41 41 C8 C9 CA CB CC CD CE CF
+ 4C 4C 4C 4F 4C 60 57 57 4F D9 DA DB DC 71 74 DF
+ 62 70 62 60 60 60 6C 6C 69 74 69 74 78 78 71 EF
+ F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA 74 69 69 FE FF
+</map>
+</collation>
+
+</charset>
+</charsets>
diff --git a/sql/share/charsets/swe7.conf b/sql/share/charsets/swe7.xml
index 49938800f39..ffa1d90608d 100644
--- a/sql/share/charsets/swe7.conf
+++ b/sql/share/charsets/swe7.xml
@@ -1,6 +1,11 @@
-# Configuration file for the swe7 character set
+<?xml version='1.0' encoding="utf-8"?>
-# ctype array (must have 257 elements)
+<charsets>
+
+<charset name="swe7">
+
+<ctype>
+<map>
00
20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20
20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
@@ -18,8 +23,12 @@
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+</map>
+</ctype>
+
-# to_lower array (must have 256 elements)
+<lower>
+<map>
00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
@@ -36,8 +45,12 @@
D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF
E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF
+</map>
+</lower>
-# to_upper array (must have 256 elements)
+
+<upper>
+<map>
00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
@@ -54,26 +67,12 @@
D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF
E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF
+</map>
+</upper>
-# sort_order array (must have 256 elements)
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 45 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- 50 51 52 53 54 55 56 57 58 59 5A 5C 5D 5B 59 5F
- 45 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- 50 51 52 53 54 55 56 57 58 59 5A 5C 5D 5B 59 7F
- 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
- 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
- A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF
- B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF
- C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
- D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF
- E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
- F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF
-# Unicode mapping (256 elements)
+<unicode>
+<map>
0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F
0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F
0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F
@@ -90,3 +89,33 @@
0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000
+</map>
+</unicode>
+
+
+<collation name="swe7">
+<map>
+ 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
+ 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
+ 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
+ 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
+ 45 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
+ 50 51 52 53 54 55 56 57 58 59 5A 5C 5D 5B 59 5F
+ 45 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
+ 50 51 52 53 54 55 56 57 58 59 5A 5C 5D 5B 59 7F
+ 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
+ 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
+ A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF
+ B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF
+ C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
+ D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF
+ E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
+ F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF
+</map>
+</collation>
+
+</charset>
+
+</charsets>
+
+
diff --git a/sql/share/charsets/usa7.conf b/sql/share/charsets/usa7.conf
deleted file mode 100644
index 380fc9b5d8b..00000000000
--- a/sql/share/charsets/usa7.conf
+++ /dev/null
@@ -1,92 +0,0 @@
-# Configuration file for the usa7 character set
-
-# ctype array (must have 257 elements)
- 00
- 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20
- 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
- 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
- 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10
- 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01
- 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10
- 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02
- 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 20
- 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
- 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
- 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
- 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
- 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
- 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
- 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
- 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
-
-# to_lower array (must have 256 elements)
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F
- 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F
- 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F
- 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F
- 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
- 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
- A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF
- B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF
- C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
- D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF
- E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
- F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF
-
-# to_upper array (must have 256 elements)
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
- 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F
- 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
- 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
- A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF
- B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF
- C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
- D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF
- E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
- F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF
-
-# sort_order array (must have 256 elements)
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- 50 51 52 53 54 55 56 57 58 59 5A 5C 5D 5B 5E 5F
- 45 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 59 7F
- 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
- 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
- A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF
- B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF
- C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
- D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF
- E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
- F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF
-
-# Unicode mapping (256 elements)
-0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F
-0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F
-0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F
-0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F
-0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F
-0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F
-0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F
-0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 0000
-0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000
-0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000
-0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000
-0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000
-0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000
-0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000
-0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000
-0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000
diff --git a/sql/share/charsets/win1251.conf b/sql/share/charsets/win1251.conf
deleted file mode 100644
index 2164cb36b9e..00000000000
--- a/sql/share/charsets/win1251.conf
+++ /dev/null
@@ -1,100 +0,0 @@
-# Configuration file for the win1251 character set
-
-# NOTE: this character set is deprecated. Please don't use it
-# unless you must because of old tables.
-#
-# If you want to convert your files to charset cp1251, you can do:
-#
-# myisamchk -rq --set-character-set-name=cp1251 *.MYI
-
-
-# ctype array (must have 257 elements)
- 00
- 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20
- 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
- 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
- 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10
- 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01
- 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10
- 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02
- 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 20
- 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
- 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
- 10 10 10 10 10 10 10 10 01 10 10 10 10 10 10 10
- 10 10 10 10 10 10 10 10 02 10 10 10 10 10 10 10
- 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
- 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
- 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
- 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
-
-# to_lower array (must have 256 elements)
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F
- 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F
- 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F
- 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F
- 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
- 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
- A0 A1 A2 A3 A4 A5 A6 A7 B8 A9 AA AB AC AD AE AF
- B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF
- E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
- F0 F1 F2 F3 F4 F5 F5 F7 F8 F9 FA FB FC FD FE FF
- E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
- F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF
-
-# to_upper array (must have 256 elements)
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
- 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F
- 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
- 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
- A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF
- B0 B1 B2 B3 B4 B5 B6 B7 A8 B9 BA BB BC BD BE BF
- C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
- D0 D1 D2 D3 D4 D5 D5 D7 D8 D9 DA DB DC DD DE DF
- C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
- D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF
-
-# sort_order array (must have 256 elements)
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
- 60 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F
- 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F
- 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F
- A0 A1 A2 A3 A4 A5 A6 A7 C6 A9 AA AB AC AD AE AF
- B0 B1 B2 B3 B4 B5 B6 B7 C6 B9 BA BB BC BD BE BF
- C0 C1 C2 C3 C4 C5 C7 C8 C9 CA CB CC CD CE CF D0
- D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF E0
- C0 C1 C2 C3 C4 C5 C7 C8 C9 CA CB CC CD CE CF D0
- D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF E0
-
-# Unicode mapping (256 elements)
-0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F
-0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F
-0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F
-0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F
-0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F
-0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F
-0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F
-0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F
-0402 0403 201A 0453 201E 2026 2020 2021 0000 2030 0409 2039 040A 040C 040B 040F
-0452 2018 2019 201C 201D 2022 2013 2014 0000 2122 0459 203A 045A 045C 045B 045F
-00A0 040E 045E 0408 00A4 0490 00A6 00A7 0401 00A9 0404 00AB 00AC 00AD 00AE 0407
-00B0 00B1 0406 0456 0491 00B5 00B6 00B7 0451 2116 0454 00BB 0458 0405 0455 0457
-0410 0411 0412 0413 0414 0415 0416 0417 0418 0419 041A 041B 041C 041D 041E 041F
-0420 0421 0422 0423 0424 0425 0426 0427 0428 0429 042A 042B 042C 042D 042E 042F
-0430 0431 0432 0433 0434 0435 0436 0437 0438 0439 043A 043B 043C 043D 043E 043F
-0440 0441 0442 0443 0444 0445 0446 0447 0448 0449 044A 044B 044C 044D 044E 044F
diff --git a/sql/share/charsets/win1251ukr.conf b/sql/share/charsets/win1251ukr.conf
deleted file mode 100644
index da08e4c7d6f..00000000000
--- a/sql/share/charsets/win1251ukr.conf
+++ /dev/null
@@ -1,95 +0,0 @@
-# Configuration file for the win1251ukr character set
-
-# it's really, just a cp1251 charset with Ukranian letter
-# marked as "letters"
-
-# ctype array (must have 257 elements)
- 00
- 20 20 20 20 20 20 20 20 20 28 28 28 28 28 20 20
- 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
- 48 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
- 84 84 84 84 84 84 84 84 84 84 10 10 10 10 10 10
- 10 81 81 81 81 81 81 01 01 01 01 01 01 01 01 01
- 01 01 01 01 01 01 01 01 01 01 01 10 10 10 10 10
- 10 82 82 82 82 82 82 02 02 02 02 02 02 02 02 02
- 02 02 02 02 02 02 02 02 02 02 02 10 10 10 10 20
- 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
- 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
- 10 10 10 10 10 10 10 10 01 10 01 10 10 10 10 01
- 10 10 01 02 10 10 10 10 02 10 02 10 10 10 10 02
- 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
- 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
- 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
- 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
-
-# to_lower array (must have 256 elements)
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F
- 70 71 72 73 74 75 76 77 78 79 7A 5B 5C 5D 5E 5F
- 20 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F
- 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F
- 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
- 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
- 20 20 20 20 20 A5 20 20 A8 20 AA 20 20 20 20 AF
- 20 20 B2 B2 A5 20 20 20 A8 20 AA 20 20 20 20 AF
- C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
- D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF
- C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF
- D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF
-
-# to_upper array (must have 256 elements)
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
- 20 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F
- 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
- 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
- 20 20 20 20 20 B4 20 20 B8 20 BA 20 20 20 20 BF
- 20 20 B3 B3 B4 20 20 20 B8 20 BA 20 20 20 20 BF
- E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
- F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF
- E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF
- F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF
-
-# sort_order array (must have 256 elements)
- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
- 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
- 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
- 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
- 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
- 20 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
- 50 51 52 53 54 55 56 57 58 59 5A 7B 7C 7D 7E 7F
- A5 A6 A7 A8 A9 AA AB AC AD AE AF B0 B1 B2 B3 B4
- B5 B6 B7 B8 B9 BA BB BC BD BE BF C0 C1 C2 C3 C4
- C5 C6 C7 C8 C9 84 CA CB 88 CC 87 CD CE CF D0 8D
- D1 D2 8C 8C 84 D3 D4 D5 88 D6 87 D7 D8 D9 DA 8D
- 80 81 82 83 85 86 89 8A 8B 8E 8F 90 91 92 93 94
- 95 96 97 98 99 9A 9B 9C 9D 9E 9F A0 A1 A2 A3 A4
- 80 81 82 83 85 86 89 8A 8B 8E 8F 90 91 92 93 94
- 95 96 97 98 99 9A 9B 9C 9D 9E 9F A0 A1 A2 A3 A4
-
-# Unicode mapping (256 elements)
-0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 000A 000B 000C 000D 000E 000F
-0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A 001B 001C 001D 001E 001F
-0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 002A 002B 002C 002D 002E 002F
-0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 003A 003B 003C 003D 003E 003F
-0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F
-0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F
-0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F
-0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F
-0402 0403 201A 0453 201E 2026 2020 2021 0000 2030 0409 2039 040A 040C 040B 040F
-0452 2018 2019 201C 201D 2022 2013 2014 0000 2122 0459 203A 045A 045C 045B 045F
-00A0 040E 045E 0408 00A4 0490 00A6 00A7 0401 00A9 0404 00AB 00AC 00AD 00AE 0407
-00B0 00B1 0406 0456 0491 00B5 00B6 00B7 0451 2116 0454 00BB 0458 0405 0455 0457
-0410 0411 0412 0413 0414 0415 0416 0417 0418 0419 041A 041B 041C 041D 041E 041F
-0420 0421 0422 0423 0424 0425 0426 0427 0428 0429 042A 042B 042C 042D 042E 042F
-0430 0431 0432 0433 0434 0435 0436 0437 0438 0439 043A 043B 043C 043D 043E 043F
-0440 0441 0442 0443 0444 0445 0446 0447 0448 0449 044A 044B 044C 044D 044E 044F
diff --git a/sql/share/english/errmsg.txt b/sql/share/english/errmsg.txt
index d235f8f49a5..465992e63b2 100644
--- a/sql/share/english/errmsg.txt
+++ b/sql/share/english/errmsg.txt
@@ -217,8 +217,8 @@
"Deadlock found when trying to get lock; Try restarting transaction",
"The used table type doesn't support FULLTEXT indexes",
"Cannot add foreign key constraint",
-"Cannot add a child row: a foreign key constraint fails",
-"Cannot delete a parent row: a foreign key constraint fails",
+"Cannot add or update a child row: a foreign key constraint fails",
+"Cannot delete or update a parent row: a foreign key constraint fails",
"Error connecting to master: %-.128s",
"Error running query on master: %-.128s",
"Error when executing command %s: %-.128s",
diff --git a/sql/share/italian/errmsg.txt b/sql/share/italian/errmsg.txt
index 56b3018e3a6..451ad3e058b 100644
--- a/sql/share/italian/errmsg.txt
+++ b/sql/share/italian/errmsg.txt
@@ -219,25 +219,25 @@
"Impossibile aggiungere il vincolo di integrita' referenziale (foreign key constraint)",
"Impossibile aggiungere la riga: un vincolo d'integrita' referenziale non e' soddisfatto",
"Impossibile cancellare la riga: un vincolo d'integrita' referenziale non e' soddisfatto",
-"Error connecting to master: %-.128s",
-"Error running query on master: %-.128s",
-"Error when executing command %s: %-.128s",
-"Wrong usage of %s and %s",
-"The used SELECT statements have a different number of columns",
-"Can't execute the query because you have a conflicting read lock",
-"Mixing of transactional and non-transactional tables is disabled",
-"Option '%s' used twice in statement",
-"User '%-.64s' has exceeded the '%s' resource (current value: %ld)",
-"Access denied. You need the %-.128s privilege for this operation",
-"Variable '%-.64s' is a LOCAL variable and can't be used with SET GLOBAL",
-"Variable '%-.64s' is a GLOBAL variable and should be set with SET GLOBAL",
-"Variable '%-.64s' doesn't have a default value",
-"Variable '%-.64s' can't be set to the value of '%-.64s'",
-"Wrong argument type to variable '%-.64s'",
-"Variable '%-.64s' can only be set, not read",
-"Wrong usage/placement of '%s'",
-"This version of MySQL doesn't yet support '%s'",
-"Got fatal error %d: '%-.128s' from master when reading data from binary log",
+"Errore durante la connessione al master: %-.128s",
+"Errore eseguendo una query sul master: %-.128s",
+"Errore durante l'esecuzione del comando %s: %-.128s",
+"Uso errato di %s e %s",
+"La SELECT utilizzata ha un numero di colonne differente",
+"Impossibile eseguire la query perche' c'e' un conflitto con in lock di lettura",
+"E' disabilitata la possibilita' di mischiare tabelle transazionali e non-transazionali",
+"L'opzione '%s' e' stata usata due volte nel comando",
+"L'utente '%-.64s' ha ecceduto la risorsa '%s' (valore corrente: %ld)",
+"Accesso non consentito. Serve il privilegio %-.128s per questa operazione",
+"La variabile '%-.64s' e' una variabile locale ( LOCAL ) e non puo' essere cambiata usando SET GLOBAL",
+"La variabile '%-.64s' e' una variabile globale ( GLOBAL ) e deve essere cambiata usando SET GLOBAL",
+"La variabile '%-.64s' non ha un valore di default",
+"Alla variabile '%-.64s' non puo' essere assegato il valore '%-.64s'",
+"Tipo di valore errato per la variabile '%-.64s'",
+"Alla variabile '%-.64s' e' di sola scrittura quindi puo' essere solo assegnato un valore, non letto",
+"Uso/posizione di '%s' sbagliato",
+"Questa versione di MySQL non supporta ancora '%s'",
+"Errore fatale %d: '%-.128s' dal master leggendo i dati dal log binario",
"Wrong foreign key definition for '%-.64s': %s",
"Key reference and table reference doesn't match",
"Cardinality error (more/less than %d columns)",
diff --git a/sql/slave.cc b/sql/slave.cc
index 7d3ec8d3dce..bb53461a120 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -14,8 +14,10 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-
#include "mysql_priv.h"
+
+#ifdef HAVE_REPLICATION
+
#include <mysql.h>
#include <myisam.h>
#include "mini_client.h"
@@ -26,6 +28,7 @@
#include <my_dir.h>
#include <assert.h>
+
bool use_slave_mask = 0;
MY_BITMAP slave_error_mask;
@@ -413,6 +416,7 @@ int terminate_slave_threads(MASTER_INFO* mi,int thread_mask,bool skip_lock)
}
if ((thread_mask & (SLAVE_IO|SLAVE_FORCE_ALL)) && mi->slave_running)
{
+ DBUG_PRINT("info",("Terminating IO thread"));
mi->abort_slave=1;
if ((error=terminate_slave_thread(mi->io_thd,io_lock,
io_cond_lock,
@@ -423,6 +427,7 @@ int terminate_slave_threads(MASTER_INFO* mi,int thread_mask,bool skip_lock)
}
if ((thread_mask & (SLAVE_SQL|SLAVE_FORCE_ALL)) && mi->rli.slave_running)
{
+ DBUG_PRINT("info",("Terminating SQL thread"));
DBUG_ASSERT(mi->rli.sql_thd != 0) ;
mi->rli.abort_slave=1;
if ((error=terminate_slave_thread(mi->rli.sql_thd,sql_lock,
@@ -1009,6 +1014,7 @@ static int create_table_from_dump(THD* thd, NET* net, const char* db,
const char* table_name)
{
ulong packet_len = my_net_read(net); // read create table statement
+ char *query;
Vio* save_vio;
HA_CHECK_OPT check_opt;
TABLE_LIST tables;
@@ -1028,15 +1034,23 @@ static int create_table_from_dump(THD* thd, NET* net, const char* db,
return 1;
}
thd->command = COM_TABLE_DUMP;
- thd->query = sql_alloc(packet_len + 1);
- if (!thd->query)
+ /* Note that we should not set thd->query until the area is initalized */
+ if (!(query = sql_alloc(packet_len + 1)))
{
sql_print_error("create_table_from_dump: out of memory");
net_printf(thd, ER_GET_ERRNO, "Out of memory");
return 1;
}
- memcpy(thd->query, net->read_pos, packet_len);
- thd->query[packet_len] = 0;
+ memcpy(query, net->read_pos, packet_len);
+ query[packet_len]= 0;
+ thd->query_length= packet_len;
+ /*
+ We make the following lock in an attempt to ensure that the compiler will
+ not rearrange the code so that thd->query is set too soon
+ */
+ VOID(pthread_mutex_lock(&LOCK_thread_count));
+ thd->query= query;
+ VOID(pthread_mutex_unlock(&LOCK_thread_count));
thd->current_tablenr = 0;
thd->query_error = 0;
thd->net.no_send_ok = 1;
@@ -1747,7 +1761,7 @@ static int init_slave_thread(THD* thd, SLAVE_THD_TYPE thd_type)
VOID(pthread_sigmask(SIG_UNBLOCK,&set,&thd->block_signals));
#endif
- if ((ulong) thd->variables.max_join_size == (ulong) HA_POS_ERROR)
+ if (thd->variables.max_join_size == HA_POS_ERROR)
thd->options |= OPTION_BIG_SELECTS;
if (thd_type == SLAVE_THD_SQL)
@@ -2270,7 +2284,9 @@ err:
// print the current replication position
sql_print_error("Slave I/O thread exiting, read up to log '%s', position %s",
IO_RPL_LOG_NAME, llstr(mi->master_log_pos,llbuff));
+ VOID(pthread_mutex_lock(&LOCK_thread_count));
thd->query = thd->db = 0; // extra safety
+ VOID(pthread_mutex_unlock(&LOCK_thread_count));
if (mysql)
{
mc_mysql_close(mysql);
@@ -2405,7 +2421,9 @@ the slave SQL thread with \"SLAVE START\". We stopped at log \
RPL_LOG_NAME, llstr(rli->master_log_pos,llbuff));
err:
+ VOID(pthread_mutex_lock(&LOCK_thread_count));
thd->query = thd->db = 0; // extra safety
+ VOID(pthread_mutex_unlock(&LOCK_thread_count));
thd->proc_info = "Waiting for slave mutex on exit";
pthread_mutex_lock(&rli->run_lock);
DBUG_ASSERT(rli->slave_running == 1); // tracking buffer overrun
@@ -2572,12 +2590,6 @@ static int process_io_rotate(MASTER_INFO *mi, Rotate_log_event *rev)
memcpy(mi->master_log_name, rev->new_log_ident, rev->ident_len+1);
mi->master_log_pos= rev->pos;
-
- pthread_mutex_lock(&mi->rli.data_lock);
- memcpy(mi->rli.master_log_name, rev->new_log_ident, rev->ident_len+1);
- mi->rli.master_log_pos= rev->pos;
- pthread_mutex_unlock(&mi->rli.data_lock);
-
DBUG_PRINT("info", ("master_log_pos: '%s' %d",
mi->master_log_name, (ulong) mi->master_log_pos));
#ifndef DBUG_OFF
@@ -2965,7 +2977,12 @@ static IO_CACHE *reopen_relay_log(RELAY_LOG_INFO *rli, const char **errmsg)
if ((rli->cur_log_fd=open_binlog(cur_log,rli->relay_log_name,
errmsg)) <0)
DBUG_RETURN(0);
- my_b_seek(cur_log,rli->relay_log_pos);
+ /*
+ We want to start exactly where we was before:
+ relay_log_pos Current log pos
+ pending Number of bytes already processed from the event
+ */
+ my_b_seek(cur_log,rli->relay_log_pos + rli->pending);
DBUG_RETURN(cur_log);
}
@@ -3181,3 +3198,5 @@ err:
template class I_List_iterator<i_string>;
template class I_List_iterator<i_string_pair>;
#endif
+
+#endif /* HAVE_REPLICATION */
diff --git a/sql/slave.h b/sql/slave.h
index 2c750e415bc..8122975a809 100644
--- a/sql/slave.h
+++ b/sql/slave.h
@@ -1,3 +1,5 @@
+#ifdef HAVE_REPLICATION
+
#ifndef SLAVE_H
#define SLAVE_H
@@ -186,11 +188,13 @@ typedef struct st_relay_log_info
volatile bool abort_slave, slave_running;
bool log_pos_current;
bool skip_log_purge;
-
+ bool inside_transaction;
+
st_relay_log_info()
- :info_fd(-1),cur_log_fd(-1), cur_log_old_open_count(0), abort_pos_wait(0),
- slave_run_id(0), inited(0), abort_slave(0), slave_running(0),
- log_pos_current(0), skip_log_purge(0)
+ :info_fd(-1),cur_log_fd(-1), cur_log_old_open_count(0), abort_pos_wait(0),
+ slave_run_id(0), inited(0), abort_slave(0), slave_running(0),
+ log_pos_current(0), skip_log_purge(0),
+ inside_transaction(0) /* the default is autocommit=1 */
{
relay_log_name[0] = master_log_name[0] = 0;
bzero(&info_file,sizeof(info_file));
@@ -461,3 +465,7 @@ extern I_List<i_string_pair> replicate_rewrite_db;
extern I_List<THD> threads;
#endif
+#else
+#define SLAVE_IO 1
+#define SLAVE_SQL 2
+#endif /* HAVE_REPLICATION */
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index 310ac16e927..93f2dda1283 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -55,7 +55,7 @@ static DYNAMIC_ARRAY acl_hosts,acl_users,acl_dbs;
static MEM_ROOT mem, memex;
static bool initialized=0;
static bool allow_all_hosts=1;
-static HASH acl_check_hosts, hash_tables;
+static HASH acl_check_hosts, column_priv_hash;
static DYNAMIC_ARRAY acl_wild_hosts;
static hash_filo *acl_cache;
static uint grant_version=0;
@@ -104,7 +104,7 @@ my_bool acl_init(THD *org_thd, bool dont_read_acl_tables)
DBUG_RETURN(0); /* purecov: tested */
}
- priv_version++; /* Priveleges updated */
+ priv_version++; /* Privileges updated */
/*
To be able to run this from boot, we allocate a temporary THD
@@ -112,6 +112,8 @@ my_bool acl_init(THD *org_thd, bool dont_read_acl_tables)
if (!(thd=new THD))
DBUG_RETURN(1); /* purecov: inspected */
thd->store_globals();
+ /* Use passwords according to command line option */
+ use_old_passwords= opt_old_passwords;
acl_cache->clear(1); // Clear locked hostname cache
thd->db= my_strdup("mysql",MYF(0));
@@ -176,7 +178,14 @@ my_bool acl_init(THD *org_thd, bool dont_read_acl_tables)
protocol_version=9; /* purecov: tested */
}
- DBUG_PRINT("info",("user table fields: %d",table->fields));
+ DBUG_PRINT("info",("user table fields: %d, password length: %d",
+ table->fields, table->field[2]->field_length));
+ if (table->field[2]->field_length < 45 && !use_old_passwords)
+ {
+ sql_print_error("mysql.user table is not updated to new password format; Disabling new password usage until mysql_fix_privilege_tables is run");
+ use_old_passwords= 1;
+ }
+
allow_all_hosts=0;
while (!(read_record_info.read_record(&read_record_info)))
{
@@ -192,7 +201,7 @@ my_bool acl_init(THD *org_thd, bool dont_read_acl_tables)
"Found old style password for user '%s'. Ignoring user. (You may want to restart mysqld using --old-protocol)",
user.user ? user.user : ""); /* purecov: tested */
}
- else /* non emptpy and not short passwords */
+ else /* non empty and not short passwords */
{
user.pversion=get_password_version(user.password);
/* Only passwords of specific lengths depending on version are allowed */
@@ -358,6 +367,7 @@ void acl_reload(THD *thd)
if (acl_init(thd, 0))
{ // Error. Revert to old list
+ DBUG_PRINT("error",("Reverting to old privileges"));
acl_free(); /* purecov: inspected */
acl_hosts=old_acl_hosts;
acl_users=old_acl_users;
@@ -1733,10 +1743,12 @@ static GRANT_TABLE *table_hash_search(const char *host,const char* ip,
GRANT_TABLE *grant_table,*found=0;
len = (uint) (strmov(strmov(strmov(helping,user)+1,db)+1,tname)-helping)+ 1;
- for (grant_table=(GRANT_TABLE*) hash_search(&hash_tables,(byte*) helping,
+ for (grant_table=(GRANT_TABLE*) hash_search(&column_priv_hash,
+ (byte*) helping,
len) ;
grant_table ;
- grant_table= (GRANT_TABLE*) hash_next(&hash_tables,(byte*) helping,len))
+ grant_table= (GRANT_TABLE*) hash_next(&column_priv_hash,(byte*) helping,
+ len))
{
if (exact)
{
@@ -1936,7 +1948,7 @@ static int replace_table_table(THD *thd, GRANT_TABLE *grant_table,
ulong rights, ulong col_rights,
bool revoke_grant)
{
- char grantor[HOSTNAME_LENGTH+1+USERNAME_LENGTH];
+ char grantor[HOSTNAME_LENGTH+USERNAME_LENGTH+2];
int old_row_exists = 1;
int error=0;
ulong store_table_rights, store_col_rights;
@@ -2033,7 +2045,7 @@ static int replace_table_table(THD *thd, GRANT_TABLE *grant_table,
}
else
{
- hash_delete(&hash_tables,(byte*) grant_table);
+ hash_delete(&column_priv_hash,(byte*) grant_table);
}
DBUG_RETURN(0);
@@ -2179,7 +2191,7 @@ int mysql_table_grant (THD *thd, TABLE_LIST *table_list,
result= -1; /* purecov: deadcode */
continue; /* purecov: deadcode */
}
- hash_insert(&hash_tables,(byte*) grant_table);
+ hash_insert(&column_priv_hash,(byte*) grant_table);
}
/* If revoke_grant, calculate the new column privilege for tables_priv */
@@ -2334,7 +2346,7 @@ void grant_free(void)
{
DBUG_ENTER("grant_free");
grant_option = FALSE;
- hash_free(&hash_tables);
+ hash_free(&column_priv_hash);
free_root(&memex,MYF(0));
DBUG_VOID_RETURN;
}
@@ -2352,7 +2364,7 @@ my_bool grant_init(THD *org_thd)
DBUG_ENTER("grant_init");
grant_option = FALSE;
- (void) hash_init(&hash_tables,my_charset_latin1,
+ (void) hash_init(&column_priv_hash,my_charset_latin1,
0,0,0, (hash_get_key) get_grant_table,
(hash_free_key) free_grant_table,0);
init_sql_alloc(&memex,1024,0);
@@ -2387,6 +2399,7 @@ my_bool grant_init(THD *org_thd)
if (t_table->file->index_first(t_table->record[0]))
{
t_table->file->index_end();
+ return_val= 0;
goto end_unlock;
}
grant_option= TRUE;
@@ -2398,7 +2411,7 @@ my_bool grant_init(THD *org_thd)
{
GRANT_TABLE *mem_check;
if (!(mem_check=new GRANT_TABLE(t_table,c_table)) ||
- mem_check->ok() && hash_insert(&hash_tables,(byte*) mem_check))
+ mem_check->ok() && hash_insert(&column_priv_hash,(byte*) mem_check))
{
/* This could only happen if we are out memory */
grant_option = FALSE; /* purecov: deadcode */
@@ -2427,11 +2440,12 @@ end:
}
-/* Reload grant array if possible */
+/* Reload grant array (table and column privileges) if possible */
void grant_reload(THD *thd)
{
- HASH old_hash_tables;bool old_grant_option;
+ HASH old_column_priv_hash;
+ bool old_grant_option;
MEM_ROOT old_mem;
DBUG_ENTER("grant_reload");
@@ -2439,20 +2453,21 @@ void grant_reload(THD *thd)
rw_wrlock(&LOCK_grant);
grant_version++;
- old_hash_tables=hash_tables;
+ old_column_priv_hash= column_priv_hash;
old_grant_option = grant_option;
old_mem = memex;
if (grant_init(thd))
{ // Error. Revert to old hash
+ DBUG_PRINT("error",("Reverting to old privileges"));
grant_free(); /* purecov: deadcode */
- hash_tables=old_hash_tables; /* purecov: deadcode */
+ column_priv_hash= old_column_priv_hash; /* purecov: deadcode */
grant_option = old_grant_option; /* purecov: deadcode */
memex = old_mem; /* purecov: deadcode */
}
else
{
- hash_free(&old_hash_tables);
+ hash_free(&old_column_priv_hash);
free_root(&old_mem,MYF(0));
}
rw_unlock(&LOCK_grant);
@@ -2676,9 +2691,10 @@ bool check_grant_db(THD *thd,const char *db)
len = (uint) (strmov(strmov(helping,thd->priv_user)+1,db)-helping)+ 1;
rw_rdlock(&LOCK_grant);
- for (uint idx=0 ; idx < hash_tables.records ; idx++)
+ for (uint idx=0 ; idx < column_priv_hash.records ; idx++)
{
- GRANT_TABLE *grant_table = (GRANT_TABLE*) hash_element(&hash_tables,idx);
+ GRANT_TABLE *grant_table= (GRANT_TABLE*) hash_element(&column_priv_hash,
+ idx);
if (len < grant_table->key_length &&
!memcmp(grant_table->hash_key,helping,len) &&
(thd->host && !wild_case_compare(my_charset_latin1,
@@ -2706,8 +2722,12 @@ ulong get_table_grant(THD *thd, TABLE_LIST *table)
GRANT_TABLE *grant_table;
rw_rdlock(&LOCK_grant);
+#ifdef EMBEDDED_LIBRARY
+ grant_table= NULL;
+#else
grant_table = table_hash_search(thd->host,thd->ip,db,user,
table->real_name,0);
+#endif
table->grant.grant_table=grant_table; // Remember for column test
table->grant.version=grant_version;
if (grant_table)
@@ -3000,10 +3020,11 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user)
}
/* Add column access */
- for (index=0 ; index < hash_tables.records ; index++)
+ for (index=0 ; index < column_priv_hash.records ; index++)
{
const char *user,*host;
- GRANT_TABLE *grant_table= (GRANT_TABLE*) hash_element(&hash_tables,index);
+ GRANT_TABLE *grant_table= (GRANT_TABLE*) hash_element(&column_priv_hash,
+ index);
if (!(user=grant_table->user))
user="";
diff --git a/sql/sql_analyse.cc b/sql/sql_analyse.cc
index c1d49fdab51..a424d877919 100644
--- a/sql/sql_analyse.cc
+++ b/sql/sql_analyse.cc
@@ -403,7 +403,6 @@ void field_real::add()
length= my_sprintf(buff, (buff, "%-.*f", (int) decs, num));
#endif
-
// We never need to check further than this
end = buff + length - 1 - decs + max_notzero_dec_len;
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index 08016d2df8c..16c71b437d2 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -19,6 +19,7 @@
#include "mysql_priv.h"
#include "sql_acl.h"
+#include "sql_select.h"
#include <m_ctype.h>
#include <my_dir.h>
#include <hash.h>
@@ -195,7 +196,6 @@ OPEN_TABLE_LIST *list_open_tables(THD *thd, const char *wild)
DBUG_RETURN(open_list);
}
-
/*****************************************************************************
* Functions to free open table cache
****************************************************************************/
@@ -241,6 +241,7 @@ static void free_cache_entry(TABLE *table)
DBUG_VOID_RETURN;
}
+/* Free resources allocated by filesort() and read_record() */
void free_io_cache(TABLE *table)
{
@@ -307,7 +308,8 @@ bool close_cached_tables(THD *thd, bool if_wait_for_refresh,
close_old_data_files(thd,thd->open_tables,1,1);
bool found=1;
/* Wait until all threads has closed all the tables we had locked */
- DBUG_PRINT("info", ("Waiting for others threads to close their open tables"));
+ DBUG_PRINT("info",
+ ("Waiting for others threads to close their open tables"));
while (found && ! thd->killed)
{
found=0;
@@ -348,12 +350,40 @@ bool close_cached_tables(THD *thd, bool if_wait_for_refresh,
}
-/* Put all tables used by thread in free list */
+/*
+ Close all tables used by thread
+
+ SYNOPSIS
+ close_thread_tables()
+ thd Thread handler
+ lock_in_use Set to 1 (0 = default) if caller has a lock on
+ LOCK_open
+ skip_derived Set to 1 (0 = default) if we should not free derived
+ tables.
+
+ IMPLEMENTATION
+ Unlocks tables and frees derived tables.
+ Put all normal tables used by thread in free list.
+*/
-void close_thread_tables(THD *thd, bool locked)
+void close_thread_tables(THD *thd, bool lock_in_use, bool skip_derived)
{
DBUG_ENTER("close_thread_tables");
+ if (thd->derived_tables && !skip_derived)
+ {
+ TABLE *table, *next;
+ /*
+ Close all derived tables generated from questions like
+ SELECT * from (select * from t1))
+ */
+ for (table= thd->derived_tables ; table ; table= next)
+ {
+ next= table->next;
+ free_tmp_table(thd, table);
+ }
+ thd->derived_tables= 0;
+ }
if (thd->locked_tables)
{
ha_commit_stmt(thd); // If select statement
@@ -364,10 +394,11 @@ void close_thread_tables(THD *thd, bool locked)
if (thd->lock)
{
- mysql_unlock_tables(thd, thd->lock); thd->lock=0;
+ mysql_unlock_tables(thd, thd->lock);
+ thd->lock=0;
}
/* VOID(pthread_sigmask(SIG_SETMASK,&thd->block_signals,NULL)); */
- if (!locked)
+ if (!lock_in_use)
VOID(pthread_mutex_lock(&LOCK_open));
safe_mutex_assert_owner(&LOCK_open);
@@ -386,7 +417,7 @@ void close_thread_tables(THD *thd, bool locked)
/* Tell threads waiting for refresh that something has happened */
VOID(pthread_cond_broadcast(&COND_refresh));
}
- if (!locked)
+ if (!lock_in_use)
VOID(pthread_mutex_unlock(&LOCK_open));
/* VOID(pthread_sigmask(SIG_SETMASK,&thd->signals,NULL)); */
DBUG_VOID_RETURN;
@@ -716,7 +747,7 @@ TABLE *reopen_name_locked_table(THD* thd, TABLE_LIST* table_list)
table->tablenr=thd->current_tablenr++;
table->used_fields=0;
table->const_table=0;
- table->outer_join=table->null_row=table->maybe_null=0;
+ table->outer_join= table->null_row= table->maybe_null= table->force_index= 0;
table->status=STATUS_NO_RECORD;
table->keys_in_use_for_query= table->keys_in_use;
table->used_keys= table->keys_for_keyread;
@@ -875,7 +906,7 @@ TABLE *open_table(THD *thd,const char *db,const char *table_name,
table->tablenr=thd->current_tablenr++;
table->used_fields=0;
table->const_table=0;
- table->outer_join=table->null_row=table->maybe_null=0;
+ table->outer_join= table->null_row= table->maybe_null= table->force_index= 0;
table->status=STATUS_NO_RECORD;
table->keys_in_use_for_query= table->keys_in_use;
table->used_keys= table->keys_for_keyread;
@@ -946,6 +977,7 @@ bool reopen_table(TABLE *table,bool locked)
tmp.status= table->status;
tmp.keys_in_use_for_query= tmp.keys_in_use;
tmp.used_keys= tmp.keys_for_keyread;
+ tmp.force_index= tmp.force_index;
/* Get state */
tmp.key_length= table->key_length;
@@ -1717,12 +1749,8 @@ find_field_in_tables(THD *thd, Item_ident *item, TABLE_LIST *tables,
}
if (report_error)
{
- if (thd->lex.current_select->get_master()->order_list.elements)
- my_printf_error(ER_TABLENAME_NOT_ALLOWED_HERE, ER(ER_TABLENAME_NOT_ALLOWED_HERE),
- MYF(0), table_name, thd->where);
- else
- my_printf_error(ER_UNKNOWN_TABLE, ER(ER_UNKNOWN_TABLE), MYF(0),
- table_name, thd->where);
+ my_printf_error(ER_UNKNOWN_TABLE, ER(ER_UNKNOWN_TABLE), MYF(0),
+ table_name, thd->where);
}
else
return (Field*) not_found_field;
@@ -1900,8 +1928,7 @@ int setup_fields(THD *thd, TABLE_LIST *tables, List<Item> &fields,
}
else
{
- if (item->check_cols(1) ||
- item->fix_fields(thd, tables, it.ref()))
+ if (item->fix_fields(thd, tables, it.ref()) || item->check_cols(1))
DBUG_RETURN(-1); /* purecov: inspected */
item= *(it.ref()); //Item can be chenged in fix fields
if (item->with_sum_func && item->type() != Item::SUM_FUNC_ITEM &&
@@ -1938,6 +1965,7 @@ bool setup_tables(TABLE_LIST *tables)
table->maybe_null=test(table->outer_join=table_list->outer_join);
table->tablenr=tablenr;
table->map= (table_map) 1 << tablenr;
+ table->force_index= table_list->force_index;
if (table_list->use_index)
{
key_map map= get_key_map_from_key_list(table,
@@ -2060,7 +2088,7 @@ int setup_conds(THD *thd,TABLE_LIST *tables,COND **conds)
if (*conds)
{
thd->where="where clause";
- if ((*conds)->check_cols(1) || (*conds)->fix_fields(thd, tables, conds))
+ if ((*conds)->fix_fields(thd, tables, conds) || (*conds)->check_cols(1))
DBUG_RETURN(1);
}
@@ -2071,8 +2099,8 @@ int setup_conds(THD *thd,TABLE_LIST *tables,COND **conds)
{
/* Make a join an a expression */
thd->where="on clause";
- if (table->on_expr->check_cols(1) ||
- table->on_expr->fix_fields(thd, tables, &table->on_expr))
+ if (table->on_expr->fix_fields(thd, tables, &table->on_expr) ||
+ table->on_expr->check_cols(1))
DBUG_RETURN(1);
thd->cond_count++;
diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc
index 1cfbbf74da6..ef763bbeffe 100644
--- a/sql/sql_cache.cc
+++ b/sql/sql_cache.cc
@@ -357,12 +357,6 @@ TODO list:
#define DUMP(C)
#endif
-#ifdef FN_NO_CASE_SENCE
-#define DB_NAME_PREPROCESS(C) tolower(C)
-#else
-#define DB_NAME_PREPROCESS(C) (C)
-#endif
-
const char *query_cache_type_names[]= { "OFF", "ON", "DEMAND",NullS };
TYPELIB query_cache_type_typelib=
{
@@ -761,7 +755,7 @@ void Query_cache::store_query(THD *thd, TABLE_LIST *tables_used)
if ((local_tables = is_cacheable(thd, thd->query_length,
thd->query, &thd->lex, tables_used)))
{
- NET *net = &thd->net;
+ NET *net= &thd->net;
byte flags = (thd->client_capabilities & CLIENT_LONG_FLAG ? 0x80 : 0);
STRUCT_LOCK(&structure_guard_mutex);
@@ -1022,11 +1016,13 @@ Query_cache::send_result_to_client(THD *thd, char *sql, uint query_length)
ALIGN_SIZE(sizeof(Query_cache_result))));
Query_cache_result *result = result_block->result();
+#ifndef EMBEDDED_LIBRARY /* TODO query cache in embedded library*/
if (net_real_write(&thd->net, result->data(),
result_block->used -
result_block->headers_len() -
ALIGN_SIZE(sizeof(Query_cache_result))))
break; // Client aborted
+#endif
result_block = result_block->next;
} while (result_block != first_result_block);
@@ -2478,12 +2474,18 @@ TABLE_COUNTER_TYPE Query_cache::is_cacheable(THD *thd, uint32 query_len,
if (tables_used->table->db_type == DB_TYPE_MRG_ISAM ||
tables_used->table->tmp_table != NO_TMP_TABLE ||
- (tables_used->db_length == 5 &&
- DB_NAME_PREPROCESS(tables_used->db[0])=='m' &&
- DB_NAME_PREPROCESS(tables_used->db[1])=='y' &&
- DB_NAME_PREPROCESS(tables_used->db[2])=='s' &&
- DB_NAME_PREPROCESS(tables_used->db[3])=='q' &&
- DB_NAME_PREPROCESS(tables_used->db[4])=='l'))
+ (tables_used->db_length == 5 &&
+#ifdef FN_NO_CASE_SENCE
+ // TODO: latin1 charset should be replaced with system charset
+ my_strncasecmp(my_charset_latin1,tables_used->db,"mysql",5) == 0
+#else
+ tables_used->db[0]=='m' &&
+ tables_used->db[1]=='y' &&
+ tables_used->db[2]=='s' &&
+ tables_used->db[3]=='q' &&
+ tables_used->db[4]=='l'
+#endif
+ ))
{
DBUG_PRINT("qcache",
("select not cacheable: used MRG_ISAM, temporary or system table(s)"));
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index 3ca1f4827ff..95adcc4d974 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -90,7 +90,7 @@ THD::THD():user_time(0), fatal_error(0),
db_length=query_length=col_access=0;
query_error=0;
next_insert_id=last_insert_id=0;
- open_tables=temporary_tables=handler_tables=0;
+ open_tables= temporary_tables= handler_tables= derived_tables= 0;
current_tablenr=0;
handler_items=0;
tmp_table=0;
@@ -108,8 +108,10 @@ THD::THD():user_time(0), fatal_error(0),
mysys_var=0;
#ifndef DBUG_OFF
dbug_sentry=THD_SENTRY_MAGIC;
-#endif
+#endif
+#ifndef EMBEDDED_LIBRARY
net.vio=0;
+#endif
net.last_error[0]=0; // If error on boot
ull=0;
system_thread=cleanup_done=0;
@@ -193,7 +195,6 @@ void THD::init(void)
pthread_mutex_unlock(&LOCK_global_system_variables);
server_status= SERVER_STATUS_AUTOCOMMIT;
options= thd_startup_options;
- sql_mode=(uint) opt_sql_mode;
open_options=ha_open_options;
update_lock_default= (variables.low_priority_updates ?
TL_WRITE_LOW_PRIORITY :
@@ -268,11 +269,13 @@ THD::~THD()
pthread_mutex_unlock(&LOCK_delete);
/* Close connection */
+#ifndef EMBEDDED_LIBRARY
if (net.vio)
{
vio_delete(net.vio);
net_end(&net);
}
+#endif
if (!cleanup_done)
cleanup();
#ifdef USING_TRANSACTIONS
@@ -512,7 +515,6 @@ bool select_send::send_fields(List<Item> &list,uint flag)
return thd->protocol->send_fields(&list,flag);
}
-
/* Send data to client. Returns 0 if ok */
bool select_send::send_data(List<Item> &items)
@@ -526,7 +528,7 @@ bool select_send::send_data(List<Item> &items)
List_iterator_fast<Item> li(items);
Protocol *protocol= thd->protocol;
char buff[MAX_FIELD_WIDTH];
- String buffer(buff, sizeof(buff), NULL);
+ String buffer(buff, sizeof(buff), my_charset_bin);
DBUG_ENTER("send_data");
protocol->prepare_for_resend();
@@ -649,7 +651,7 @@ bool select_export::send_data(List<Item> &items)
DBUG_ENTER("send_data");
char buff[MAX_FIELD_WIDTH],null_buff[2],space[MAX_FIELD_WIDTH];
bool space_inited=0;
- String tmp(buff,sizeof(buff),NULL),*res;
+ String tmp(buff,sizeof(buff),my_charset_bin),*res;
tmp.length(0);
if (unit->offset_limit_cnt)
@@ -857,7 +859,7 @@ bool select_dump::send_data(List<Item> &items)
{
List_iterator_fast<Item> li(items);
char buff[MAX_FIELD_WIDTH];
- String tmp(buff,sizeof(buff),NULL),*res;
+ String tmp(buff,sizeof(buff),my_charset_bin),*res;
tmp.length(0);
Item *item;
DBUG_ENTER("send_data");
@@ -968,11 +970,12 @@ int select_dumpvar::prepare(List<Item> &list, SELECT_LEX_UNIT *u)
my_error(ER_WRONG_NUMBER_OF_COLUMNS_IN_SELECT, MYF(0));
return 1;
}
+ unit=u;
while ((item=li++))
{
ls= gl++;
Item_func_set_user_var *xx = new Item_func_set_user_var(*ls,item);
- xx->fix_fields(current_thd,(TABLE_LIST*) current_thd->lex.select_lex.table_list.first,&item);
+ xx->fix_fields(thd,(TABLE_LIST*) thd->lex.select_lex.table_list.first,&item);
xx->fix_length_and_dec();
vars.push_back(xx);
}
@@ -984,6 +987,11 @@ bool select_dumpvar::send_data(List<Item> &items)
Item_func_set_user_var *xx;
DBUG_ENTER("send_data");
+ if (unit->offset_limit_cnt)
+ { // Using limit offset,count
+ unit->offset_limit_cnt--;
+ DBUG_RETURN(0);
+ }
if (row_count++)
{
my_error(ER_TOO_MANY_ROWS, MYF(0));
diff --git a/sql/sql_class.h b/sql/sql_class.h
index ab9230e5f01..216720da801 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -177,6 +177,12 @@ public:
{
convert_array(from_map, (uchar*) a,length);
}
+ char *store_dest(char *to, const char *from, uint length)
+ {
+ for (const char *end=from+length ; from != end ; from++)
+ *to++= to_map[(uchar) *from];
+ return to;
+ }
bool store(String *, const char *,uint);
inline uint number() { return numb; }
};
@@ -338,14 +344,18 @@ class select_result;
#define THD_SENTRY_MAGIC 0xfeedd1ff
#define THD_SENTRY_GONE 0xdeadbeef
+#ifdef EMBEDDED_LIBRARY
+typedef struct st_mysql;
+#endif
+
#define THD_CHECK_SENTRY(thd) DBUG_ASSERT(thd->dbug_sentry == THD_SENTRY_MAGIC)
struct system_variables
{
ulonglong myisam_max_extra_sort_file_size;
ulonglong myisam_max_sort_file_size;
- ulonglong select_limit;
- ulonglong max_join_size;
+ ha_rows select_limit;
+ ha_rows max_join_size;
ulong bulk_insert_buff_size;
ulong join_buff_size;
ulong long_query_time;
@@ -369,6 +379,7 @@ struct system_variables
ulong table_type;
ulong tmp_table_size;
ulong tx_isolation;
+ ulong sql_mode;
/*
In slave thread we need to know in behalf of which
@@ -388,9 +399,11 @@ struct system_variables
For each client connection we create a separate thread with THD serving as
a thread/connection descriptor
*/
-
class THD :public ilink {
public:
+#ifdef EMBEDDED_LIBRARY
+ struct st_mysql *mysql;
+#endif
NET net; // client connection descriptor
LEX lex; // parse tree descriptor
MEM_ROOT mem_root; // 1 command-life memory pool
@@ -429,10 +442,9 @@ public:
/* points to host if host is available, otherwise points to ip */
const char *host_or_ip;
- uint client_capabilities; /* What the client supports */
+ ulong client_capabilities; /* What the client supports */
/* Determines if which non-standard SQL behaviour should be enabled */
- uint sql_mode;
- uint max_client_packet_length;
+ ulong max_client_packet_length;
ulong master_access; /* Global privileges from mysql.user */
ulong db_access; /* Privileges for current db */
@@ -442,7 +454,7 @@ public:
handler_tables - list of tables that were opened with HANDLER OPEN
and are still in use by this thread
*/
- TABLE *open_tables,*temporary_tables, *handler_tables;
+ TABLE *open_tables,*temporary_tables, *handler_tables, *derived_tables;
// TODO: document the variables below
MYSQL_LOCK *lock; /* Current locks */
MYSQL_LOCK *locked_tables; /* Tables locked with LOCK */
@@ -542,6 +554,7 @@ public:
THD();
~THD();
+
void init(void);
void change_user(void);
void cleanup(void);
@@ -637,12 +650,17 @@ public:
void add_changed_table(const char *key, long key_length);
CHANGED_TABLE_LIST * changed_table_dup(const char *key, long key_length);
int send_explain_fields(select_result *result);
+#ifndef EMBEDDED_LIBRARY
inline void clear_error()
{
net.last_error[0]= 0;
net.last_errno= 0;
net.report_error= 0;
}
+#else
+ void clear_error();
+#endif
+
void add_possible_loop(Item *);
};
diff --git a/sql/sql_db.cc b/sql/sql_db.cc
index 311bf29aee7..1c441ea7a26 100644
--- a/sql/sql_db.cc
+++ b/sql/sql_db.cc
@@ -114,10 +114,12 @@ static bool load_db_opt(const char *path, HA_CREATE_INFO *create)
{
if (!strncmp(buf,"default-character-set", (pos-buf)))
{
- if (!(create->table_charset=get_charset_by_name(pos+1, MYF(0))))
+ if (strcmp(pos+1,"DEFAULT"))
{
- sql_print_error(ER(ER_UNKNOWN_CHARACTER_SET),
- pos+1);
+ if (!(create->table_charset=get_charset_by_name(pos+1, MYF(0))))
+ {
+ sql_print_error(ER(ER_UNKNOWN_CHARACTER_SET),pos+1);
+ }
}
}
}
@@ -333,7 +335,8 @@ int mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent)
}
else
{
- store_warning(thd,ER_DB_DROP_EXISTS,db);
+ push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
+ ER_DB_DROP_EXISTS, ER(ER_DB_DROP_EXISTS), db);
if (!silent)
send_ok(thd,0);
}
@@ -468,7 +471,7 @@ static long mysql_rm_known_files(THD *thd, MY_DIR *dirp, const char *db,
my_dirend(dirp);
if (thd->killed ||
- (tot_list && mysql_rm_table_part2_with_lock(thd, tot_list, 1, 1)))
+ (tot_list && mysql_rm_table_part2_with_lock(thd, tot_list, 1, 0, 1)))
DBUG_RETURN(-1);
/*
@@ -675,9 +678,13 @@ int mysqld_show_create_db(THD *thd, const char *dbname,
to=strxmov(to,"`",dbname,"`", NullS);
if (create.table_charset)
- to= strxmov(to," /*!40100 DEFAULT CHARACTER SET ",
- create.table_charset->name,"*/",NullS);
-
+ {
+ int cl= (create.table_charset->state & MY_CS_PRIMARY) ? 0 : 1;
+ to= strxmov(to," /*!40100"
+ " DEFAULT CHARACTER SET ",create.table_charset->csname,
+ cl ? " COLLATE " : "", cl ? create.table_charset->name : "",
+ " */",NullS);
+ }
protocol->store(path, (uint) (to-path));
if (protocol->write())
diff --git a/sql/sql_derived.cc b/sql/sql_derived.cc
index 1ddaedeb480..f4c3979a34a 100644
--- a/sql/sql_derived.cc
+++ b/sql/sql_derived.cc
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 MySQL AB
+/* Copyright (C) 2002-2003 MySQL AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -17,7 +17,7 @@
/*
Derived tables
- These were introduced by Monty and Sinisa <sinisa@mysql.com>
+ These were introduced by Sinisa <sinisa@mysql.com>
*/
@@ -25,7 +25,7 @@
#include "sql_select.h"
#include "sql_acl.h"
-static const char *any_db="*any*"; // Special symbol for check_access
+extern const char *any_db; // Special symbol for check_access
/*
Resolve derived tables in all queries
@@ -38,17 +38,26 @@ static const char *any_db="*any*"; // Special symbol for check_access
t TABLE_LIST for the upper SELECT
IMPLEMENTATION
-
- Derived table is resolved with temporary table. It is created based on the
- queries defined. After temporary table is created, if this is not EXPLAIN,
- then the entire unit / node is deleted. unit is deleted if UNION is used
- for derived table and node is deleted is it is a simple SELECT.
+ Derived table is resolved with temporary table. It is created based on the
+ queries defined. After temporary table is created, if this is not EXPLAIN,
+ then the entire unit / node is deleted. unit is deleted if UNION is used
+ for derived table and node is deleted is it is a simple SELECT.
+
+ After table creation, the above TABLE_LIST is updated with a new table.
- After table creation, the above TABLE_LIST is updated with a new table.
+ This function is called before any command containing derived table
+ is executed.
- This function is called before any command containing derived table is executed.
+ Derived tables is stored in thd->derived_tables and freed in
+ close_thread_tables()
- TODO: To move creation of derived tables IN open_and_lock_tables()
+ TODO
+ Move creation of derived tables in open_and_lock_tables()
+
+ RETURN
+ 0 ok
+ 1 Error
+ -1 Error and error message given
*/
@@ -57,21 +66,21 @@ int mysql_derived(THD *thd, LEX *lex, SELECT_LEX_UNIT *unit, TABLE_LIST *t)
SELECT_LEX *sl= unit->first_select();
List<Item> item_list;
TABLE *table;
- int res= 0;
+ int res;
select_union *derived_result;
TABLE_LIST *tables= (TABLE_LIST *)sl->table_list.first;
TMP_TABLE_PARAM tmp_table_param;
bool is_union=sl->next_select() && sl->next_select()->linkage == UNION_TYPE;
- DBUG_ENTER("mysql_derived");
SELECT_LEX_NODE *save_current_select= lex->current_select;
+ DBUG_ENTER("mysql_derived");
-
-/*
- In create_total_list, derived tables have to be treated in case of EXPLAIN,
- This is because unit/node is not deleted in that case. Current code in this
- function has to be improved to recognize better when this function is called
- from derived tables and when from other functions.
-*/
+ /*
+ In create_total_list, derived tables have to be treated in case of
+ EXPLAIN, This is because unit/node is not deleted in that
+ case. Current code in this function has to be improved to
+ recognize better when this function is called from derived tables
+ and when from other functions.
+ */
if (is_union && unit->create_total_list(thd, lex, &tables))
DBUG_RETURN(-1);
@@ -92,30 +101,21 @@ int mysql_derived(THD *thd, LEX *lex, SELECT_LEX_UNIT *unit, TABLE_LIST *t)
{
if (is_union)
{
-/*
- The following code is a re-do of fix_tables_pointers() found in sql_select.cc
- for UNION's within derived tables. The only difference is in navigation, as in
- derived tables we care for this level only.
-
- fix_tables_pointers makes sure that in UNION's we do not open single table twice
- if found in different SELECT's.
-
-*/
- for (SELECT_LEX *sel= sl;
- sel;
- sel= sel->next_select())
- {
- for (TABLE_LIST *cursor= (TABLE_LIST *)sel->table_list.first;
- cursor;
- cursor=cursor->next)
- cursor->table= cursor->table_list->table;
- }
+ /*
+ The following code is a re-do of fix_tables_pointers() found
+ in sql_select.cc for UNION's within derived tables. The only
+ difference is in navigation, as in derived tables we care for
+ this level only.
+
+ */
+ for (SELECT_LEX *sel= sl; sel; sel= sel->next_select())
+ relink_tables(sel);
}
lex->current_select= sl;
if (setup_fields(thd,tables,item_list,0,0,1))
{
- res=-1;
+ res= -1;
goto exit;
}
bzero((char*) &tmp_table_param,sizeof(tmp_table_param));
@@ -127,7 +127,7 @@ int mysql_derived(THD *thd, LEX *lex, SELECT_LEX_UNIT *unit, TABLE_LIST *t)
TMP_TABLE_ALL_COLUMNS),
HA_POS_ERROR)))
{
- res=-1;
+ res= -1;
goto exit;
}
@@ -142,7 +142,7 @@ int mysql_derived(THD *thd, LEX *lex, SELECT_LEX_UNIT *unit, TABLE_LIST *t)
sl->options&= ~OPTION_FOUND_ROWS;
if (is_union)
- res=mysql_union(thd,lex,derived_result,unit);
+ res= mysql_union(thd,lex,derived_result,unit);
else
res= mysql_select(thd, tables, sl->item_list,
sl->where, (ORDER *) sl->order_list.first,
@@ -153,9 +153,12 @@ int mysql_derived(THD *thd, LEX *lex, SELECT_LEX_UNIT *unit, TABLE_LIST *t)
if (!res)
{
-// Here we entirely fix both TABLE_LIST and list of SELECT's as there were no derived tables
+ /*
+ Here we entirely fix both TABLE_LIST and list of SELECT's as
+ there were no derived tables
+ */
if (derived_result->flush())
- res=1;
+ res= 1;
else
{
t->real_name=table->real_name;
@@ -164,23 +167,29 @@ int mysql_derived(THD *thd, LEX *lex, SELECT_LEX_UNIT *unit, TABLE_LIST *t)
table->tmp_table=TMP_TABLE;
if (lex->describe)
{
+ // to fix a problem in EXPLAIN
if (tables)
- tables->table_list->table=tables->table; // to fix a problem in EXPLAIN
+ tables->table_list->table=tables->table;
}
else
unit->exclude();
- t->db=(char *)"";
- t->derived=(SELECT_LEX *)1; // just in case ...
+ t->db= (char *)"";
+ t->derived=(SELECT_LEX *) 1; // just in case ...
table->file->info(HA_STATUS_VARIABLE);
}
}
delete derived_result;
}
if (res)
- free_tmp_table(thd,table);
+ free_tmp_table(thd, table);
+ else
+ {
+ table->next= thd->derived_tables;
+ thd->derived_tables= table;
+ }
exit:
lex->current_select= save_current_select;
- close_thread_tables(thd);
+ close_thread_tables(thd, 0, 1);
}
DBUG_RETURN(res);
}
diff --git a/sql/sql_error.cc b/sql/sql_error.cc
index c9684855b86..5508be5167a 100644
--- a/sql/sql_error.cc
+++ b/sql/sql_error.cc
@@ -105,31 +105,29 @@ void push_warning(THD *thd, MYSQL_ERROR::enum_warning_level level, uint code,
}
/*
- Store warning to the list
+ Push the warning/error to error list if there is still room in the list
+
+ SYNOPSIS
+ push_warning_printf()
+ thd Thread handle
+ level Severity of warning (note, warning, error ...)
+ code Error number
+ msg Clear error message
*/
-void store_warning(THD *thd, uint errcode, ...)
+void push_warning_printf(THD *thd, MYSQL_ERROR::enum_warning_level level,
+ uint code, const char *format, ...)
{
-#if TESTS_TO_BE_FIXED
va_list args;
- const char *format;
char warning[ERRMSGSIZE+20];
- DBUG_ENTER("store_warning");
- DBUG_PRINT("enter",("warning: %u",errcode));
+ DBUG_ENTER("push_warning_printf");
+ DBUG_PRINT("enter",("warning: %u", code));
- va_start(args,errcode);
- if (errcode)
- format= ER(errcode);
- else
- {
- format=va_arg(args,char*);
- errcode= ER_UNKNOWN_ERROR;
- }
- (void) vsprintf (warning,format,args);
+ va_start(args,format);
+ my_vsnprintf(warning, sizeof(warning), format, args);
va_end(args);
- push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, errcode, warning);
+ push_warning(thd, level, code, warning);
DBUG_VOID_RETURN;
-#endif
}
diff --git a/sql/sql_handler.cc b/sql/sql_handler.cc
index 97703cd6b20..acf3fd2914a 100644
--- a/sql/sql_handler.cc
+++ b/sql/sql_handler.cc
@@ -106,9 +106,13 @@ int mysql_ha_read(THD *thd, TABLE_LIST *tables,
}
tables->table=table;
- if (cond && (cond->check_cols(1) || cond->fix_fields(thd, tables, &cond)))
+ if (cond && (cond->fix_fields(thd, tables, &cond) || cond->check_cols(1)))
return -1;
+ /* InnoDB needs to know that this table handle is used in the HANDLER */
+
+ table->file->init_table_handle_for_HANDLER();
+
if (keyname)
{
if ((keyno=find_type(keyname, &table->keynames, 1+2)-1)<0)
@@ -131,8 +135,6 @@ int mysql_ha_read(THD *thd, TABLE_LIST *tables,
insert_fields(thd,tables,tables->db,tables->alias,&it);
- table->file->init_table_handle_for_HANDLER(); // Only InnoDB requires it
-
select_limit+=offset_limit;
protocol->send_fields(&list,1);
@@ -142,6 +144,12 @@ int mysql_ha_read(THD *thd, TABLE_LIST *tables,
if (!lock)
goto err0; // mysql_lock_tables() printed error message already
+ /* In ::external_lock InnoDB resets the fields which tell it that
+ the handle is used in the HANDLER interface. Tell it again that
+ we are using it for HANDLER. */
+
+ table->file->init_table_handle_for_HANDLER();
+
for (num_rows=0; num_rows < select_limit; )
{
switch (mode) {
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc
index f45e09cf0bf..e76e982adea 100644
--- a/sql/sql_insert.cc
+++ b/sql/sql_insert.cc
@@ -109,7 +109,7 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list,
int error;
bool log_on= ((thd->options & OPTION_UPDATE_LOG) ||
!(thd->master_access & SUPER_ACL));
- bool transactional_table, log_delayed, bulk_insert=0;
+ bool transactional_table, log_delayed, bulk_insert;
uint value_count;
ulong counter = 1;
ulonglong id;
@@ -217,21 +217,17 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list,
thd->proc_info="update";
if (duplic != DUP_ERROR)
table->file->extra(HA_EXTRA_IGNORE_DUP_KEY);
- if ((bulk_insert= (values_list.elements >= MIN_ROWS_TO_USE_BULK_INSERT &&
- lock_type != TL_WRITE_DELAYED &&
- !(specialflag & SPECIAL_SAFE_MODE))))
+ if ((lock_type != TL_WRITE_DELAYED && !(specialflag & SPECIAL_SAFE_MODE)) &&
+ values_list.elements >= MIN_ROWS_TO_USE_BULK_INSERT)
{
table->file->extra_opt(HA_EXTRA_WRITE_CACHE,
min(thd->variables.read_buff_size,
table->avg_row_length*values_list.elements));
- if (thd->variables.bulk_insert_buff_size)
- table->file->extra_opt(HA_EXTRA_BULK_INSERT_BEGIN,
- min(thd->variables.bulk_insert_buff_size,
- (table->total_key_length +
- table->keys * TREE_ELEMENT_EXTRA_SIZE)*
- values_list.elements));
- table->bulk_insert= 1;
+ table->file->deactivate_non_unique_index(values_list.elements);
+ bulk_insert=1;
}
+ else
+ bulk_insert=0;
while ((values= its++))
{
@@ -309,7 +305,7 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list,
error=1;
}
}
- if (table->file->extra(HA_EXTRA_BULK_INSERT_END))
+ if (table->file->activate_all_index(thd))
{
if (!error)
{
@@ -317,7 +313,6 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list,
error=1;
}
}
- table->bulk_insert= 0;
}
if (id && values_list.elements != 1)
thd->insert_id(id); // For update log
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc
index c7595c7ec5c..e4fc3a5aec3 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -107,7 +107,7 @@ void lex_init(void)
state_map[i]=(uchar) STATE_CHAR;
}
state_map[(uchar)'_']=state_map[(uchar)'$']=(uchar) STATE_IDENT;
- state_map[(uchar)'\'']=state_map[(uchar)'"']=(uchar) STATE_STRING;
+ state_map[(uchar)'\'']=(uchar) STATE_STRING;
state_map[(uchar)'-']=state_map[(uchar)'+']=(uchar) STATE_SIGNED_NUMBER;
state_map[(uchar)'.']=(uchar) STATE_REAL_OR_POINT;
state_map[(uchar)'>']=state_map[(uchar)'=']=state_map[(uchar)'!']= (uchar) STATE_CMP_OP;
@@ -122,10 +122,7 @@ void lex_init(void)
state_map[(uchar)'*']= (uchar) STATE_END_LONG_COMMENT;
state_map[(uchar)'@']= (uchar) STATE_USER_END;
state_map[(uchar) '`']= (uchar) STATE_USER_VARIABLE_DELIMITER;
- if (opt_sql_mode & MODE_ANSI_QUOTES)
- {
- state_map[(uchar) '"'] = STATE_USER_VARIABLE_DELIMITER;
- }
+ state_map[(uchar)'"']= (uchar) STAT_STRING_OR_DELIMITER;
/*
Create a second map to make it faster to find identifiers
@@ -167,7 +164,7 @@ LEX *lex_start(THD *thd, uchar *buf,uint length)
lex->convert_set= (lex->thd= thd)->variables.convert_set;
lex->thd_charset= lex->thd->variables.thd_charset;
lex->yacc_yyss=lex->yacc_yyvs=0;
- lex->ignore_space=test(thd->sql_mode & MODE_IGNORE_SPACE);
+ lex->ignore_space=test(thd->variables.sql_mode & MODE_IGNORE_SPACE);
lex->slave_thd_opt=0;
lex->sql_command=SQLCOM_END;
lex->safe_to_cache_query= 1;
@@ -222,7 +219,7 @@ static int find_keyword(LEX *lex, uint len, bool function)
/* make a copy of token before ptr and set yytoklen */
-LEX_STRING get_token(LEX *lex,uint length)
+static LEX_STRING get_token(LEX *lex,uint length)
{
LEX_STRING tmp;
yyUnget(); // ptr points now after last token char
@@ -231,8 +228,27 @@ LEX_STRING get_token(LEX *lex,uint length)
return tmp;
}
-/* Return an unescaped text literal without quotes */
-/* Fix sometimes to do only one scan of the string */
+static LEX_STRING get_quoted_token(LEX *lex,uint length, char quote)
+{
+ LEX_STRING tmp;
+ byte *from, *to, *end;
+ yyUnget(); // ptr points now after last token char
+ tmp.length=lex->yytoklen=length;
+ tmp.str=(char*) lex->thd->alloc(tmp.length+1);
+ for (from= (byte*) lex->tok_start, to= tmp.str, end= to+length ; to != end ;)
+ {
+ if ((*to++= *from++) == quote)
+ from++; // Skip double quotes
+ }
+ *to= 0; // End null for safety
+ return tmp;
+}
+
+
+/*
+ Return an unescaped text literal without quotes
+ Fix sometimes to do only one scan of the string
+*/
static char *get_text(LEX *lex)
{
@@ -558,7 +574,7 @@ int yylex(void *arg, void *yythd)
*/
if ((yylval->lex_str.str[0]=='_') &&
- (lex->charset=get_charset_by_name(yylval->lex_str.str+1,MYF(0))))
+ (lex->charset=get_charset_by_csname(yylval->lex_str.str+1,MYF(0))))
return(UNDERSCORE_CHARSET);
else
return(IDENT);
@@ -652,12 +668,13 @@ int yylex(void *arg, void *yythd)
return(IDENT);
case STATE_USER_VARIABLE_DELIMITER:
+ {
+ char delim= c; // Used char
lex->tok_start=lex->ptr; // Skip first `
#ifdef USE_MB
if (use_mb(system_charset_info))
{
- while ((c=yyGet()) && state_map[c] != STATE_USER_VARIABLE_DELIMITER &&
- c != (uchar) NAMES_SEP_CHAR)
+ while ((c=yyGet()) && c != delim && c != (uchar) NAMES_SEP_CHAR)
{
if (my_ismbhead(system_charset_info, c))
{
@@ -669,20 +686,38 @@ int yylex(void *arg, void *yythd)
lex->ptr += l-1;
}
}
+ yylval->lex_str=get_token(lex,yyLength());
}
else
#endif
{
- while ((c=yyGet()) && state_map[c] != STATE_USER_VARIABLE_DELIMITER &&
- c != (uchar) NAMES_SEP_CHAR) ;
+ uint double_quotes= 0;
+ char quote_char= c;
+ while ((c=yyGet()))
+ {
+ if (c == quote_char)
+ {
+ if (yyPeek() != quote_char)
+ break;
+ c=yyGet();
+ double_quotes++;
+ continue;
+ }
+ if (c == (uchar) NAMES_SEP_CHAR)
+ break;
+ }
+ if (double_quotes)
+ yylval->lex_str=get_quoted_token(lex,yyLength() - double_quotes,
+ quote_char);
+ else
+ yylval->lex_str=get_token(lex,yyLength());
}
- yylval->lex_str=get_token(lex,yyLength());
if (lex->convert_set)
lex->convert_set->convert((char*) yylval->lex_str.str,lex->yytoklen);
- if (state_map[c] == STATE_USER_VARIABLE_DELIMITER)
+ if (c == delim)
yySkip(); // Skip end `
return(IDENT);
-
+ }
case STATE_SIGNED_NUMBER: // Incomplete signed number
if (prev_state == STATE_OPERATOR_OR_IDENT)
{
@@ -795,6 +830,13 @@ int yylex(void *arg, void *yythd)
lex->next_state= STATE_START; // Allow signed numbers
return(tokval);
+ case STAT_STRING_OR_DELIMITER:
+ if (((THD *) yythd)->variables.sql_mode & MODE_ANSI_QUOTES)
+ {
+ state= STATE_USER_VARIABLE_DELIMITER;
+ break;
+ }
+ /* " used for strings */
case STATE_STRING: // Incomplete text string
if (!(yylval->lex_str.str = get_text(lex)))
{
@@ -864,7 +906,15 @@ int yylex(void *arg, void *yythd)
case STATE_COLON: // optional line terminator
if (yyPeek())
{
- state=STATE_CHAR; // Return ';'
+ if (((THD *)yythd)->client_capabilities & CLIENT_MULTI_QUERIES)
+ {
+ lex->found_colon=(char*)lex->ptr;
+ ((THD *)yythd)->server_status |= SERVER_MORE_RESULTS_EXISTS;
+ lex->next_state=STATE_END;
+ return(END_OF_INPUT);
+ }
+ else
+ state=STATE_CHAR; // Return ';'
break;
}
/* fall true */
@@ -889,6 +939,7 @@ int yylex(void *arg, void *yythd)
switch (state_map[yyPeek()]) {
case STATE_STRING:
case STATE_USER_VARIABLE_DELIMITER:
+ case STAT_STRING_OR_DELIMITER:
break;
case STATE_USER_END:
lex->next_state=STATE_SYSTEM_VAR;
@@ -943,7 +994,7 @@ int yylex(void *arg, void *yythd)
void st_select_lex_node::init_query()
{
- dependent= 0;
+ no_table_names_allowed= dependent= 0;
}
void st_select_lex_node::init_select()
@@ -1171,13 +1222,14 @@ List<String>* st_select_lex_node::get_use_index() { return 0; }
List<String>* st_select_lex_node::get_ignore_index() { return 0; }
TABLE_LIST *st_select_lex_node::add_table_to_list(THD *thd, Table_ident *table,
LEX_STRING *alias,
- bool updating,
+ ulong table_join_options,
thr_lock_type flags,
List<String> *use_index,
List<String> *ignore_index)
{
return 0;
}
+ulong st_select_lex_node::get_table_join_options() { return 0; }
/*
This is used for UNION & subselect to create a new table list of all used
@@ -1334,6 +1386,11 @@ List<String>* st_select_lex::get_ignore_index()
return ignore_index_ptr;
}
+ulong st_select_lex::get_table_join_options()
+{
+ return table_join_options;
+}
+
/*
There are st_select_lex::add_table_to_list &
st_select_lex::set_lock_for_tables in sql_parse.cc
diff --git a/sql/sql_lex.h b/sql/sql_lex.h
index 9b8f4a47515..9fc00e5f56d 100644
--- a/sql/sql_lex.h
+++ b/sql/sql_lex.h
@@ -86,7 +86,8 @@ enum lex_states
STATE_REAL_OR_POINT, STATE_BOOL, STATE_EOL, STATE_ESCAPE, STATE_LONG_COMMENT,
STATE_END_LONG_COMMENT, STATE_COLON, STATE_SET_VAR, STATE_USER_END,
STATE_HOSTNAME, STATE_SKIP, STATE_USER_VARIABLE_DELIMITER, STATE_SYSTEM_VAR,
- STATE_IDENT_OR_KEYWORD, STATE_IDENT_OR_HEX, STATE_IDENT_OR_BIN
+ STATE_IDENT_OR_KEYWORD, STATE_IDENT_OR_HEX, STATE_IDENT_OR_BIN,
+ STAT_STRING_OR_DELIMITER
};
@@ -212,6 +213,7 @@ public:
bool with_sum_func;
bool create_refs;
bool dependent; /* dependent from outer select subselect */
+ bool no_table_names_allowed; /* used for global order by */
static void *operator new(size_t size)
{
@@ -243,9 +245,10 @@ public:
virtual List<Item>* get_item_list();
virtual List<String>* get_use_index();
virtual List<String>* get_ignore_index();
+ virtual ulong get_table_join_options();
virtual TABLE_LIST *add_table_to_list(THD *thd, Table_ident *table,
LEX_STRING *alias,
- bool updating,
+ ulong table_options,
thr_lock_type flags= TL_UNLOCK,
List<String> *use_index= 0,
List<String> *ignore_index= 0);
@@ -336,6 +339,7 @@ public:
List<Item_func_match> ftfunc_list_alloc;
JOIN *join; /* after JOIN::prepare it is pointer to corresponding JOIN */
const char *type; /* type of select for EXPLAIN */
+ ulong table_join_options;
uint in_sum_expr;
uint select_number; /* number of select (used for EXPLAIN) */
bool braces; /* SELECT ... UNION (SELECT ... ) <- this braces */
@@ -373,9 +377,10 @@ public:
List<Item>* get_item_list();
List<String>* get_use_index();
List<String>* get_ignore_index();
+ ulong get_table_join_options();
TABLE_LIST* add_table_to_list(THD *thd, Table_ident *table,
LEX_STRING *alias,
- bool updating,
+ ulong table_options,
thr_lock_type flags= TL_UNLOCK,
List<String> *use_index= 0,
List<String> *ignore_index= 0);
@@ -409,6 +414,7 @@ typedef struct st_lex
char *backup_dir; /* For RESTORE/BACKUP */
char* to_log; /* For PURGE MASTER LOGS TO */
char* x509_subject,*x509_issuer,*ssl_cipher;
+ char* found_colon; /* For multi queries - next query */
enum SSL_type ssl_type; /* defined in violite.h */
String *wild;
sql_exchange *exchange;
diff --git a/sql/sql_load.cc b/sql/sql_load.cc
index 00450a3b86c..71d8a3e181b 100644
--- a/sql/sql_load.cc
+++ b/sql/sql_load.cc
@@ -77,6 +77,8 @@ static int read_sep_field(THD *thd,COPY_INFO &info,TABLE *table,
String &enclosed);
+#ifndef EMBEDDED_LIBRARY
+
int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
List<Item> &fields, enum enum_duplicates handle_duplicates,
bool read_file_from_client,thr_lock_type lock_type)
@@ -156,12 +158,14 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
if (read_file_from_client && handle_duplicates == DUP_ERROR)
handle_duplicates=DUP_IGNORE;
+#ifndef EMBEDDED_LIBRARY
if (read_file_from_client)
{
(void)net_request_file(&thd->net,ex->file_name);
file = -1;
}
else
+#endif
{
read_file_from_client=0;
#ifdef DONT_ALLOW_FULL_LOAD_DATA_PATHS
@@ -269,11 +273,6 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
table->file->extra(HA_EXTRA_NO_IGNORE_DUP_KEY);
table->time_stamp=save_time_stamp;
table->next_number_field=0;
- if (thd->lock)
- {
- mysql_unlock_tables(thd, thd->lock);
- thd->lock=0;
- }
}
if (file >= 0) my_close(file,MYF(0));
free_blobs(table); /* if pack_blob was used */
@@ -288,11 +287,26 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
{
if (lf_info.wrote_create_file)
{
+ /*
+ Make sure last block (the one which caused the error) gets logged.
+ This is needed because otherwise after write of
+ (to the binlog, not to read_info (which is a cache))
+ Delete_file_log_event the bad block will remain in read_info.
+ At the end of mysql_load(), the destructor of read_info will call
+ end_io_cache() which will flush read_info, so we will finally have
+ this in the binlog:
+ Append_block # The last successfull block
+ Delete_file
+ Append_block # The failing block
+ which is nonsense.
+ */
+ read_info.end_io_cache();
Delete_file_log_event d(thd, log_delayed);
mysql_bin_log.write(&d);
}
}
- DBUG_RETURN(-1); // Error on read
+ error= -1; // Error on read
+ goto err;
}
sprintf(name,ER(ER_LOAD_INFO),info.records,info.deleted,
info.records-info.copied,thd->cuted_fields);
@@ -326,9 +340,17 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
}
if (transactional_table)
error=ha_autocommit_or_rollback(thd,error);
+
+err:
+ if (thd->lock)
+ {
+ mysql_unlock_tables(thd, thd->lock);
+ thd->lock=0;
+ }
DBUG_RETURN(error);
}
+#endif /* EMBEDDED_LIBRARY */
/****************************************************************************
** Read of rows of fixed size + optional garage + optonal newline
@@ -340,8 +362,10 @@ read_fixed_length(THD *thd,COPY_INFO &info,TABLE *table,List<Item> &fields,
{
List_iterator_fast<Item> it(fields);
Item_field *sql_field;
+ ulonglong id;
DBUG_ENTER("read_fixed_length");
+ id=0;
/* No fields can be null in this format. mark all fields as not null */
while ((sql_field= (Item_field*) it++))
sql_field->field->set_notnull();
@@ -384,6 +408,14 @@ read_fixed_length(THD *thd,COPY_INFO &info,TABLE *table,List<Item> &fields,
thd->cuted_fields++; /* To long row */
if (write_record(table,&info))
DBUG_RETURN(1);
+ /*
+ If auto_increment values are used, save the first one
+ for LAST_INSERT_ID() and for the binary/update log.
+ We can't use insert_id() as we don't want to touch the
+ last_insert_id_used flag.
+ */
+ if (!id && thd->insert_id_used)
+ id= thd->last_insert_id;
if (table->next_number_field)
table->next_number_field->reset(); // Clear for next record
if (read_info.next_line()) // Skip to next line
@@ -391,6 +423,8 @@ read_fixed_length(THD *thd,COPY_INFO &info,TABLE *table,List<Item> &fields,
if (read_info.line_cuted)
thd->cuted_fields++; /* To long row */
}
+ if (id && !read_info.error)
+ thd->insert_id(id); // For binary/update log
DBUG_RETURN(test(read_info.error));
}
@@ -404,10 +438,12 @@ read_sep_field(THD *thd,COPY_INFO &info,TABLE *table,
List_iterator_fast<Item> it(fields);
Item_field *sql_field;
uint enclosed_length;
+ ulonglong id;
DBUG_ENTER("read_sep_field");
enclosed_length=enclosed.length();
-
+ id=0;
+
for (;;it.rewind())
{
if (thd->killed)
@@ -460,6 +496,14 @@ read_sep_field(THD *thd,COPY_INFO &info,TABLE *table,
}
if (write_record(table,&info))
DBUG_RETURN(1);
+ /*
+ If auto_increment values are used, save the first one
+ for LAST_INSERT_ID() and for the binary/update log.
+ We can't use insert_id() as we don't want to touch the
+ last_insert_id_used flag.
+ */
+ if (!id && thd->insert_id_used)
+ id= thd->last_insert_id;
if (table->next_number_field)
table->next_number_field->reset(); // Clear for next record
if (read_info.next_line()) // Skip to next line
@@ -467,6 +511,8 @@ read_sep_field(THD *thd,COPY_INFO &info,TABLE *table,
if (read_info.line_cuted)
thd->cuted_fields++; /* To long row */
}
+ if (id && !read_info.error)
+ thd->insert_id(id); // For binary/update log
DBUG_RETURN(test(read_info.error));
}
@@ -563,9 +609,11 @@ READ_INFO::READ_INFO(File file_par, uint tot_length, String &field_term,
cache.read_function = _my_b_net_read;
need_end_io_cache = 1;
+#ifndef EMBEDDED_LIBRARY
if (!opt_old_rpl_compat && mysql_bin_log.is_open())
cache.pre_read = cache.pre_close =
(IO_CACHE_CALLBACK) log_loaded_block;
+#endif
}
}
}
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 74c64232cec..0c9ad2d6935 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -74,7 +74,8 @@ const char *command_name[]={
"Drop DB", "Refresh", "Shutdown", "Statistics", "Processlist",
"Connect","Kill","Debug","Ping","Time","Delayed_insert","Change user",
"Binlog Dump","Table Dump", "Connect Out", "Register Slave",
- "Prepare", "Prepare Execute", "Long Data", "Close stmt"
+ "Prepare", "Prepare Execute", "Long Data", "Close stmt",
+ "Error" // Last command number
};
static char empty_c_string[1]= {0}; // Used for not defined 'db'
@@ -205,24 +206,31 @@ static int check_user(THD *thd,enum_server_command command, const char *user,
}
thd->master_access=acl_getroot(thd, thd->host, thd->ip, thd->user,
passwd, thd->scramble, &thd->priv_user,
- protocol_version == 9 ||
- !(thd->client_capabilities &
- CLIENT_LONG_PASSWORD),&ur,crypted_scramble,
- cur_priv_version,hint_user);
+ (protocol_version == 9 ||
+ !(thd->client_capabilities &
+ CLIENT_LONG_PASSWORD)),
+ &ur,crypted_scramble,
+ cur_priv_version,hint_user);
DBUG_PRINT("info",
- ("Capabilities: %d packet_length: %d Host: '%s' User: '%s' Using password: %s Access: %u db: '%s'",
+ ("Capabilities: %d packet_length: %ld Host: '%s' User: '%s' Using password: %s Access: %u db: '%s'",
thd->client_capabilities, thd->max_client_packet_length,
thd->host_or_ip, thd->priv_user,
had_password ? "yes": "no",
thd->master_access, thd->db ? thd->db : "*none*"));
- /* in case we're going to retry we should not send error message at this point */
+ /*
+ In case we're going to retry we should not send error message at this
+ point
+ */
if (thd->master_access & NO_ACCESS)
{
if (do_send_error)
{
- /* Old client should get nicer error message if password version is not supported*/
+ /*
+ Old client should get nicer error message if password version is
+ not supported
+ */
if (simple_connect && *hint_user && (*hint_user)->pversion)
{
net_printf(thd, ER_NOT_SUPPORTED_AUTH_MODE);
@@ -487,16 +495,20 @@ static void reset_mqh(THD *thd, LEX_USER *lu, bool get_them= 0)
Returns 0 on ok, -1 < if error is given > 0 on error.
*/
+#ifndef EMBEDDED_LIBRARY
static int
check_connections(THD *thd)
{
uint connect_errors=0;
NET *net= &thd->net;
- /* Store the connection details */
+ char *end, *user, *passwd, *db;
+ char prepared_scramble[SCRAMBLE41_LENGTH+4]; /* Buffer for scramble&hash */
+ ACL_USER* cached_user=NULL; /* Initialise to NULL for first stage */
+ uint cur_priv_version;
DBUG_PRINT("info", (("check_connections called by thread %d"),
- thd->thread_id));
+ thd->thread_id));
DBUG_PRINT("info",("New connection received on %s",
- vio_description(net->vio)));
+ vio_description(net->vio)));
if (!thd->host) // If TCP/IP connection
{
char ip[30];
@@ -516,6 +528,9 @@ check_connections(THD *thd)
{
vio_in_addr(net->vio,&thd->remote.sin_addr);
thd->host=ip_to_hostname(&thd->remote.sin_addr,&connect_errors);
+ /* Cut very long hostnames to avoid possible overflows */
+ if (thd->host)
+ thd->host[min(strlen(thd->host), HOSTNAME_LENGTH)]= 0;
if (connect_errors > max_connect_errors)
return(ER_HOST_IS_BLOCKED);
}
@@ -532,13 +547,13 @@ check_connections(THD *thd)
thd->ip=0;
bzero((char*) &thd->remote,sizeof(struct sockaddr));
}
+ /* Ensure that wrong hostnames doesn't cause buffer overflows */
vio_keepalive(net->vio, TRUE);
ulong pkt_len=0;
{
/* buff[] needs to big enough to hold the server_version variable */
- char buff[SERVER_VERSION_LENGTH +
- SCRAMBLE_LENGTH+64],*end;
+ char buff[SERVER_VERSION_LENGTH + SCRAMBLE_LENGTH+64];
int client_flags = CLIENT_LONG_FLAG | CLIENT_CONNECT_WITH_DB |
CLIENT_PROTOCOL_41 | CLIENT_SECURE_CONNECTION;
@@ -582,8 +597,20 @@ check_connections(THD *thd)
return(ER_OUT_OF_RESOURCES);
thd->client_capabilities=uint2korr(net->read_pos);
+ if (thd->client_capabilities & CLIENT_PROTOCOL_41)
+ {
+ thd->client_capabilities|= ((ulong) uint2korr(net->read_pos+2)) << 16;
+ thd->max_client_packet_length= uint4korr(net->read_pos+4);
+ end= (char*) net->read_pos+8;
+ }
+ else
+ {
+ thd->max_client_packet_length= uint3korr(net->read_pos+2);
+ end= (char*) net->read_pos+5;
+ }
+
if (thd->client_capabilities & CLIENT_IGNORE_SPACE)
- thd->sql_mode|= MODE_IGNORE_SPACE;
+ thd->variables.sql_mode|= MODE_IGNORE_SPACE;
#ifdef HAVE_OPENSSL
DBUG_PRINT("info", ("client capabilities: %d", thd->client_capabilities));
if (thd->client_capabilities & CLIENT_SSL)
@@ -607,21 +634,17 @@ check_connections(THD *thd)
return(ER_HANDSHAKE_ERROR);
}
}
- else
+#endif
+
+ if (end >= (char*) net->read_pos+ pkt_len +2)
{
- DBUG_PRINT("info", ("Leaving IO layer intact"));
- if (pkt_len < NORMAL_HANDSHAKE_SIZE)
- {
- inc_host_errors(&thd->remote.sin_addr);
- return ER_HANDSHAKE_ERROR;
- }
+ inc_host_errors(&thd->remote.sin_addr);
+ return(ER_HANDSHAKE_ERROR);
}
-#endif
- thd->max_client_packet_length=uint3korr(net->read_pos+2);
- char *user= (char*) net->read_pos+5;
- char *passwd= strend(user)+1;
- char *db=0;
+ user= end;
+ passwd= strend(user)+1;
+ db=0;
if (thd->client_capabilities & CLIENT_CONNECT_WITH_DB)
db=strend(passwd)+1;
@@ -633,14 +656,9 @@ check_connections(THD *thd)
thd->variables.net_wait_timeout= thd->variables.net_interactive_timeout;
if ((thd->client_capabilities & CLIENT_TRANSACTIONS) &&
opt_using_transactions)
- thd->net.return_status= &thd->server_status;
+ net->return_status= &thd->server_status;
net->read_timeout=(uint) thd->variables.net_read_timeout;
- char prepared_scramble[SCRAMBLE41_LENGTH+4]; /* Buffer for scramble and hash */
-
- ACL_USER* cached_user=NULL; /* Initialise to NULL as first stage indication */
- uint cur_priv_version;
-
/* Simple connect only for old clients. New clients always use secure auth */
bool simple_connect=(!(thd->client_capabilities & CLIENT_SECURE_CONNECTION));
@@ -651,15 +669,14 @@ check_connections(THD *thd)
simple_connect, prepared_scramble, using_password, &cur_priv_version,
&cached_user)<0)
{
- /* If The client is old we just have to return error */
- if (simple_connect)
- return -1;
-
/* Store current used and database as they are erased with next packet */
-
char tmp_user[USERNAME_LENGTH+1];
char tmp_db[NAME_LEN+1];
+ /* If The client is old we just have to return error */
+ if (simple_connect)
+ return -1;
+
tmp_user[0]=0;
if (user)
strmake(tmp_user,user,USERNAME_LENGTH);
@@ -676,17 +693,17 @@ check_connections(THD *thd)
return ER_HANDSHAKE_ERROR;
}
/* Reading packet back */
- if ((pkt_len=my_net_read(net)) == packet_error)
- {
- inc_host_errors(&thd->remote.sin_addr);
- return ER_HANDSHAKE_ERROR;
- }
+ if ((pkt_len= my_net_read(net)) == packet_error)
+ {
+ inc_host_errors(&thd->remote.sin_addr);
+ return ER_HANDSHAKE_ERROR;
+ }
/* We have to get very specific packet size */
- if (pkt_len!=SCRAMBLE41_LENGTH)
- {
- inc_host_errors(&thd->remote.sin_addr);
- return ER_HANDSHAKE_ERROR;
- }
+ if (pkt_len != SCRAMBLE41_LENGTH)
+ {
+ inc_host_errors(&thd->remote.sin_addr);
+ return ER_HANDSHAKE_ERROR;
+ }
/* Final attempt to check the user based on reply */
if (check_user(thd,COM_CONNECT, tmp_user, (char*)net->read_pos,
tmp_db, 1, 0, 1, prepared_scramble, using_password, &cur_priv_version,
@@ -697,7 +714,6 @@ check_connections(THD *thd)
return 0;
}
-
pthread_handler_decl(handle_one_connection,arg)
{
THD *thd=(THD*) arg;
@@ -763,7 +779,7 @@ pthread_handler_decl(handle_one_connection,arg)
goto end_thread;
}
- if ((ulong) thd->variables.max_join_size == (ulonglong) HA_POS_ERROR)
+ if (thd->variables.max_join_size == HA_POS_ERROR)
thd->options |= OPTION_BIG_SELECTS;
if (thd->client_capabilities & CLIENT_COMPRESS)
net->compress=1; // Use compression
@@ -839,7 +855,7 @@ extern "C" pthread_handler_decl(handle_bootstrap,arg)
#endif
- if ((ulong) thd->variables.max_join_size == (ulonglong) HA_POS_ERROR)
+ if (thd->variables.max_join_size == HA_POS_ERROR)
thd->options |= OPTION_BIG_SELECTS;
thd->proc_info=0;
@@ -888,6 +904,8 @@ end:
DBUG_RETURN(0); // Never reached
}
+#endif /* EMBEDDED_LIBRARY */
+
/* This works because items are allocated with sql_alloc() */
void free_items(Item *item)
@@ -933,7 +951,7 @@ int mysql_table_dump(THD* thd, char* db, char* tbl_name, int fd)
goto err;
}
net_flush(&thd->net);
- if ((error = table->file->dump(thd,fd)))
+ if ((error= table->file->dump(thd,fd)))
my_error(ER_GET_ERRNO, MYF(0));
err:
@@ -942,8 +960,9 @@ err:
}
- /* Execute one command from socket (query or simple command) */
+#ifndef EMBEDDED_LIBRARY
+ /* Execute one command from socket (query or simple command) */
bool do_command(THD *thd)
{
char *packet;
@@ -965,14 +984,22 @@ bool do_command(THD *thd)
net_new_transaction(net);
if ((packet_length=my_net_read(net)) == packet_error)
{
- DBUG_PRINT("info",("Got error reading command from socket %s",
- vio_description(net->vio) ));
- return TRUE;
+ DBUG_PRINT("info",("Got error %d reading command from socket %s",
+ net->error,
+ vio_description(net->vio)));
+ /* Check if we can continue without closing the connection */
+ if (net->error != 3)
+ DBUG_RETURN(TRUE); // We have to close it.
+ send_error(thd,net->last_errno,NullS);
+ net->error= 0;
+ DBUG_RETURN(FALSE);
}
else
{
packet=(char*) net->read_pos;
command = (enum enum_server_command) (uchar) packet[0];
+ if (command >= COM_END)
+ command= COM_END; // Wrong command
DBUG_PRINT("info",("Command on %s = %d (%s)",
vio_description(net->vio), command,
command_name[command]));
@@ -981,6 +1008,7 @@ bool do_command(THD *thd)
DBUG_RETURN(dispatch_command(command,thd, packet+1, (uint) packet_length));
}
+#endif /* EMBEDDED_LIBRARY */
bool dispatch_command(enum enum_server_command command, THD *thd,
char* packet, uint packet_length)
@@ -1010,12 +1038,14 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
if (!mysql_change_db(thd,packet))
mysql_log.write(thd,command,"%s",thd->db);
break;
+#ifndef EMBEDDED_LIBRARY
case COM_REGISTER_SLAVE:
{
if (!register_slave(thd, (uchar*)packet, packet_length))
send_ok(thd);
break;
}
+#endif
case COM_TABLE_DUMP:
{
statistic_increment(com_other, &LOCK_status);
@@ -1030,9 +1060,9 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
tbl_name[tbl_len] = 0;
if (mysql_table_dump(thd, db, tbl_name, -1))
send_error(thd); // dump to NET
-
break;
}
+#ifndef EMBEDDED_LIBRARY
case COM_CHANGE_USER:
{
thd->change_user();
@@ -1054,7 +1084,11 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
USER_CONN *save_uc= thd->user_connect;
bool simple_connect;
bool using_password;
-
+ char prepared_scramble[SCRAMBLE41_LENGTH+4];/* Buffer for scramble,hash */
+ char tmp_user[USERNAME_LENGTH+1];
+ char tmp_db[NAME_LEN+1];
+ ACL_USER* cached_user ; /* Cached user */
+ uint cur_priv_version; /* Cached grant version */
ulong pkt_len=0; /* Length of reply packet */
/* Small check for incomming packet */
@@ -1068,10 +1102,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
if (passwd[0] && strlen(passwd)!=SCRAMBLE_LENGTH)
goto restore_user_err;
- char prepared_scramble[SCRAMBLE41_LENGTH+4];/* Buffer for scramble,hash */
- ACL_USER* cached_user ; /* Cached user */
cached_user= NULL;
- uint cur_priv_version; /* Cached grant version */
/* Simple connect only for old clients. New clients always use sec. auth*/
simple_connect=(!(thd->client_capabilities & CLIENT_SECURE_CONNECTION));
@@ -1083,8 +1114,8 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
memcpy(thd->scramble,thd->old_scramble,9);
/*
- Check user permissions. If password failure we'll get scramble back
- Do not retry if we already have sent error (result>0)
+ Check user permissions. If password failure we'll get scramble back
+ Do not retry if we already have sent error (result>0)
*/
if (check_user(thd,COM_CHANGE_USER, user, passwd, db, 0, simple_connect,
simple_connect, prepared_scramble, using_password, &cur_priv_version,
@@ -1095,10 +1126,6 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
goto restore_user; /* Error is already reported */
/* Store current used and database as they are erased with next packet */
-
- char tmp_user[USERNAME_LENGTH+1];
- char tmp_db[NAME_LEN+1];
-
tmp_user[0]=0;
if (user)
strmake(tmp_user,user,USERNAME_LENGTH);
@@ -1122,8 +1149,9 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
goto restore_user;
/* Final attempt to check the user based on reply */
- if (check_user(thd,COM_CHANGE_USER, tmp_user, (char*)net->read_pos,
- tmp_db, 0, 0, 1, prepared_scramble, using_password, &cur_priv_version,
+ if (check_user(thd,COM_CHANGE_USER, tmp_user, (char*) net->read_pos,
+ tmp_db, 0, 0, 1, prepared_scramble, using_password,
+ &cur_priv_version,
&cached_user))
goto restore_user;
}
@@ -1150,7 +1178,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
thd->priv_user=save_priv_user;
break;
}
-
+#endif /* EMBEDDED_LIBRARY */
case COM_EXECUTE:
{
mysql_stmt_execute(thd, packet);
@@ -1176,8 +1204,31 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
if (alloc_query(thd, packet, packet_length))
break; // fatal error is set
mysql_log.write(thd,command,"%s",thd->query);
- DBUG_PRINT("query",("%s",thd->query));
+ DBUG_PRINT("query",("%-.4096s",thd->query));
mysql_parse(thd,thd->query, thd->query_length);
+
+ while (!thd->fatal_error && thd->lex.found_colon)
+ {
+ /*
+ Multiple queries exits, execute them individually
+ */
+ if (thd->lock || thd->open_tables || thd->derived_tables)
+ close_thread_tables(thd);
+
+ uint length= thd->query_length-(uint)(thd->lex.found_colon-thd->query);
+
+ /* Remove garbage at start of query */
+ char *packet= thd->lex.found_colon;
+ while (my_isspace(system_charset_info,packet[0]) && length > 0)
+ {
+ packet++;
+ length--;
+ }
+ thd->query= packet;
+ thd->query_length= length;
+ mysql_parse(thd, packet, length);
+ }
+
if (!(specialflag & SPECIAL_NO_PRIOR))
my_pthread_setprio(pthread_self(),WAIT_PRIOR);
DBUG_PRINT("info",("query ready"));
@@ -1254,6 +1305,8 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
}
if (lower_case_table_names)
my_casedn_str(files_charset_info, db);
+ if (check_access(thd,DROP_ACL,db,0,1))
+ break;
if (thd->locked_tables || thd->active_transaction())
{
send_error(thd,ER_LOCK_OR_ACTIVE_TRANSACTION);
@@ -1263,6 +1316,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
mysql_rm_db(thd,db,0,0);
break;
}
+#ifndef EMBEDDED_LIBRARY
case COM_BINLOG_DUMP:
{
statistic_increment(com_other,&LOCK_status);
@@ -1287,6 +1341,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
net->error = 0;
break;
}
+#endif
case COM_REFRESH:
{
statistic_increment(com_stat[SQLCOM_FLUSH],&LOCK_status);
@@ -1294,12 +1349,11 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
if (check_global_access(thd,RELOAD_ACL))
break;
mysql_log.write(thd,command,NullS);
- if (reload_acl_and_cache(thd, options, (TABLE_LIST*) 0))
- send_error(thd,0);
- else
- send_eof(thd);
+ /* error sending is deferred to reload_acl_and_cache */
+ reload_acl_and_cache(thd, options, (TABLE_LIST*) 0) ;
break;
}
+#ifndef EMBEDDED_LIBRARY
case COM_SHUTDOWN:
statistic_increment(com_other,&LOCK_status);
if (check_global_access(thd,SHUTDOWN_ACL))
@@ -1320,7 +1374,8 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
kill_mysql();
error=TRUE;
break;
-
+#endif
+#ifndef EMBEDDED_LIBRARY
case COM_STATISTICS:
{
mysql_log.write(thd,command,NullS);
@@ -1342,6 +1397,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
VOID(net_flush(net));
break;
}
+#endif
case COM_PING:
statistic_increment(com_other,&LOCK_status);
send_ok(thd); // Tell client we are alive
@@ -1373,11 +1429,12 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
case COM_CONNECT: // Impossible here
case COM_TIME: // Impossible from client
case COM_DELAYED_INSERT:
+ case COM_END:
default:
send_error(thd, ER_UNKNOWN_COM_ERROR);
break;
}
- if (thd->lock || thd->open_tables)
+ if (thd->lock || thd->open_tables || thd->derived_tables)
{
thd->proc_info="closing tables";
close_thread_tables(thd); /* Free tables */
@@ -1434,7 +1491,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
bool alloc_query(THD *thd, char *packet, ulong packet_length)
{
packet_length--; // Remove end null
- /* Remove garage at start and end of query */
+ /* Remove garbage at start and end of query */
while (my_isspace(system_charset_info,packet[0]) && packet_length > 0)
{
packet++;
@@ -1490,6 +1547,7 @@ mysql_execute_command(THD *thd)
*/
thd->old_total_warn_count= thd->total_warn_count;
+#ifndef EMBEDDED_LIBRARY
if (thd->slave_thread)
{
/*
@@ -1511,7 +1569,7 @@ mysql_execute_command(THD *thd)
}
#endif
}
-
+#endif /* EMBEDDED_LIBRARY */
/*
TODO: make derived tables processing 'inside' SELECT processing.
TODO: solve problem with depended derived tables in subselects
@@ -1521,9 +1579,11 @@ mysql_execute_command(THD *thd)
for (SELECT_LEX *sl= lex->all_selects_list;
sl;
sl= sl->next_select_in_list())
+ {
for (TABLE_LIST *cursor= sl->get_table_list();
cursor;
cursor= cursor->next)
+ {
if (cursor->derived && (res=mysql_derived(thd, lex,
(SELECT_LEX_UNIT *)
cursor->derived,
@@ -1533,11 +1593,17 @@ mysql_execute_command(THD *thd)
send_error(thd,thd->killed ? ER_SERVER_SHUTDOWN : 0);
DBUG_VOID_RETURN;
}
+ }
+ }
}
if ((&lex->select_lex != lex->all_selects_list &&
- lex->unit.create_total_list(thd, lex, &tables)) ||
+ lex->unit.create_total_list(thd, lex, &tables))
+#ifndef EMBEDDED_LIBRARY
+ ||
(table_rules_on && tables && thd->slave_thread &&
- !tables_ok(thd,tables)))
+ !tables_ok(thd,tables))
+#endif
+ )
DBUG_VOID_RETURN;
statistic_increment(com_stat[lex->sql_command],&LOCK_status);
@@ -1627,6 +1693,7 @@ mysql_execute_command(THD *thd)
res= mysqld_help(thd,lex->help_arg);
break;
+#ifndef EMBEDDED_LIBRARY
case SQLCOM_PURGE:
{
if (check_global_access(thd, SUPER_ACL))
@@ -1634,11 +1701,15 @@ mysql_execute_command(THD *thd)
res = purge_master_logs(thd, lex->to_log);
break;
}
+#endif
+
case SQLCOM_SHOW_WARNS:
{
res= mysqld_show_warnings(thd, (ulong)
((1L << (uint) MYSQL_ERROR::WARN_LEVEL_NOTE) |
- (1L << (uint) MYSQL_ERROR::WARN_LEVEL_WARN)));
+ (1L << (uint) MYSQL_ERROR::WARN_LEVEL_WARN) |
+ (1L << (uint) MYSQL_ERROR::WARN_LEVEL_ERROR)
+ ));
break;
}
case SQLCOM_SHOW_ERRORS:
@@ -1659,6 +1730,8 @@ mysql_execute_command(THD *thd)
#endif
break;
}
+
+#ifndef EMBEDDED_LIBRARY
case SQLCOM_SHOW_SLAVE_HOSTS:
{
if (check_global_access(thd, REPL_SLAVE_ACL))
@@ -1673,6 +1746,8 @@ mysql_execute_command(THD *thd)
res = show_binlog_events(thd);
break;
}
+#endif
+
case SQLCOM_BACKUP_TABLE:
{
if (check_db_used(thd,tables) ||
@@ -1692,6 +1767,8 @@ mysql_execute_command(THD *thd)
res = mysql_restore_table(thd, tables);
break;
}
+
+#ifndef EMBEDDED_LIBRARY
case SQLCOM_CHANGE_MASTER:
{
if (check_global_access(thd, SUPER_ACL))
@@ -1726,6 +1803,7 @@ mysql_execute_command(THD *thd)
else
res = load_master_data(thd);
break;
+#endif /* EMBEDDED_LIBRARY */
#ifdef HAVE_INNOBASE_DB
case SQLCOM_SHOW_INNODB_STATUS:
@@ -1737,6 +1815,7 @@ mysql_execute_command(THD *thd)
}
#endif
+#ifndef EMBEDDED_LIBRARY
case SQLCOM_LOAD_MASTER_TABLE:
{
if (!tables->db)
@@ -1768,6 +1847,8 @@ mysql_execute_command(THD *thd)
UNLOCK_ACTIVE_MI;
break;
}
+#endif /* EMBEDDED_LIBRARY */
+
case SQLCOM_CREATE_TABLE:
{
ulong want_priv= ((lex->create_info.options & HA_LEX_CREATE_TMP_TABLE) ?
@@ -1872,6 +1953,7 @@ mysql_execute_command(THD *thd)
res = mysql_create_index(thd, tables, lex->key_list);
break;
+#ifndef EMBEDDED_LIBRARY
case SQLCOM_SLAVE_START:
{
LOCK_ACTIVE_MI;
@@ -1880,12 +1962,32 @@ mysql_execute_command(THD *thd)
break;
}
case SQLCOM_SLAVE_STOP:
+ /*
+ If the client thread has locked tables, a deadlock is possible.
+ Assume that
+ - the client thread does LOCK TABLE t READ.
+ - then the master updates t.
+ - then the SQL slave thread wants to update t,
+ so it waits for the client thread because t is locked by it.
+ - then the client thread does SLAVE STOP.
+ SLAVE STOP waits for the SQL slave thread to terminate its
+ update t, which waits for the client thread because t is locked by it.
+ To prevent that, refuse SLAVE STOP if the
+ client thread has locked tables
+ */
+ if (thd->locked_tables || thd->active_transaction())
+ {
+ send_error(thd,ER_LOCK_OR_ACTIVE_TRANSACTION);
+ break;
+ }
{
LOCK_ACTIVE_MI;
stop_slave(thd,active_mi,1/* net report*/);
UNLOCK_ACTIVE_MI;
break;
}
+#endif
+
case SQLCOM_ALTER_TABLE:
#if defined(DONT_ALLOW_SHOW_COMMANDS)
send_error(thd,ER_NOT_ALLOWED_COMMAND); /* purecov: inspected */
@@ -1976,6 +2078,7 @@ mysql_execute_command(THD *thd)
res= -1;
break;
}
+#ifndef EMBEDDED_LIBRARY
case SQLCOM_SHOW_BINLOGS:
#ifdef DONT_ALLOW_SHOW_COMMANDS
send_error(thd,ER_NOT_ALLOWED_COMMAND); /* purecov: inspected */
@@ -1988,6 +2091,7 @@ mysql_execute_command(THD *thd)
break;
}
#endif
+#endif /* EMBEDDED_LIBRARY */
case SQLCOM_SHOW_CREATE:
#ifdef DONT_ALLOW_SHOW_COMMANDS
send_error(thd,ER_NOT_ALLOWED_COMMAND); /* purecov: inspected */
@@ -2254,6 +2358,7 @@ mysql_execute_command(THD *thd)
for (auxi=(TABLE_LIST*) aux_tables ; auxi ; auxi=auxi->next)
auxi->table= auxi->table_list->table;
if (&lex->select_lex != lex->all_selects_list)
+ {
for (TABLE_LIST *t= select_lex->get_table_list();
t; t= t->next)
{
@@ -2264,6 +2369,7 @@ mysql_execute_command(THD *thd)
break;
}
}
+ }
fix_tables_pointers(lex->all_selects_list);
if (!thd->fatal_error && (result= new multi_delete(thd,aux_tables,
table_count)))
@@ -2287,12 +2393,17 @@ mysql_execute_command(THD *thd)
}
case SQLCOM_DROP_TABLE:
{
- if (check_table_access(thd,DROP_ACL,tables))
- goto error; /* purecov: inspected */
- if (end_active_trans(thd))
- res= -1;
- else
- res = mysql_rm_table(thd,tables,lex->drop_if_exists);
+ if (!lex->drop_temporary)
+ {
+ if (check_table_access(thd,DROP_ACL,tables))
+ goto error; /* purecov: inspected */
+ if (end_active_trans(thd))
+ {
+ res= -1;
+ break;
+ }
+ }
+ res= mysql_rm_table(thd,tables,lex->drop_if_exists, lex->drop_temporary);
}
break;
case SQLCOM_DROP_INDEX:
@@ -2443,6 +2554,7 @@ mysql_execute_command(THD *thd)
case SQLCOM_CHANGE_DB:
mysql_change_db(thd,select_lex->db);
break;
+#ifndef EMBEDDED_LIBRARY
case SQLCOM_LOAD:
{
uint privilege= (lex->duplicates == DUP_REPLACE ?
@@ -2469,6 +2581,7 @@ mysql_execute_command(THD *thd)
lex->duplicates, (bool) lex->local_file, lex->lock_option);
break;
}
+#endif /* EMBEDDED_LIBRARY */
case SQLCOM_SET_OPTION:
if (tables && ((res= check_table_access(thd, SELECT_ACL, tables)) ||
(res= open_and_lock_tables(thd,tables))))
@@ -2680,10 +2793,8 @@ mysql_execute_command(THD *thd)
case SQLCOM_RESET:
if (check_global_access(thd,RELOAD_ACL) || check_db_used(thd, tables))
goto error;
- if (reload_acl_and_cache(thd, lex->type, tables))
- send_error(thd,0);
- else
- send_ok(thd);
+ /* error sending is deferred to reload_acl_and_cache */
+ reload_acl_and_cache(thd, lex->type, tables) ;
break;
case SQLCOM_KILL:
kill_one_thread(thd,lex->thread_id);
@@ -3031,6 +3142,7 @@ mysql_init_query(THD *thd)
lex->olap=lex->describe=0;
lex->derived_tables= false;
lex->lock_option=TL_READ;
+ lex->found_colon=0;
thd->check_loops_counter= thd->select_number=
lex->select_lex.select_number= 1;
thd->free_list= 0;
@@ -3039,6 +3151,7 @@ mysql_init_query(THD *thd)
thd->sent_row_count= thd->examined_row_count= 0;
thd->fatal_error= thd->rand_used= 0;
thd->possible_loops= 0;
+ thd->server_status &= ~SERVER_MORE_RESULTS_EXISTS;
DBUG_VOID_RETURN;
}
@@ -3156,7 +3269,9 @@ mysql_parse(THD *thd, char *inBuf, uint length)
else
{
mysql_execute_command(thd);
+#ifndef EMBEDDED_LIBRARY /* TODO query cache in embedded library*/
query_cache_end_of_result(&thd->net);
+#endif
}
}
}
@@ -3164,7 +3279,9 @@ mysql_parse(THD *thd, char *inBuf, uint length)
{
DBUG_PRINT("info",("Command aborted. Fatal_error: %d",
thd->fatal_error));
+#ifndef EMBEDDED_LIBRARY /* TODO query cache in embedded library*/
query_cache_abort(&thd->net);
+#endif
}
thd->proc_info="freeing items";
free_items(thd->free_list); /* Free strings used by items */
@@ -3281,7 +3398,6 @@ bool add_field_to_list(THD *thd, char *field_name, enum_field_types type,
allowed_type_modifier= AUTO_INCREMENT_FLAG;
break;
case FIELD_TYPE_NULL:
- case FIELD_TYPE_GEOMETRY:
break;
case FIELD_TYPE_DECIMAL:
if (!length)
@@ -3305,6 +3421,7 @@ bool add_field_to_list(THD *thd, char *field_name, enum_field_types type,
case FIELD_TYPE_TINY_BLOB:
case FIELD_TYPE_LONG_BLOB:
case FIELD_TYPE_MEDIUM_BLOB:
+ case FIELD_TYPE_GEOMETRY:
if (new_field->length)
{
/* The user has given a length to the blob column */
@@ -3415,10 +3532,14 @@ bool add_field_to_list(THD *thd, char *field_name, enum_field_types type,
set_if_smaller(new_field->length,MAX_FIELD_WIDTH-1);
if (default_value)
{
+ char *not_used;
+ uint not_used2;
+
thd->cuted_fields=0;
String str,*res;
res=default_value->val_str(&str);
- (void) find_set(interval,res->ptr(),res->length());
+ (void) find_set(interval, res->ptr(), res->length(), &not_used,
+ &not_used2);
if (thd->cuted_fields)
{
net_printf(thd,ER_INVALID_DEFAULT,field_name);
@@ -3454,7 +3575,8 @@ bool add_field_to_list(THD *thd, char *field_name, enum_field_types type,
if (new_field->length >= MAX_FIELD_WIDTH ||
(!new_field->length && !(new_field->flags & BLOB_FLAG) &&
- type != FIELD_TYPE_STRING && type != FIELD_TYPE_VAR_STRING))
+ type != FIELD_TYPE_STRING &&
+ type != FIELD_TYPE_VAR_STRING && type != FIELD_TYPE_GEOMETRY))
{
net_printf(thd,ER_TOO_BIG_FIELDLENGTH,field_name,
MAX_FIELD_WIDTH-1); /* purecov: inspected */
@@ -3555,11 +3677,30 @@ bool add_to_list(THD *thd, SQL_LIST &list,Item *item,bool asc)
}
+/*
+ Add a table to list of used tables
+
+ SYNOPSIS
+ add_table_to_list()
+ table Table to add
+ alias alias for table (or null if no alias)
+ table_options A set of the following bits:
+ TL_OPTION_UPDATING Table will be updated
+ TL_OPTION_FORCE_INDEX Force usage of index
+ lock_type How table should be locked
+ use_index List of indexed used in USE INDEX
+ ignore_index List of indexed used in IGNORE INDEX
+
+ RETURN
+ 0 Error
+ # Pointer to TABLE_LIST element added to the total table list
+*/
+
TABLE_LIST *st_select_lex::add_table_to_list(THD *thd,
Table_ident *table,
LEX_STRING *alias,
- bool updating,
- thr_lock_type flags,
+ ulong table_options,
+ thr_lock_type lock_type,
List<String> *use_index,
List<String> *ignore_index)
{
@@ -3616,8 +3757,9 @@ TABLE_LIST *st_select_lex::add_table_to_list(THD *thd,
}
ptr->real_name=table->table.str;
ptr->real_name_length=table->table.length;
- ptr->lock_type=flags;
- ptr->updating=updating;
+ ptr->lock_type= lock_type;
+ ptr->updating= test(table_options & TL_OPTION_UPDATING);
+ ptr->force_index= test(table_options & TL_OPTION_FORCE_INDEX);
ptr->derived= (SELECT_LEX_UNIT *) table->sel;
if (use_index)
ptr->use_index=(List<String> *) thd->memdup((gptr) use_index,
@@ -3627,7 +3769,7 @@ TABLE_LIST *st_select_lex::add_table_to_list(THD *thd,
sizeof(*ignore_index));
/* check that used name is unique */
- if (flags != TL_IGNORE)
+ if (lock_type != TL_IGNORE)
{
for (TABLE_LIST *tables=(TABLE_LIST*) table_list.first ;
tables ;
@@ -3697,10 +3839,15 @@ void add_join_natural(TABLE_LIST *a,TABLE_LIST *b)
b->natural_join=a;
}
+
+/*
+ Reload/resets privileges and the different caches
+*/
+
bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables)
{
bool result=0;
-
+ bool error_already_sent=0;
select_errors=0; /* Write if more errors */
if (options & REFRESH_GRANT)
{
@@ -3744,9 +3891,11 @@ bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables)
refresh_status();
if (options & REFRESH_THREADS)
flush_thread_cache();
+#ifndef EMBEDDED_LIBRARY
if (options & REFRESH_MASTER)
if (reset_master(thd))
result=1;
+#endif
#ifdef OPENSSL
if (options & REFRESH_DES_KEY_FILE)
{
@@ -3754,15 +3903,35 @@ bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables)
result=load_des_key_file(des_key_file);
}
#endif
+#ifndef EMBEDDED_LIBRARY
if (options & REFRESH_SLAVE)
{
LOCK_ACTIVE_MI;
if (reset_slave(thd, active_mi))
+ {
result=1;
+ /*
+ reset_slave() sends error itself.
+ If it didn't, one would either change reset_slave()'s prototype, to
+ pass *errorcode and *errmsg to it when it's called or
+ change reset_slave to use my_error() to register the error.
+ */
+ error_already_sent=1;
+ }
UNLOCK_ACTIVE_MI;
}
+#endif
if (options & REFRESH_USER_RESOURCES)
reset_mqh(thd,(LEX_USER *) NULL);
+
+ if (thd && !error_already_sent)
+ {
+ if (result)
+ send_error(thd,0);
+ else
+ send_ok(thd);
+ }
+
return result;
}
diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc
index 93004ce2937..0e1cdbe824f 100644
--- a/sql/sql_prepare.cc
+++ b/sql/sql_prepare.cc
@@ -30,7 +30,11 @@ Prepare:
- Without executing the query, return back to client the total
number of parameters along with result-set metadata information
(if any) in the following format:
- [STMT_ID:4][Columns:2][Param_count:2][Columns meta info][Params meta info]
+ [STMT_ID:4]
+ [Column_count:2]
+ [Param_count:2]
+ [Columns meta info] (if Column_count > 0)
+ [Params meta info] (if Param_count > 0 ) (TODO : 4.1.1)
Prepare-execute:
@@ -66,6 +70,7 @@ Long data handling:
#include "mysql_priv.h"
#include "sql_acl.h"
+#include "sql_select.h" // for JOIN
#include <assert.h> // for DEBUG_ASSERT()
#include <m_ctype.h> // for isspace()
@@ -140,7 +145,13 @@ static bool send_prep_stmt(PREP_STMT *stmt, uint columns)
int4store(buff, stmt->stmt_id);
int2store(buff+4, columns);
int2store(buff+6, stmt->param_count);
+#ifndef EMBEDDED_LIBRARY
+ /* This should be fixed to work with prepared statements
+ */
return (my_net_write(net, buff, sizeof(buff)) || net_flush(net));
+#else
+ return true;
+#endif
}
/*
@@ -299,7 +310,11 @@ static bool setup_params_data(PREP_STMT *stmt)
Item_param *param;
DBUG_ENTER("setup_params_data");
+#ifndef EMBEDDED_LIBRARY
uchar *pos=(uchar*) thd->net.read_pos+1+MYSQL_STMT_HEADER; //skip header
+#else
+ uchar *pos= 0; //just to compile TODO code for embedded case
+#endif
uchar *read_pos= pos+(stmt->param_count+7) / 8; //skip null bits
if (*read_pos++) //types supplied / first execute
@@ -321,9 +336,12 @@ static bool setup_params_data(PREP_STMT *stmt)
if (!param->long_data_supplied)
{
if (IS_PARAM_NULL(pos,param_no))
- param->maybe_null=param->null_value=1;
+ param->maybe_null= param->null_value= 1;
else
+ {
+ param->maybe_null= param->null_value= 0;
param->setup_param_func(param,&read_pos);
+ }
}
param_no++;
}
@@ -331,53 +349,6 @@ static bool setup_params_data(PREP_STMT *stmt)
}
/*
- Validates insert fields
-*/
-
-static int check_prepare_fields(THD *thd,TABLE *table, List<Item> &fields,
- List<Item> &values, ulong counter)
-{
- if (fields.elements == 0 && values.elements != 0)
- {
- if (values.elements != table->fields)
- {
- my_printf_error(ER_WRONG_VALUE_COUNT_ON_ROW,
- ER(ER_WRONG_VALUE_COUNT_ON_ROW),
- MYF(0),counter);
- return -1;
- }
- }
- else
- {
- if (fields.elements != values.elements)
- {
- my_printf_error(ER_WRONG_VALUE_COUNT_ON_ROW,
- ER(ER_WRONG_VALUE_COUNT_ON_ROW),
- MYF(0),counter);
- return -1;
- }
- TABLE_LIST table_list;
- bzero((char*) &table_list,sizeof(table_list));
- table_list.db= table->table_cache_key;
- table_list.real_name= table_list.alias= table->table_name;
- table_list.table= table;
- table_list.grant= table->grant;
-
- thd->dupp_field=0;
- if (setup_tables(&table_list) ||
- setup_fields(thd,&table_list,fields,1,0,0))
- return -1;
- if (thd->dupp_field)
- {
- my_error(ER_FIELD_SPECIFIED_TWICE,MYF(0), thd->dupp_field->field_name);
- return -1;
- }
- }
- return 0;
-}
-
-
-/*
Validate the following information for INSERT statement:
- field existance
- fields count
@@ -446,7 +417,7 @@ static bool mysql_test_upd_fields(PREP_STMT *stmt, TABLE_LIST *table_list,
DBUG_RETURN(1);
if (setup_tables(table_list) || setup_fields(thd,table_list,fields,1,0,0) ||
- setup_conds(thd,table_list,&conds))
+ setup_conds(thd,table_list,&conds) || thd->net.report_error)
DBUG_RETURN(1);
/*
@@ -470,39 +441,41 @@ static bool mysql_test_upd_fields(PREP_STMT *stmt, TABLE_LIST *table_list,
And send column list fields info back to client.
*/
-
static bool mysql_test_select_fields(PREP_STMT *stmt, TABLE_LIST *tables,
- List<Item> &fields, List<Item> &values,
- COND *conds, ORDER *order, ORDER *group,
- Item *having)
+ List<Item> &fields, COND *conds,
+ ORDER *order, ORDER *group,
+ Item *having, ORDER *proc,
+ ulong select_options,
+ SELECT_LEX_UNIT *unit,
+ SELECT_LEX *select_lex)
{
- bool hidden_group_fields;
THD *thd= stmt->thd;
- List<Item> all_fields(fields);
+ LEX *lex= &thd->lex;
+ select_result *result= thd->lex.result;
DBUG_ENTER("mysql_test_select_fields");
+ if ((&lex->select_lex != lex->all_selects_list &&
+ lex->unit.create_total_list(thd, lex, &tables)))
+ DBUG_RETURN(1);
+
if (open_and_lock_tables(thd, tables))
DBUG_RETURN(1);
- thd->used_tables=0; // Updated by setup_fields
- if (setup_tables(tables) ||
- setup_fields(thd,tables,fields,1,&all_fields,1) ||
- setup_conds(thd,tables,&conds) ||
- setup_order(thd,tables,fields,all_fields,order) ||
- setup_group(thd,tables,fields,all_fields,group,&hidden_group_fields))
- DBUG_RETURN(1);
+ fix_tables_pointers(thd->lex.all_selects_list);
- if (having)
+ if (!result && !(result= new select_send()))
{
- thd->where="having clause";
- thd->allow_sum_func=1;
- if (having->check_cols(1) || having->fix_fields(thd, tables, &having)
- || thd->fatal_error)
- DBUG_RETURN(1);
- if (having->with_sum_func)
- having->split_sum_func(all_fields);
+ delete select_lex->having;
+ delete select_lex->where;
+ send_error(thd, ER_OUT_OF_RESOURCES);
+ DBUG_RETURN(1);
}
- if (setup_ftfuncs(&thd->lex.select_lex))
+
+ JOIN *join= new JOIN(thd, fields, select_options, result);
+ thd->used_tables= 0; // Updated by setup_fields
+
+ if (join->prepare(tables, conds, order, group, having, proc,
+ select_lex, unit, 0))
DBUG_RETURN(1);
/*
@@ -510,28 +483,15 @@ static bool mysql_test_select_fields(PREP_STMT *stmt, TABLE_LIST *tables,
sending any info on where clause.
*/
if (send_prep_stmt(stmt, fields.elements) ||
- thd->protocol_simple.send_fields(&fields,0) ||
+ thd->protocol_simple.send_fields(&fields, 0) ||
send_item_params(stmt))
DBUG_RETURN(1);
+ join->cleanup(thd);
DBUG_RETURN(0);
}
/*
- Check the access privileges
-*/
-
-static bool check_prepare_access(THD *thd, TABLE_LIST *tables,
- uint type)
-{
- if (check_access(thd,type,tables->db,&tables->grant.privilege))
- return 1;
- if (grant_option && check_grant(thd,type,tables))
- return 1;
- return 0;
-}
-
-/*
Send the prepare query results back to client
*/
@@ -573,10 +533,15 @@ static bool send_prepare_results(PREP_STMT *stmt)
break;
case SQLCOM_SELECT:
- if (mysql_test_select_fields(stmt, tables, select_lex->item_list,
- lex->value_list, select_lex->where,
- (ORDER*) select_lex->order_list.first,
- (ORDER*) select_lex->group_list.first, select_lex->having))
+ if (mysql_test_select_fields(stmt, tables,
+ select_lex->item_list,
+ select_lex->where,
+ (ORDER*) select_lex->order_list.first,
+ (ORDER*) select_lex->group_list.first,
+ select_lex->having,
+ (ORDER*)lex->proc_list.first,
+ select_lex->options | thd->options,
+ &(lex->unit), select_lex))
goto abort;
break;
@@ -625,7 +590,7 @@ static bool parse_prepare_query(PREP_STMT *stmt,
Initialize parameter items in statement
*/
-static bool init_param_items( PREP_STMT *stmt)
+static bool init_param_items(PREP_STMT *stmt)
{
List<Item> &params= stmt->thd->lex.param_list;
Item_param **to;
@@ -640,6 +605,24 @@ static bool init_param_items( PREP_STMT *stmt)
}
/*
+ Initialize stmt execution
+*/
+
+static void init_stmt_execute(PREP_STMT *stmt)
+{
+ THD *thd= stmt->thd;
+ TABLE_LIST *tables=(TABLE_LIST*) thd->lex.select_lex.table_list.first;
+
+ /*
+ TODO: When the new table structure is ready, then have a status bit
+ to indicate the table is altered, and re-do the setup_*
+ and open the tables back.
+ */
+ if (tables)
+ tables->table=0; //safety - nasty init
+}
+
+/*
Parse the query and send the total number of parameters
and resultset metadata information back to client (if any),
without executing the query i.e. with out any log/disk
@@ -719,6 +702,12 @@ void mysql_stmt_execute(THD *thd, char *packet)
DBUG_VOID_RETURN;
}
+ if (my_pthread_setspecific_ptr(THR_THD, stmt->thd) ||
+ my_pthread_setspecific_ptr(THR_MALLOC, &stmt->thd->mem_root))
+ DBUG_VOID_RETURN;
+
+ init_stmt_execute(stmt);
+
if (stmt->param_count && setup_params_data(stmt))
DBUG_VOID_RETURN;
@@ -731,13 +720,17 @@ void mysql_stmt_execute(THD *thd, char *packet)
mysql_delete(), mysql_update() and mysql_select() to not to
have re-check on setup_* and other things ..
*/
- stmt->thd->protocol= &thd->protocol_prep; // Switch to binary protocol
- mysql_execute_command(stmt->thd);
- stmt->thd->protocol= &thd->protocol_simple; // Use normal protocol
+ THD *cur_thd= stmt->thd;
+ cur_thd->protocol= &cur_thd->protocol_prep; // Switch to binary protocol
+ mysql_execute_command(cur_thd);
+ cur_thd->protocol= &cur_thd->protocol_simple; // Use normal protocol
if (!(specialflag & SPECIAL_NO_PRIOR))
my_pthread_setprio(pthread_self(), WAIT_PRIOR);
-
+
+ my_pthread_setspecific_ptr(THR_THD, thd);
+ my_pthread_setspecific_ptr(THR_MALLOC, &thd->mem_root);
+
DBUG_VOID_RETURN;
}
diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc
index 375a7478377..a4a1cbd4ad6 100644
--- a/sql/sql_repl.cc
+++ b/sql/sql_repl.cc
@@ -17,6 +17,8 @@
// Sasha Pachev <sasha@mysql.com> is currently in charge of this file
#include "mysql_priv.h"
+#ifdef HAVE_REPLICATION
+
#include "sql_repl.h"
#include "sql_acl.h"
#include "log_event.h"
@@ -696,20 +698,48 @@ int stop_slave(THD* thd, MASTER_INFO* mi, bool net_report )
return 0;
}
+
+/*
+ Remove all relay logs and start replication from the start
+
+ SYNOPSIS
+ reset_slave()
+ thd Thread handler
+ mi Master info for the slave
+
+
+ NOTES
+ We don't send ok in this functions as this is called from
+ reload_acl_and_cache() which may have done other tasks, which may
+ have failed for which we want to send and error.
+
+ RETURN
+ 0 ok
+ 1 error
+ In this case error is sent to the client with send_error()
+*/
+
+
int reset_slave(THD *thd, MASTER_INFO* mi)
{
MY_STAT stat_area;
char fname[FN_REFLEN];
- int restart_thread_mask = 0,error=0;
+ int thread_mask= 0, error= 0;
+ uint sql_errno=0;
const char* errmsg=0;
DBUG_ENTER("reset_slave");
lock_slave_threads(mi);
- init_thread_mask(&restart_thread_mask,mi,0 /* not inverse */);
- if ((error=terminate_slave_threads(mi,restart_thread_mask,1 /*skip lock*/))
- || (error=purge_relay_logs(&mi->rli, thd,
- 1 /* just reset */,
- &errmsg)))
+ init_thread_mask(&thread_mask,mi,0 /* not inverse */);
+ if (thread_mask) // We refuse if any slave thread is running
+ {
+ sql_errno= ER_SLAVE_MUST_STOP;
+ error=1;
+ goto err;
+ }
+ if ((error= purge_relay_logs(&mi->rli, thd,
+ 1 /* just reset */,
+ &errmsg)))
goto err;
end_master_info(mi);
@@ -725,17 +755,15 @@ int reset_slave(THD *thd, MASTER_INFO* mi)
error=1;
goto err;
}
- if (restart_thread_mask)
- error=start_slave_threads(0 /* mutex not needed */,
- 1 /* wait for start*/,
- mi,master_info_file,relay_log_info_file,
- restart_thread_mask);
- // TODO: fix error messages so they get to the client
+
err:
unlock_slave_threads(mi);
+ if (thd && error)
+ send_error(thd, sql_errno, errmsg);
DBUG_RETURN(error);
}
+
void kill_zombie_dump_threads(uint32 slave_server_id)
{
pthread_mutex_lock(&LOCK_thread_count);
@@ -767,23 +795,20 @@ void kill_zombie_dump_threads(uint32 slave_server_id)
int change_master(THD* thd, MASTER_INFO* mi)
{
- int error=0,restart_thread_mask;
+ int thread_mask;
const char* errmsg=0;
bool need_relay_log_purge=1;
DBUG_ENTER("change_master");
- // kill slave thread
lock_slave_threads(mi);
- init_thread_mask(&restart_thread_mask,mi,0 /*not inverse*/);
- if (restart_thread_mask &&
- (error=terminate_slave_threads(mi,
- restart_thread_mask,
- 1 /*skip lock*/)))
+ init_thread_mask(&thread_mask,mi,0 /*not inverse*/);
+ if (thread_mask) // We refuse if any slave thread is running
{
- send_error(thd,error);
+ net_printf(thd,ER_SLAVE_MUST_STOP);
unlock_slave_threads(mi);
DBUG_RETURN(1);
}
+
thd->proc_info = "changing master";
LEX_MASTER_INFO* lex_mi = &thd->lex.mi;
// TODO: see if needs re-write
@@ -852,6 +877,7 @@ int change_master(THD* thd, MASTER_INFO* mi)
&errmsg))
{
net_printf(thd, 0, "Failed purging old relay logs: %s",errmsg);
+ unlock_slave_threads(mi);
DBUG_RETURN(1);
}
}
@@ -882,18 +908,9 @@ int change_master(THD* thd, MASTER_INFO* mi)
pthread_cond_broadcast(&mi->data_cond);
pthread_mutex_unlock(&mi->rli.data_lock);
- thd->proc_info = "starting slave";
- if (restart_thread_mask)
- error=start_slave_threads(0 /* mutex not needed*/,
- 1 /* wait for start*/,
- mi,master_info_file,relay_log_info_file,
- restart_thread_mask);
unlock_slave_threads(mi);
thd->proc_info = 0;
- if (error)
- send_error(thd,error);
- else
- send_ok(thd);
+ send_ok(thd);
DBUG_RETURN(0);
}
@@ -1153,3 +1170,7 @@ int log_loaded_block(IO_CACHE* file)
}
return 0;
}
+
+#endif /* HAVE_REPLICATION */
+
+
diff --git a/sql/sql_repl.h b/sql/sql_repl.h
index 15435382b08..f1fda45fe4b 100644
--- a/sql/sql_repl.h
+++ b/sql/sql_repl.h
@@ -1,3 +1,4 @@
+#ifdef HAVE_REPLICATION
#include "slave.h"
typedef struct st_slave_info
@@ -53,3 +54,6 @@ typedef struct st_load_file_info
} LOAD_FILE_INFO;
int log_loaded_block(IO_CACHE* file);
+
+#endif /* HAVE_REPLICATION */
+
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index ae45f96fbe8..a614b4d3fad 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -184,6 +184,16 @@ int handle_select(THD *thd, LEX *lex, select_result *result)
return res;
}
+
+void relink_tables(SELECT_LEX *select_lex)
+{
+ for (TABLE_LIST *cursor= (TABLE_LIST *) select_lex->table_list.first;
+ cursor;
+ cursor=cursor->next)
+ cursor->table= cursor->table_list->table;
+}
+
+
void fix_tables_pointers(SELECT_LEX *select_lex)
{
if (select_lex->next_select_in_list())
@@ -192,18 +202,15 @@ void fix_tables_pointers(SELECT_LEX *select_lex)
for (SELECT_LEX *sl= select_lex;
sl;
sl= sl->next_select_in_list())
- {
- for (TABLE_LIST *cursor= (TABLE_LIST *)sl->table_list.first;
- cursor;
- cursor=cursor->next)
- cursor->table= cursor->table_list->table;
- }
+ relink_tables(sl);
}
}
+
/*
- Inline function to setup clauses without sum functions
+ Function to setup clauses without sum functions
*/
+
inline int setup_without_group(THD *thd, TABLE_LIST *tables,
List<Item> &fields,
List<Item> &all_fields,
@@ -264,8 +271,8 @@ JOIN::prepare(TABLE_LIST *tables_init,
thd->where="having clause";
thd->allow_sum_func=1;
select_lex->having_fix_field= 1;
- bool having_fix_rc= (having->check_cols(1) ||
- having->fix_fields(thd, tables_list, &having));
+ bool having_fix_rc= (having->fix_fields(thd, tables_list, &having) ||
+ having->check_cols(1));
select_lex->having_fix_field= 0;
if (having_fix_rc || thd->net.report_error)
DBUG_RETURN(-1); /* purecov: inspected */
@@ -707,6 +714,13 @@ JOIN::exec()
int tmp_error;
DBUG_ENTER("JOIN::exec");
+
+ if (procedure)
+ {
+ if (procedure->change_columns(fields_list) ||
+ result->prepare(fields_list, unit))
+ DBUG_VOID_RETURN;
+ }
if (!tables_list)
{ // Only test of functions
@@ -761,8 +775,6 @@ JOIN::exec()
test_if_skip_sort_order(&join_tab[const_tables], order,
select_limit, 0))))
order=0;
- if (procedure)
- (void)result->prepare(fields_list, unit);
select_describe(this, need_tmp,
order != 0 && !skip_sort_order,
select_distinct);
@@ -982,9 +994,6 @@ JOIN::exec()
}
if (procedure)
{
- if (procedure->change_columns(fields_list) ||
- result->prepare(fields_list, unit))
- DBUG_VOID_RETURN;
count_field_types(&tmp_table_param, all_fields, 0);
}
if (group || tmp_table_param.sum_func_count ||
@@ -1507,7 +1516,7 @@ make_join_statistics(JOIN *join,TABLE_LIST *tables,COND *conds,
select->quick=0;
if (records != HA_POS_ERROR)
{
- s->records=s->found_records=records;
+ s->found_records=records;
s->read_time= (ha_rows) (s->quick ? s->quick->read_time : 0.0);
}
}
@@ -2298,7 +2307,8 @@ find_best(JOIN *join,table_map rest_tables,uint idx,double record_count,
!(s->quick && best_key && s->quick->index == best_key->key &&
best_max_key_part >= s->table->quick_key_parts[best_key->key]) &&
!((s->table->file->table_flags() & HA_TABLE_SCAN_ON_INDEX) &&
- s->table->used_keys && best_key))
+ s->table->used_keys && best_key) &&
+ !(s->table->force_index && best_key))
{ // Check full join
if (s->on_expr)
{
@@ -3640,7 +3650,9 @@ remove_eq_conds(COND *cond,Item::cond_result *cond_value)
(thd->options & OPTION_AUTO_IS_NULL) &&
thd->insert_id())
{
+#ifndef EMBEDDED_LIBRARY
query_cache_abort(&thd->net);
+#endif
COND *new_cond;
if ((new_cond= new Item_func_eq(args[0],
new Item_int("last_insert_id()",
@@ -4978,7 +4990,10 @@ join_read_const(JOIN_TAB *tab)
empty_record(table);
if (error != HA_ERR_KEY_NOT_FOUND)
{
- sql_print_error("read_const: Got error %d when reading table %s",
+ /* Locking reads can legally return also these errors, do not
+ print them to the .err log */
+ if (error != HA_ERR_LOCK_DEADLOCK && error != HA_ERR_LOCK_WAIT_TIMEOUT)
+ sql_print_error("read_const: Got error %d when reading table %s",
error, table->path);
table->file->print_error(error,MYF(0));
return 1;
@@ -5041,7 +5056,8 @@ join_read_always_key(JOIN_TAB *tab)
{
if (error != HA_ERR_KEY_NOT_FOUND)
{
- sql_print_error("read_const: Got error %d when reading table %s",error,
+ if (error != HA_ERR_LOCK_DEADLOCK && error != HA_ERR_LOCK_WAIT_TIMEOUT)
+ sql_print_error("read_const: Got error %d when reading table %s",error,
table->path);
table->file->print_error(error,MYF(0));
return 1;
@@ -5070,7 +5086,8 @@ join_read_last_key(JOIN_TAB *tab)
{
if (error != HA_ERR_KEY_NOT_FOUND)
{
- sql_print_error("read_const: Got error %d when reading table %s",error,
+ if (error != HA_ERR_LOCK_DEADLOCK && error != HA_ERR_LOCK_WAIT_TIMEOUT)
+ sql_print_error("read_const: Got error %d when reading table %s",error,
table->path);
table->file->print_error(error,MYF(0));
return 1;
@@ -5102,7 +5119,8 @@ join_read_next_same(READ_RECORD *info)
{
if (error != HA_ERR_END_OF_FILE)
{
- sql_print_error("read_next: Got error %d when reading table %s",error,
+ if (error != HA_ERR_LOCK_DEADLOCK && error != HA_ERR_LOCK_WAIT_TIMEOUT)
+ sql_print_error("read_next: Got error %d when reading table %s",error,
table->path);
table->file->print_error(error,MYF(0));
return 1;
@@ -5124,7 +5142,8 @@ join_read_prev_same(READ_RECORD *info)
{
if (error != HA_ERR_END_OF_FILE)
{
- sql_print_error("read_next: Got error %d when reading table %s",error,
+ if (error != HA_ERR_LOCK_DEADLOCK && error != HA_ERR_LOCK_WAIT_TIMEOUT)
+ sql_print_error("read_next: Got error %d when reading table %s",error,
table->path);
table->file->print_error(error,MYF(0));
error= 1;
@@ -5195,7 +5214,8 @@ join_read_first(JOIN_TAB *tab)
{
if (error != HA_ERR_KEY_NOT_FOUND && error != HA_ERR_END_OF_FILE)
{
- sql_print_error("read_first_with_key: Got error %d when reading table",
+ if (error != HA_ERR_LOCK_DEADLOCK && error != HA_ERR_LOCK_WAIT_TIMEOUT)
+ sql_print_error("read_first_with_key: Got error %d when reading table",
error);
table->file->print_error(error,MYF(0));
return 1;
@@ -5214,7 +5234,9 @@ join_read_next(READ_RECORD *info)
{
if (error != HA_ERR_END_OF_FILE)
{
- sql_print_error("read_next_with_key: Got error %d when reading table %s",
+ if (error != HA_ERR_LOCK_DEADLOCK && error != HA_ERR_LOCK_WAIT_TIMEOUT)
+ sql_print_error(
+ "read_next_with_key: Got error %d when reading table %s",
error, info->table->path);
info->file->print_error(error,MYF(0));
return 1;
@@ -5246,7 +5268,8 @@ join_read_last(JOIN_TAB *tab)
{
if (error != HA_ERR_END_OF_FILE)
{
- sql_print_error("read_last_with_key: Got error %d when reading table",
+ if (error != HA_ERR_LOCK_DEADLOCK && error != HA_ERR_LOCK_WAIT_TIMEOUT)
+ sql_print_error("read_last_with_key: Got error %d when reading table",
error, table->path);
table->file->print_error(error,MYF(0));
return 1;
@@ -5265,7 +5288,9 @@ join_read_prev(READ_RECORD *info)
{
if (error != HA_ERR_END_OF_FILE)
{
- sql_print_error("read_prev_with_key: Got error %d when reading table: %s",
+ if (error != HA_ERR_LOCK_DEADLOCK && error != HA_ERR_LOCK_WAIT_TIMEOUT)
+ sql_print_error(
+ "read_prev_with_key: Got error %d when reading table: %s",
error,info->table->path);
info->file->print_error(error,MYF(0));
return 1;
@@ -5293,7 +5318,8 @@ join_ft_read_first(JOIN_TAB *tab)
{
if (error != HA_ERR_END_OF_FILE)
{
- sql_print_error("ft_read_first: Got error %d when reading table %s",
+ if (error != HA_ERR_LOCK_DEADLOCK && error != HA_ERR_LOCK_WAIT_TIMEOUT)
+ sql_print_error("ft_read_first: Got error %d when reading table %s",
error, table->path);
table->file->print_error(error,MYF(0));
return 1;
@@ -5311,7 +5337,8 @@ join_ft_read_next(READ_RECORD *info)
{
if (error != HA_ERR_END_OF_FILE)
{
- sql_print_error("ft_read_next: Got error %d when reading table %s",
+ if (error != HA_ERR_LOCK_DEADLOCK && error != HA_ERR_LOCK_WAIT_TIMEOUT)
+ sql_print_error("ft_read_next: Got error %d when reading table %s",
error, info->table->path);
info->file->print_error(error,MYF(0));
return 1;
@@ -5563,6 +5590,9 @@ end_update(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)),
{
Item *item= *group->item;
item->save_org_in_field(group->field);
+#ifdef EMBEDDED_LIBRARY
+ join->thd->net.last_errno= 0;
+#endif
/* Store in the used key if the field was 0 */
if (item->maybe_null)
group->buff[-1]=item->null_value ? 1 : 0;
@@ -5933,6 +5963,69 @@ static uint find_shortest_key(TABLE *table, key_map usable_keys)
return best;
}
+/*
+ SYNOPSIS
+ is_subkey()
+ key_part - first key parts
+ ref_key_part - second key parts
+ ref_key_part_end - last+1 part of the second key
+ DESCRIPTION
+ Test if a second key is the subkey of the first one.
+ NOTE
+ Second key MUST be shorter than the first one.
+ RETURN
+ 1 - is the subkey
+ 0 - otherwise
+*/
+
+inline bool
+is_subkey(KEY_PART_INFO *key_part, KEY_PART_INFO *ref_key_part,
+ KEY_PART_INFO *ref_key_part_end)
+{
+ for (; ref_key_part < ref_key_part_end; key_part++, ref_key_part++)
+ if (!key_part->field->eq(ref_key_part->field))
+ return 0;
+ return 1;
+}
+
+/*
+ SYNOPSIS
+ test_if_subkey()
+ ref - number of key, used for WHERE clause
+ usable_keys - keys for testing
+ DESCRIPTION
+ Test if we can use one of the 'usable_keys' instead of 'ref' key.
+ RETURN
+ MAX_KEY - if we can't use other key
+ the number of found key - otherwise
+*/
+
+static uint
+test_if_subkey(ORDER *order, TABLE *table, uint ref, key_map usable_keys)
+{
+ uint nr;
+ uint min_length= (uint) ~0;
+ uint best= MAX_KEY;
+ uint not_used;
+ KEY_PART_INFO *ref_key_part= table->key_info[ref].key_part;
+ uint ref_key_parts= table->key_info[ref].key_parts;
+ KEY_PART_INFO *ref_key_part_end= ref_key_part + ref_key_parts;
+
+ for (nr= 0; usable_keys; usable_keys>>= 1, nr++)
+ {
+ if ((usable_keys & 1) &&
+ table->key_info[nr].key_length < min_length &&
+ table->key_info[nr].key_parts >= ref_key_parts &&
+ is_subkey(table->key_info[nr].key_part, ref_key_part,
+ ref_key_part_end) &&
+ test_if_order_by_key(order, table, nr, &not_used))
+ {
+ min_length= table->key_info[nr].key_length;
+ best= nr;
+ }
+ }
+ return best;
+}
/*
Test if we can skip the ORDER BY by using an index.
@@ -5980,6 +6073,27 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit,
*/
int order_direction;
uint used_key_parts;
+ if (!(usable_keys & ((key_map) 1 << ref_key)))
+ {
+ /*
+ We come here when ref_key is not among usable_keys
+ */
+ uint a;
+ if ((a= test_if_subkey(order, table, ref_key, usable_keys)) < MAX_KEY)
+ {
+ if (tab->ref.key >= 0)
+ {
+ tab->ref.key= a;
+ table->file->index_init(a);
+ }
+ else
+ {
+ select->quick->index= a;
+ select->quick->init();
+ }
+ ref_key= a;
+ }
+ }
/* Check if we get the rows in requested sorted order by using the key */
if ((usable_keys & ((key_map) 1 << ref_key)) &&
(order_direction = test_if_order_by_key(order,table,ref_key,
@@ -6805,7 +6919,7 @@ find_order_in_list(THD *thd,TABLE_LIST *tables,ORDER *order,List<Item> &fields,
}
order->in_field_list=0;
Item *it= *order->item;
- if (it->check_cols(1) || it->fix_fields(thd, tables, order->item) ||
+ if (it->fix_fields(thd, tables, order->item) || it->check_cols(1) ||
thd->fatal_error)
return 1; // Wrong field
all_fields.push_front(*order->item); // Add new field to field list
@@ -6840,7 +6954,7 @@ setup_group(THD *thd,TABLE_LIST *tables,List<Item> &fields,
if (!order)
return 0; /* Everything is ok */
- if (thd->sql_mode & MODE_ONLY_FULL_GROUP_BY)
+ if (thd->variables.sql_mode & MODE_ONLY_FULL_GROUP_BY)
{
Item *item;
List_iterator<Item> li(fields);
@@ -6862,7 +6976,7 @@ setup_group(THD *thd,TABLE_LIST *tables,List<Item> &fields,
return 1;
}
}
- if (thd->sql_mode & MODE_ONLY_FULL_GROUP_BY)
+ if (thd->variables.sql_mode & MODE_ONLY_FULL_GROUP_BY)
{
/* Don't allow one to use fields that is not used in GROUP BY */
Item *item;
diff --git a/sql/sql_select.h b/sql/sql_select.h
index 1fbe2052831..e30bba830eb 100644
--- a/sql/sql_select.h
+++ b/sql/sql_select.h
@@ -374,3 +374,4 @@ public:
bool cp_buffer_from_ref(TABLE_REF *ref);
bool error_if_full_join(JOIN *join);
+void relink_tables(SELECT_LEX *select_lex);
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index ac9cc6b3002..e77947e70f6 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -53,7 +53,6 @@ extern struct st_VioSSLAcceptorFd * ssl_acceptor_fd;
** A database is a directory in the mysql_data_home directory
****************************************************************************/
-
int
mysqld_show_dbs(THD *thd,const char *wild)
{
@@ -676,6 +675,7 @@ mysqld_show_fields(THD *thd, TABLE_LIST *table_list,const char *wild,
List<Item> field_list;
field_list.push_back(new Item_empty_string("Field",NAME_LEN));
field_list.push_back(new Item_empty_string("Type",40));
+ field_list.push_back(new Item_empty_string("Collation",40));
field_list.push_back(new Item_empty_string("Null",1));
field_list.push_back(new Item_empty_string("Key",3));
field_list.push_back(item=new Item_empty_string("Default",NAME_LEN));
@@ -687,14 +687,8 @@ mysqld_show_fields(THD *thd, TABLE_LIST *table_list,const char *wild,
field_list.push_back(new Item_empty_string("Comment",255));
}
// Send first number of fields and records
- {
- char *pos;
- pos=net_store_length(tmp, (uint) field_list.elements);
- pos=net_store_length(pos,(ulonglong) file->records);
- (void) my_net_write(&thd->net,tmp,(uint) (pos-tmp));
- }
-
- if (protocol->send_fields(&field_list,0))
+ if (protocol->send_records_num(&field_list, (ulonglong)file->records) ||
+ protocol->send_fields(&field_list,0))
DBUG_RETURN(1);
restore_record(table,2); // Get empty record
@@ -721,6 +715,7 @@ mysqld_show_fields(THD *thd, TABLE_LIST *table_list,const char *wild,
protocol->store(field->field_name);
field->sql_type(type);
protocol->store(type.ptr(), type.length());
+ protocol->store(field->charset()->name);
pos=(byte*) ((flags & NOT_NULL_FLAG) &&
field->type() != FIELD_TYPE_TIMESTAMP ?
@@ -753,8 +748,8 @@ mysqld_show_fields(THD *thd, TABLE_LIST *table_list,const char *wild,
if (verbose)
{
/* Add grant options & comments */
- col_access= get_column_grant(thd,table_list,field) & COL_ACLS;
end=tmp;
+ col_access= get_column_grant(thd,table_list,field) & COL_ACLS;
for (uint bitnr=0; col_access ; col_access>>=1,bitnr++)
{
if (col_access & 1)
@@ -999,11 +994,22 @@ mysqld_dump_create_info(THD *thd, TABLE *table, int fd)
static void
append_identifier(THD *thd, String *packet, const char *name)
{
+ char qtype;
+ if ((thd->variables.sql_mode & MODE_ANSI_QUOTES) ||
+ (thd->variables.sql_mode & MODE_POSTGRESQL) ||
+ (thd->variables.sql_mode & MODE_ORACLE) ||
+ (thd->variables.sql_mode & MODE_MSSQL) ||
+ (thd->variables.sql_mode & MODE_DB2) ||
+ (thd->variables.sql_mode & MODE_SAPDB))
+ qtype= '\"';
+ else
+ qtype= '`';
+
if (thd->options & OPTION_QUOTE_SHOW_CREATE)
{
- packet->append("`", 1);
+ packet->append(&qtype, 1);
packet->append(name);
- packet->append("`", 1);
+ packet->append(&qtype, 1);
}
else
{
@@ -1015,6 +1021,16 @@ append_identifier(THD *thd, String *packet, const char *name)
static int
store_create_info(THD *thd, TABLE *table, String *packet)
{
+ my_bool foreign_db_mode= ((thd->variables.sql_mode & MODE_POSTGRESQL) ||
+ (thd->variables.sql_mode & MODE_ORACLE) ||
+ (thd->variables.sql_mode & MODE_MSSQL) ||
+ (thd->variables.sql_mode & MODE_DB2) ||
+ (thd->variables.sql_mode & MODE_SAPDB));
+ my_bool limited_mysql_mode= ((thd->variables.sql_mode &
+ MODE_NO_FIELD_OPTIONS) ||
+ (thd->variables.sql_mode & MODE_MYSQL323) ||
+ (thd->variables.sql_mode & MODE_MYSQL40));
+
DBUG_ENTER("store_create_info");
DBUG_PRINT("enter",("table: %s",table->real_name));
@@ -1050,6 +1066,17 @@ store_create_info(THD *thd, TABLE *table, String *packet)
bool has_default = (field->type() != FIELD_TYPE_BLOB &&
field->type() != FIELD_TYPE_TIMESTAMP &&
field->unireg_check != Field::NEXT_NUMBER);
+
+ /*
+ For string types dump collation name only if
+ collation is not primary for the given charset
+ */
+ if (!field->binary() && !(field->charset()->state & MY_CS_PRIMARY) &&
+ !limited_mysql_mode && !foreign_db_mode)
+ {
+ packet->append(" collate ", 9);
+ packet->append(field->charset()->name);
+ }
if (flags & NOT_NULL_FLAG)
packet->append(" NOT NULL", 9);
@@ -1071,7 +1098,7 @@ store_create_info(THD *thd, TABLE *table, String *packet)
packet->append(tmp,0);
}
- if (field->unireg_check == Field::NEXT_NUMBER)
+ if (field->unireg_check == Field::NEXT_NUMBER && !foreign_db_mode)
packet->append(" auto_increment", 15 );
if (field->comment.length)
@@ -1105,17 +1132,20 @@ store_create_info(THD *thd, TABLE *table, String *packet)
packet->append("KEY ", 4);
if (!found_primary)
- append_identifier(thd,packet,key_info->name);
-
- if (table->db_type == DB_TYPE_HEAP &&
- key_info->algorithm == HA_KEY_ALG_BTREE)
- packet->append(" USING BTREE", 12);
-
- // +BAR: send USING only in non-default case: non-spatial rtree
- if ((key_info->algorithm == HA_KEY_ALG_RTREE) &&
- !(key_info->flags & HA_SPATIAL))
- packet->append(" USING RTREE",12);
+ append_identifier(thd, packet, key_info->name);
+ if (!(thd->variables.sql_mode & MODE_NO_KEY_OPTIONS) &&
+ !limited_mysql_mode && !foreign_db_mode)
+ {
+ if (table->db_type == DB_TYPE_HEAP &&
+ key_info->algorithm == HA_KEY_ALG_BTREE)
+ packet->append(" TYPE BTREE", 11);
+
+ // +BAR: send USING only in non-default case: non-spatial rtree
+ if ((key_info->algorithm == HA_KEY_ALG_RTREE) &&
+ !(key_info->flags & HA_SPATIAL))
+ packet->append(" TYPE RTREE", 11);
+ }
packet->append(" (", 2);
for (uint j=0 ; j < key_info->key_parts ; j++,key_part++)
@@ -1154,62 +1184,72 @@ store_create_info(THD *thd, TABLE *table, String *packet)
}
packet->append("\n)", 2);
- packet->append(" TYPE=", 6);
- packet->append(file->table_type());
- char buff[128];
- char* p;
-
- if (table->table_charset)
+ if (!(thd->variables.sql_mode & MODE_NO_TABLE_OPTIONS) && !foreign_db_mode)
{
- packet->append(" CHARSET=");
- packet->append(table->table_charset->name);
- }
+ packet->append(" TYPE=", 6);
+ packet->append(file->table_type());
+ char buff[128];
+ char* p;
+
+ if (table->table_charset &&
+ !(thd->variables.sql_mode & MODE_MYSQL323) &&
+ !(thd->variables.sql_mode & MODE_MYSQL40))
+ {
+ packet->append(" CHARSET=");
+ packet->append(table->table_charset->csname);
+ if (!(table->table_charset->state & MY_CS_PRIMARY))
+ {
+ packet->append(" COLLATE=");
+ packet->append(table->table_charset->name);
+ }
+ }
- if (table->min_rows)
- {
- packet->append(" MIN_ROWS=");
- p = longlong10_to_str(table->min_rows, buff, 10);
- packet->append(buff, (uint) (p - buff));
- }
+ if (table->min_rows)
+ {
+ packet->append(" MIN_ROWS=");
+ p = longlong10_to_str(table->min_rows, buff, 10);
+ packet->append(buff, (uint) (p - buff));
+ }
- if (table->max_rows)
- {
- packet->append(" MAX_ROWS=");
- p = longlong10_to_str(table->max_rows, buff, 10);
- packet->append(buff, (uint) (p - buff));
- }
- if (table->avg_row_length)
- {
- packet->append(" AVG_ROW_LENGTH=");
- p=longlong10_to_str(table->avg_row_length, buff,10);
- packet->append(buff, (uint) (p - buff));
- }
+ if (table->max_rows)
+ {
+ packet->append(" MAX_ROWS=");
+ p = longlong10_to_str(table->max_rows, buff, 10);
+ packet->append(buff, (uint) (p - buff));
+ }
+ if (table->avg_row_length)
+ {
+ packet->append(" AVG_ROW_LENGTH=");
+ p=longlong10_to_str(table->avg_row_length, buff,10);
+ packet->append(buff, (uint) (p - buff));
+ }
- if (table->db_create_options & HA_OPTION_PACK_KEYS)
- packet->append(" PACK_KEYS=1", 12);
- if (table->db_create_options & HA_OPTION_NO_PACK_KEYS)
- packet->append(" PACK_KEYS=0", 12);
- if (table->db_create_options & HA_OPTION_CHECKSUM)
- packet->append(" CHECKSUM=1", 11);
- if (table->db_create_options & HA_OPTION_DELAY_KEY_WRITE)
- packet->append(" DELAY_KEY_WRITE=1",18);
- if (table->row_type != ROW_TYPE_DEFAULT)
- {
- packet->append(" ROW_FORMAT=",12);
- packet->append(ha_row_type[(uint) table->row_type]);
- }
- table->file->append_create_info(packet);
- if (table->comment && table->comment[0])
- {
- packet->append(" COMMENT=", 9);
- append_unescaped(packet, table->comment, strlen(table->comment));
- }
- if (file->raid_type)
- {
- char buff[100];
- sprintf(buff," RAID_TYPE=%s RAID_CHUNKS=%d RAID_CHUNKSIZE=%ld",
- my_raid_type(file->raid_type), file->raid_chunks, file->raid_chunksize/RAID_BLOCK_SIZE);
- packet->append(buff);
+ if (table->db_create_options & HA_OPTION_PACK_KEYS)
+ packet->append(" PACK_KEYS=1", 12);
+ if (table->db_create_options & HA_OPTION_NO_PACK_KEYS)
+ packet->append(" PACK_KEYS=0", 12);
+ if (table->db_create_options & HA_OPTION_CHECKSUM)
+ packet->append(" CHECKSUM=1", 11);
+ if (table->db_create_options & HA_OPTION_DELAY_KEY_WRITE)
+ packet->append(" DELAY_KEY_WRITE=1",18);
+ if (table->row_type != ROW_TYPE_DEFAULT)
+ {
+ packet->append(" ROW_FORMAT=",12);
+ packet->append(ha_row_type[(uint) table->row_type]);
+ }
+ table->file->append_create_info(packet);
+ if (table->comment && table->comment[0])
+ {
+ packet->append(" COMMENT=", 9);
+ append_unescaped(packet, table->comment, strlen(table->comment));
+ }
+ if (file->raid_type)
+ {
+ char buff[100];
+ sprintf(buff," RAID_TYPE=%s RAID_CHUNKS=%d RAID_CHUNKSIZE=%ld",
+ my_raid_type(file->raid_type), file->raid_chunks, file->raid_chunksize/RAID_BLOCK_SIZE);
+ packet->append(buff);
+ }
}
DBUG_RETURN(0);
}
@@ -1237,7 +1277,6 @@ public:
template class I_List<thread_info>;
#endif
-
void mysqld_list_processes(THD *thd,const char *user, bool verbose)
{
Item *field;
@@ -1269,8 +1308,14 @@ void mysqld_list_processes(THD *thd,const char *user, bool verbose)
THD *tmp;
while ((tmp=it++))
{
+ struct st_my_thread_var *mysys_var;
+#ifndef EMBEDDED_LIBRARY
if ((tmp->net.vio || tmp->system_thread) &&
(!user || (tmp->user && !strcmp(tmp->user,user))))
+#else
+ if (tmp->system_thread &&
+ (!user || (tmp->user && !strcmp(tmp->user,user))))
+#endif
{
thread_info *thd_info=new thread_info;
@@ -1285,9 +1330,10 @@ void mysqld_list_processes(THD *thd,const char *user, bool verbose)
if ((thd_info->db=tmp->db)) // Safe test
thd_info->db=thd->strdup(thd_info->db);
thd_info->command=(int) tmp->command;
- if (tmp->mysys_var)
- pthread_mutex_lock(&tmp->mysys_var->mutex);
+ if ((mysys_var= tmp->mysys_var))
+ pthread_mutex_lock(&mysys_var->mutex);
thd_info->proc_info= (char*) (tmp->killed ? "Killed" : 0);
+#ifndef EMBEDDED_LIBRARY
thd_info->state_info= (char*) (tmp->locked ? "Locked" :
tmp->net.reading_or_writing ?
(tmp->net.reading_or_writing == 2 ?
@@ -1298,8 +1344,11 @@ void mysqld_list_processes(THD *thd,const char *user, bool verbose)
tmp->mysys_var &&
tmp->mysys_var->current_cond ?
"Waiting on cond" : NullS);
- if (tmp->mysys_var)
- pthread_mutex_unlock(&tmp->mysys_var->mutex);
+#else
+ thd_info->state_info= (char*)"Writing to net";
+#endif
+ if (mysys_var)
+ pthread_mutex_unlock(&mysys_var->mutex);
#if !defined(DONT_USE_THR_ALARM) && ! defined(SCO)
if (pthread_kill(tmp->real_id,0))
@@ -1350,7 +1399,6 @@ void mysqld_list_processes(THD *thd,const char *user, bool verbose)
DBUG_VOID_RETURN;
}
-
/*****************************************************************************
Status functions
*****************************************************************************/
@@ -1444,6 +1492,9 @@ int mysqld_show(THD *thd, const char *wild, show_var_st *variables,
break;
case SHOW_LONGLONG:
end= longlong10_to_str(*(longlong*) value, buff, 10);
+ break;
+ case SHOW_HA_ROWS:
+ end= longlong10_to_str((longlong) *(ha_rows*) value, buff, 10);
break;
case SHOW_BOOL:
end= strmov(buff, *(bool*) value ? "ON" : "OFF");
@@ -1473,6 +1524,7 @@ int mysqld_show(THD *thd, const char *wild, show_var_st *variables,
case SHOW_QUESTION:
end= int10_to_str((long) thd->query_id, buff, 10);
break;
+#ifndef EMBEDDED_LIBRARY
case SHOW_RPL_STATUS:
end= strmov(buff, rpl_status_type[(int)rpl_status]);
break;
@@ -1484,6 +1536,7 @@ int mysqld_show(THD *thd, const char *wild, show_var_st *variables,
UNLOCK_ACTIVE_MI;
break;
}
+#endif /* EMBEDDED_LIBRARY */
case SHOW_OPENTABLES:
end= int10_to_str((long) cached_tables(), buff, 10);
break;
@@ -1662,6 +1715,8 @@ int mysqld_show(THD *thd, const char *wild, show_var_st *variables,
case SHOW_UNDEF: // Show never happen
case SHOW_SYS:
break; // Return empty string
+ default:
+ break;
}
if (protocol->store(pos, (uint32) (end - pos)) ||
protocol->write())
diff --git a/sql/sql_string.cc b/sql/sql_string.cc
index 5b84b86c277..646621ac2eb 100644
--- a/sql/sql_string.cc
+++ b/sql/sql_string.cc
@@ -30,6 +30,9 @@
extern gptr sql_alloc(unsigned size);
extern void sql_element_free(void *ptr);
+static uint32
+copy_and_convert(char *to, uint32 to_length, CHARSET_INFO *to_cs,
+ const char *from, uint32 from_length, CHARSET_INFO *from_cs);
#include "sql_string.h"
@@ -97,7 +100,7 @@ bool String::set(longlong num, CHARSET_INFO *cs)
if (alloc(l))
return TRUE;
- str_length=(uint32) cs->ll10tostr(cs,Ptr,l,-10,num);
+ str_length=(uint32) cs->longlong10_to_str(cs,Ptr,l,-10,num);
str_charset=cs;
return FALSE;
}
@@ -108,7 +111,7 @@ bool String::set(ulonglong num, CHARSET_INFO *cs)
if (alloc(l))
return TRUE;
- str_length=(uint32) cs->ll10tostr(cs,Ptr,l,10,num);
+ str_length=(uint32) cs->longlong10_to_str(cs,Ptr,l,10,num);
str_charset=cs;
return FALSE;
}
@@ -223,55 +226,51 @@ bool String::copy(const char *str,uint32 arg_length, CHARSET_INFO *cs)
return FALSE;
}
-/* Copy with charset convertion */
-bool String::copy(const char *str,uint32 arg_length, CHARSET_INFO *from, CHARSET_INFO *to)
-{
- uint32 new_length=to->mbmaxlen*arg_length;
- int cnvres;
- my_wc_t wc;
- const uchar *s=(const uchar *)str;
- const uchar *se=s+arg_length;
- uchar *d, *de;
+ /* Copy with charset convertion */
+bool String::copy(const char *str, uint32 arg_length,
+ CHARSET_INFO *from_cs, CHARSET_INFO *to_cs)
+{
+ uint32 new_length= to_cs->mbmaxlen*arg_length;
if (alloc(new_length))
return TRUE;
+ str_length=copy_and_convert((char*) Ptr, new_length, to_cs,
+ str, arg_length, from_cs);
+ str_charset=to_cs;
+ return FALSE;
+}
- d=(uchar *)Ptr;
- de=d+new_length;
+
+/*
+ Set a string to the value of a latin1-string, keeping the original charset
- for (str_length=new_length ; s < se && d < de ; )
- {
- if ((cnvres=from->mb_wc(from,&wc,s,se)) > 0 )
- {
- s+=cnvres;
- }
- else if (cnvres==MY_CS_ILSEQ)
- {
- s++;
- wc='?';
- }
- else
- break;
+ SYNOPSIS
+ copy_or_set()
+ str String of a simple charset (latin1)
+ arg_length Length of string
-outp:
- if ((cnvres=to->wc_mb(to,wc,d,de)) >0 )
- {
- d+=cnvres;
- }
- else if (cnvres==MY_CS_ILUNI && wc!='?')
- {
- wc='?';
- goto outp;
- }
- else
- break;
+ IMPLEMENTATION
+ If string object is of a simple character set, set it to point to the
+ given string.
+ If not, make a copy and convert it to the new character set.
+
+ RETURN
+ 0 ok
+ 1 Could not allocate result buffer
+
+*/
+
+bool String::set_latin1(const char *str, uint32 arg_length)
+{
+ if (str_charset->mbmaxlen == 1)
+ {
+ set(str, arg_length, str_charset);
+ return 0;
}
- Ptr[new_length]=0;
- length((uint32) (d-(uchar *)Ptr));
- str_charset=to;
- return FALSE;
+ return copy(str, arg_length, my_charset_latin1, str_charset);
}
+
/* This is used by mysql.cc */
bool String::fill(uint32 max_length,char fill_char)
@@ -306,11 +305,26 @@ bool String::append(const String &s)
return FALSE;
}
+
+/*
+ Append a latin1 string to the a string of the current character set
+*/
+
+
bool String::append(const char *s,uint32 arg_length)
{
if (!arg_length) // Default argument
if (!(arg_length= (uint32) strlen(s)))
return FALSE;
+ if (str_charset->mbmaxlen > 1)
+ {
+ uint32 add_length=arg_length * str_charset->mbmaxlen;
+ if (realloc(str_length+ add_length))
+ return TRUE;
+ str_length+= copy_and_convert(Ptr+str_length, add_length, str_charset,
+ s, arg_length, my_charset_latin1);
+ return FALSE;
+ }
if (realloc(str_length+arg_length))
return TRUE;
memcpy(Ptr+str_length,s,arg_length);
@@ -318,6 +332,7 @@ bool String::append(const char *s,uint32 arg_length)
return FALSE;
}
+
#ifdef TO_BE_REMOVED
bool String::append(FILE* file, uint32 arg_length, myf my_flags)
{
@@ -658,4 +673,61 @@ String *copy_if_not_alloced(String *to,String *from,uint32 from_length)
}
+/****************************************************************************
+ Help functions
+****************************************************************************/
+
+/*
+ copy a string from one character set to another
+
+ SYNOPSIS
+ copy_and_convert()
+ to Store result here
+ to_cs Character set of result string
+ from Copy from here
+ from_length Length of from string
+ from_cs From character set
+
+ NOTES
+ 'to' must be big enough as form_length * to_cs->mbmaxlen
+
+ RETURN
+ length of bytes copied to 'to'
+*/
+
+static uint32
+copy_and_convert(char *to, uint32 to_length, CHARSET_INFO *to_cs,
+ const char *from, uint32 from_length, CHARSET_INFO *from_cs)
+{
+ int cnvres;
+ my_wc_t wc;
+ const uchar *from_end= (const uchar*) from+from_length;
+ char *to_start= to;
+ uchar *to_end= (uchar*) to+to_length;
+
+ while ((uchar*) from < from_end)
+ {
+ if ((cnvres=from_cs->mb_wc(from_cs, &wc, (uchar*) from, from_end)) > 0)
+ from+= cnvres;
+ else if (cnvres == MY_CS_ILSEQ)
+ {
+ from++;
+ wc= '?';
+ }
+ else
+ break; // Impossible char.
+
+outp:
+ if ((cnvres= to_cs->wc_mb(to_cs, wc, (uchar*) to, to_end)) > 0)
+ to+= cnvres;
+ else if (cnvres == MY_CS_ILUNI && wc != '?')
+ {
+ wc= '?';
+ goto outp;
+ }
+ else
+ break;
+ }
+ return (uint32) (to - to_start);
+}
diff --git a/sql/sql_string.h b/sql/sql_string.h
index afcc3d74530..ad91b20f18c 100644
--- a/sql/sql_string.h
+++ b/sql/sql_string.h
@@ -115,6 +115,7 @@ public:
Ptr=(char*) str; str_length=arg_length; Alloced_length=0 ; alloced=0;
str_charset=cs;
}
+ bool String::set_latin1(const char *str, uint32 arg_length);
inline void set_quick(char *str,uint32 arg_length, CHARSET_INFO *cs)
{
if (!alloced)
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index b72b722e010..f4642870af3 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -46,7 +46,8 @@ static int copy_data_between_tables(TABLE *from,TABLE *to,
** This will wait for all users to free the table before dropping it
*****************************************************************************/
-int mysql_rm_table(THD *thd,TABLE_LIST *tables, my_bool if_exists)
+int mysql_rm_table(THD *thd,TABLE_LIST *tables, my_bool if_exists,
+ my_bool drop_temporary)
{
int error;
DBUG_ENTER("mysql_rm_table");
@@ -57,7 +58,7 @@ int mysql_rm_table(THD *thd,TABLE_LIST *tables, my_bool if_exists)
thd->mysys_var->current_cond= &COND_refresh;
VOID(pthread_mutex_lock(&LOCK_open));
- if (global_read_lock)
+ if (!drop_temporary && global_read_lock)
{
if (thd->global_read_lock)
{
@@ -72,7 +73,7 @@ int mysql_rm_table(THD *thd,TABLE_LIST *tables, my_bool if_exists)
}
}
- error=mysql_rm_table_part2(thd,tables,if_exists,0);
+ error=mysql_rm_table_part2(thd,tables, if_exists, drop_temporary, 0);
err:
pthread_mutex_unlock(&LOCK_open);
@@ -91,14 +92,15 @@ int mysql_rm_table(THD *thd,TABLE_LIST *tables, my_bool if_exists)
int mysql_rm_table_part2_with_lock(THD *thd,
TABLE_LIST *tables, bool if_exists,
- bool dont_log_query)
+ bool drop_temporary, bool dont_log_query)
{
int error;
thd->mysys_var->current_mutex= &LOCK_open;
thd->mysys_var->current_cond= &COND_refresh;
VOID(pthread_mutex_lock(&LOCK_open));
- error=mysql_rm_table_part2(thd,tables, if_exists, dont_log_query);
+ error=mysql_rm_table_part2(thd,tables, if_exists, drop_temporary,
+ dont_log_query);
pthread_mutex_unlock(&LOCK_open);
VOID(pthread_cond_broadcast(&COND_refresh)); // Signal to refresh
@@ -111,6 +113,17 @@ int mysql_rm_table_part2_with_lock(THD *thd,
}
/*
+ Execute the drop of a normal or temporary table
+
+ SYNOPSIS
+ mysql_rm_table_part2()
+ thd Thread handler
+ tables Tables to drop
+ if_exists If set, don't give an error if table doesn't exists.
+ In this case we give an warning of level 'NOTE'
+ drop_temporary Only drop temporary tables
+ dont_log_query Don't log the query
+
TODO:
When logging to the binary log, we should log
tmp_tables and transactional tables as separate statements if we
@@ -120,10 +133,15 @@ int mysql_rm_table_part2_with_lock(THD *thd,
The current code only writes DROP statements that only uses temporary
tables to the cache binary log. This should be ok on most cases, but
not all.
+
+ RETURN
+ 0 ok
+ 1 Error
+ -1 Thread was killed
*/
int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
- bool dont_log_query)
+ bool drop_temporary, bool dont_log_query)
{
TABLE_LIST *table;
char path[FN_REFLEN];
@@ -142,29 +160,33 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
continue; // removed temporary table
}
- abort_locked_tables(thd,db,table->real_name);
- while (remove_table_from_cache(thd,db,table->real_name) && !thd->killed)
- {
- dropping_tables++;
- (void) pthread_cond_wait(&COND_refresh,&LOCK_open);
- dropping_tables--;
- }
- drop_locked_tables(thd,db,table->real_name);
- if (thd->killed)
- DBUG_RETURN(-1);
-
- /* remove form file and isam files */
- strxmov(path, mysql_data_home, "/", db, "/", table->real_name, reg_ext,
- NullS);
- (void) unpack_filename(path,path);
error=0;
+ if (!drop_temporary)
+ {
+ abort_locked_tables(thd,db,table->real_name);
+ while (remove_table_from_cache(thd,db,table->real_name) && !thd->killed)
+ {
+ dropping_tables++;
+ (void) pthread_cond_wait(&COND_refresh,&LOCK_open);
+ dropping_tables--;
+ }
+ drop_locked_tables(thd,db,table->real_name);
+ if (thd->killed)
+ DBUG_RETURN(-1);
- table_type=get_table_type(path);
+ /* remove form file and isam files */
+ strxmov(path, mysql_data_home, "/", db, "/", table->real_name, reg_ext,
+ NullS);
+ (void) unpack_filename(path,path);
- if (access(path,F_OK))
+ table_type=get_table_type(path);
+ }
+ if (drop_temporary || access(path,F_OK))
{
if (if_exists)
- store_warning(thd, ER_BAD_TABLE_ERROR, table->real_name);
+ push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
+ ER_BAD_TABLE_ERROR, ER(ER_BAD_TABLE_ERROR),
+ table->real_name);
else
error= 1;
}
@@ -419,6 +441,16 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name,
sql_field->unireg_check=Field::BLOB_FIELD;
blob_columns++;
break;
+ case FIELD_TYPE_GEOMETRY:
+ sql_field->pack_flag=FIELDFLAG_GEOM |
+ pack_length_to_packflag(sql_field->pack_length -
+ portable_sizeof_char_ptr);
+ if (sql_field->charset->state & MY_CS_BINSORT)
+ sql_field->pack_flag|=FIELDFLAG_BINARY;
+ sql_field->length=8; // Unireg field length
+ sql_field->unireg_check=Field::BLOB_FIELD;
+ blob_columns++;
+ break;
case FIELD_TYPE_VAR_STRING:
case FIELD_TYPE_STRING:
sql_field->pack_flag=0;
@@ -1200,8 +1232,10 @@ static int mysql_admin_table(THD* thd, TABLE_LIST* tables,
thd->open_options|= extra_open_options;
table->table = open_ltable(thd, table, lock_type);
+#ifdef EMBEDDED_LIBRARY
+ thd->net.last_errno= 0; // these errors shouldn't get client
+#endif
thd->open_options&= ~extra_open_options;
- protocol->prepare_for_resend();
if (prepare_func)
{
@@ -1266,6 +1300,9 @@ static int mysql_admin_table(THD* thd, TABLE_LIST* tables,
}
int result_code = (table->table->file->*operator_func)(thd, check_opt);
+#ifdef EMBEDDED_LIBRARY
+ thd->net.last_errno= 0; // these errors shouldn't get client
+#endif
protocol->prepare_for_resend();
protocol->store(table_name);
protocol->store(operator_name);
@@ -2008,12 +2045,9 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
/* We changed a temporary table */
if (error)
{
- /*
- * The following function call will also free a
- * new_table pointer.
- * Therefore, here new_table pointer is not free'd as it is
- * free'd in close_temporary() which is called by by the
- * close_temporary_table() function.
+ /*
+ The following function call will free the new_table pointer,
+ in close_temporary_table(), so we can safely directly jump to err
*/
close_temporary_table(thd,new_db,tmp_name);
goto err;
diff --git a/sql/sql_test.cc b/sql/sql_test.cc
index 758778ecfa8..8984bcc6463 100644
--- a/sql/sql_test.cc
+++ b/sql/sql_test.cc
@@ -276,7 +276,6 @@ static void display_table_locks (void)
VOID(pthread_mutex_unlock(&lock->mutex));
}
VOID(pthread_mutex_unlock(&THR_LOCK_lock));
- uint i;
if (!saved_table_locks.elements) goto end;
qsort((gptr) dynamic_element(&saved_table_locks,0,TABLE_LOCK_INFO *),saved_table_locks.elements,sizeof(TABLE_LOCK_INFO),(qsort_cmp) dl_compare);
@@ -284,6 +283,7 @@ static void display_table_locks (void)
puts("\nThread database.table_name Locked/Waiting Lock_type\n");
+ unsigned int i;
for (i=0 ; i < saved_table_locks.elements ; i++)
{
TABLE_LOCK_INFO *dl_ptr=dynamic_element(&saved_table_locks,i,TABLE_LOCK_INFO*);
diff --git a/sql/sql_update.cc b/sql/sql_update.cc
index de5cb9ef45b..3aae6f6f411 100644
--- a/sql/sql_update.cc
+++ b/sql/sql_update.cc
@@ -233,6 +233,7 @@ int mysql_update(THD *thd,
}
}
end_read_record(&info);
+
if (table->key_read)
{
table->key_read=0;
@@ -416,8 +417,6 @@ int mysql_multi_update(THD *thd,
(ORDER *)NULL,
options | SELECT_NO_JOIN_CACHE,
result, unit, select_lex, 0);
-
-end:
delete result;
DBUG_RETURN(res);
}
@@ -631,7 +630,6 @@ bool multi_update::send_data(List<Item> &not_used_values)
TABLE_LIST *cur_table;
DBUG_ENTER("multi_update::send_data");
- found++;
for (cur_table= update_tables; cur_table ; cur_table= cur_table->next)
{
TABLE *table= cur_table->table;
@@ -647,6 +645,7 @@ bool multi_update::send_data(List<Item> &not_used_values)
store_record(table,1);
if (fill_record(*fields_for_table[offset], *values_for_table[offset]))
DBUG_RETURN(1);
+ found++;
if (compare_record(table, thd->query_id))
{
int error;
@@ -673,7 +672,7 @@ bool multi_update::send_data(List<Item> &not_used_values)
int error;
TABLE *tmp_table= tmp_tables[offset];
fill_record(tmp_table->field+1, *values_for_table[offset]);
-
+ found++;
/* Store pointer to row */
memcpy((char*) tmp_table->field[0]->ptr,
(char*) table->file->ref, table->file->ref_length);
@@ -772,7 +771,6 @@ int multi_update::do_updates(bool from_send_error)
continue; // May happen on dup key
goto err;
}
- found++;
if ((local_error= table->file->rnd_pos(table->record[0], ref_pos)))
goto err;
table->status|= STATUS_UPDATED;
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index 0c403abb4b0..d8f2bb15459 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000-2001 MySQL AB
+/* Copyright (C) 2000-2003 MySQL AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -45,7 +45,7 @@ int yylex(void *yylval, void *yythd);
inline Item *or_or_concat(THD *thd, Item* A, Item* B)
{
- return (thd->sql_mode & MODE_PIPES_AS_CONCAT ?
+ return (thd->variables.sql_mode & MODE_PIPES_AS_CONCAT ?
(Item*) new Item_func_concat(A,B) : (Item*) new Item_cond_or(A,B));
}
@@ -222,6 +222,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
%token FIRST_SYM
%token FIXED_SYM
%token FLOAT_NUM
+%token FORCE_SYM
%token FOREIGN
%token FROM
%token FULL
@@ -633,7 +634,8 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
%type <charset>
charset_name
charset_name_or_default
- opt_db_default_character_set
+ collation_name
+ collation_name_or_default
%type <variable> internal_variable_name
@@ -822,7 +824,8 @@ create:
($2 &
HA_LEX_CREATE_TMP_TABLE ?
&tmp_table_alias :
- (LEX_STRING*) 0),1,
+ (LEX_STRING*) 0),
+ TL_OPTION_UPDATING,
((using_update_log)?
TL_READ_NO_INSERT:
TL_READ)))
@@ -843,7 +846,8 @@ create:
{
LEX *lex=Lex;
lex->sql_command= SQLCOM_CREATE_INDEX;
- if (!lex->current_select->add_table_to_list(lex->thd, $7,NULL,1))
+ if (!lex->current_select->add_table_to_list(lex->thd, $7, NULL,
+ TL_OPTION_UPDATING))
YYABORT;
lex->create_list.empty();
lex->key_list.empty();
@@ -857,13 +861,14 @@ create:
lex->key_list.push_back(new Key($2,$4.str, $5, lex->col_list));
lex->col_list.empty();
}
- | CREATE DATABASE opt_if_not_exists ident opt_db_default_character_set
+ | CREATE DATABASE opt_if_not_exists ident
+ { Lex->create_info.table_charset=NULL; }
+ opt_create_database_options
{
LEX *lex=Lex;
lex->sql_command=SQLCOM_CREATE_DB;
lex->name=$4.str;
lex->create_info.options=$3;
- lex->create_info.table_charset=$5;
}
| CREATE udf_func_type UDF_SYM ident
{
@@ -907,6 +912,22 @@ opt_as:
/* empty */ {}
| AS {};
+opt_create_database_options:
+ /* empty */ {}
+ | create_database_options {};
+
+create_database_options:
+ create_database_option {}
+ | create_database_options create_database_option {};
+
+create_database_option:
+ COLLATE_SYM collation_name_or_default
+ { Lex->create_info.table_charset=$2; }
+ | opt_default CHAR_SYM SET charset_name_or_default
+ { Lex->create_info.table_charset=$4; }
+ | opt_default CHARSET charset_name_or_default
+ { Lex->create_info.table_charset=$3; };
+
opt_table_options:
/* empty */ { $$= 0; }
| table_options { $$= $1;};
@@ -974,6 +995,11 @@ create_table_option:
Lex->create_info.table_charset= $5;
Lex->create_info.used_fields|= HA_CREATE_USED_CHARSET;
}
+ | COLLATE_SYM opt_equal collation_name_or_default
+ {
+ Lex->create_info.table_charset= $3;
+ Lex->create_info.used_fields|= HA_CREATE_USED_CHARSET;
+ }
| INSERT_METHOD opt_equal merge_insert_types { Lex->create_info.merge_insert_method= $3; Lex->create_info.used_fields|= HA_CREATE_USED_INSERT_METHOD;}
| DATA_SYM DIRECTORY_SYM opt_equal TEXT_STRING { Lex->create_info.data_file_name= $4.str; }
| INDEX DIRECTORY_SYM opt_equal TEXT_STRING { Lex->create_info.index_file_name= $4.str; };
@@ -1086,6 +1112,8 @@ type:
$$=FIELD_TYPE_TINY; }
| BOOL_SYM { Lex->length=(char*) "1";
$$=FIELD_TYPE_TINY; }
+ | BOOLEAN_SYM { Lex->length=(char*) "1";
+ $$=FIELD_TYPE_TINY; }
| char '(' NUM ')' opt_binary { Lex->length=$3.str;
$$=FIELD_TYPE_STRING; }
| char opt_binary { Lex->length=(char*) "1";
@@ -1103,7 +1131,7 @@ type:
| TIME_SYM { $$=FIELD_TYPE_TIME; }
| TIMESTAMP
{
- if (YYTHD->sql_mode & MODE_SAPDB)
+ if (YYTHD->variables.sql_mode & MODE_SAPDB)
$$=FIELD_TYPE_DATETIME;
else
$$=FIELD_TYPE_TIMESTAMP;
@@ -1174,7 +1202,7 @@ int_type:
| BIGINT { $$=FIELD_TYPE_LONGLONG; };
real_type:
- REAL { $$= YYTHD->sql_mode & MODE_REAL_AS_FLOAT ?
+ REAL { $$= YYTHD->variables.sql_mode & MODE_REAL_AS_FLOAT ?
FIELD_TYPE_FLOAT : FIELD_TYPE_DOUBLE; }
| DOUBLE_SYM { $$=FIELD_TYPE_DOUBLE; }
| DOUBLE_SYM PRECISION { $$=FIELD_TYPE_DOUBLE; };
@@ -1231,19 +1259,26 @@ attribute:
| opt_primary KEY_SYM { Lex->type|= PRI_KEY_FLAG | NOT_NULL_FLAG; }
| UNIQUE_SYM { Lex->type|= UNIQUE_FLAG; }
| UNIQUE_SYM KEY_SYM { Lex->type|= UNIQUE_KEY_FLAG; }
- | COMMENT_SYM text_literal { Lex->comment= $2; };
+ | COMMENT_SYM text_literal { Lex->comment= $2; }
+ | COLLATE_SYM collation_name { Lex->charset=$2; };
charset_name:
- BINARY
+ ident
{
- if (!($$=get_charset_by_name("binary",MYF(0))))
+ if (!($$=get_charset_by_csname($1.str,MYF(0))))
{
- net_printf(YYTHD,ER_UNKNOWN_CHARACTER_SET,"binary");
+ net_printf(YYTHD,ER_UNKNOWN_CHARACTER_SET,$1.str);
YYABORT;
}
- }
- | ident
+ };
+
+charset_name_or_default:
+ charset_name { $$=$1; }
+ | DEFAULT { $$=NULL; } ;
+
+collation_name:
+ ident
{
if (!($$=get_charset_by_name($1.str,MYF(0))))
{
@@ -1252,19 +1287,14 @@ charset_name:
}
};
-charset_name_or_default:
- charset_name { $$=$1; }
+collation_name_or_default:
+ collation_name { $$=$1; }
| DEFAULT { $$=NULL; } ;
opt_default:
/* empty */ {}
| DEFAULT {};
-opt_db_default_character_set:
- /* empty */ { $$=default_charset_info; }
- | opt_default CHAR_SYM SET charset_name_or_default { $$=$4; }
- | opt_default CHARSET charset_name_or_default { $$=$3; };
-
opt_binary:
/* empty */ { Lex->charset=NULL; }
| ASCII_SYM { Lex->charset=my_charset_latin1; }
@@ -1278,7 +1308,6 @@ opt_binary:
YYABORT;
}
}
- | COLLATE_SYM charset_name { Lex->charset=$2; }
| CHAR_SYM SET charset_name { Lex->charset=$3; } ;
opt_primary:
@@ -1355,7 +1384,8 @@ opt_unique_or_fulltext:
key_alg:
/* empty */ { $$= HA_KEY_ALG_UNDEF; }
- | USING opt_btree_or_rtree { $$= $2; };
+ | USING opt_btree_or_rtree { $$= $2; }
+ | TYPE_SYM opt_btree_or_rtree { $$= $2; };
opt_btree_or_rtree:
BTREE_SYM { $$= HA_KEY_ALG_BTREE; }
@@ -1389,7 +1419,8 @@ alter:
LEX *lex=&thd->lex;
lex->sql_command = SQLCOM_ALTER_TABLE;
lex->name=0;
- if (!lex->select_lex.add_table_to_list(thd, $4, NULL,1))
+ if (!lex->select_lex.add_table_to_list(thd, $4, NULL,
+ TL_OPTION_UPDATING))
YYABORT;
lex->drop_primary=0;
lex->create_list.empty();
@@ -1408,12 +1439,11 @@ alter:
}
alter_list
{}
- | ALTER DATABASE ident opt_db_default_character_set
+ | ALTER DATABASE ident opt_create_database_options
{
LEX *lex=Lex;
lex->sql_command=SQLCOM_ALTER_DB;
lex->name=$3.str;
- lex->create_info.table_charset=$4;
};
@@ -1656,8 +1686,10 @@ table_to_table:
{
LEX *lex=Lex;
SELECT_LEX_NODE *sl= lex->current_select;
- if (!sl->add_table_to_list(lex->thd, $1,NULL,1,TL_IGNORE) ||
- !sl->add_table_to_list(lex->thd, $3,NULL,1,TL_IGNORE))
+ if (!sl->add_table_to_list(lex->thd, $1,NULL,TL_OPTION_UPDATING,
+ TL_IGNORE) ||
+ !sl->add_table_to_list(lex->thd, $3,NULL,TL_OPTION_UPDATING,
+ TL_IGNORE))
YYABORT;
};
@@ -1902,7 +1934,7 @@ expr_expr:
{ $$= new Item_date_add_interval($1,$4,$5,0); }
| expr '-' INTERVAL_SYM expr interval
{ $$= new Item_date_add_interval($1,$4,$5,1); }
- | expr COLLATE_SYM charset_name
+ | expr COLLATE_SYM collation_name
{ $$= new Item_func_set_collation($1,$3); };
/* expressions that begin with 'expr' that do NOT follow IN_SYM */
@@ -2513,12 +2545,14 @@ join_table:
{
SELECT_LEX *sel= Select->select_lex();
sel->use_index_ptr=sel->ignore_index_ptr=0;
+ sel->table_join_options= 0;
}
table_ident opt_table_alias opt_key_definition
{
LEX *lex= Lex;
SELECT_LEX_NODE *sel= lex->current_select;
- if (!($$= sel->add_table_to_list(lex->thd, $2, $3, 0,
+ if (!($$= sel->add_table_to_list(lex->thd, $2, $3,
+ sel->get_table_join_options(),
lex->lock_option,
sel->get_use_index(),
sel->get_ignore_index())))
@@ -2543,6 +2577,12 @@ select_derived:
{
LEX *lex= Lex;
lex->derived_tables= 1;
+ if (((int)lex->sql_command >= (int)SQLCOM_HA_OPEN &&
+ lex->sql_command <= (int)SQLCOM_HA_READ) || lex->sql_command == (int)SQLCOM_KILL)
+ {
+ send_error(lex->thd, ER_SYNTAX_ERROR);
+ YYABORT;
+ }
if (lex->current_select->linkage == GLOBAL_OPTIONS_TYPE ||
mysql_new_select(lex, 1))
YYABORT;
@@ -2564,6 +2604,13 @@ opt_key_definition:
sel->use_index= *$2;
sel->use_index_ptr= &sel->use_index;
}
+ | FORCE_SYM key_usage_list
+ {
+ SELECT_LEX *sel= Select->select_lex();
+ sel->use_index= *$2;
+ sel->use_index_ptr= &sel->use_index;
+ sel->table_join_options|= TL_OPTION_FORCE_INDEX;
+ }
| IGNORE_SYM key_usage_list
{
SELECT_LEX *sel= Select->select_lex();
@@ -2573,8 +2620,14 @@ opt_key_definition:
key_usage_list:
key_or_index { Select->select_lex()->interval_list.empty(); }
- '(' key_usage_list2 ')'
- { $$= &Select->select_lex()->interval_list; };
+ '(' key_list_or_empty ')'
+ { $$= &Select->select_lex()->interval_list; }
+ ;
+
+key_list_or_empty:
+ /* empty */ {}
+ | key_usage_list2 {}
+ ;
key_usage_list2:
key_usage_list2 ',' ident
@@ -2935,7 +2988,8 @@ drop:
lex->drop_list.empty();
lex->drop_list.push_back(new Alter_drop(Alter_drop::KEY,
$3.str));
- if (!lex->current_select->add_table_to_list(lex->thd, $5,NULL, 1))
+ if (!lex->current_select->add_table_to_list(lex->thd, $5, NULL,
+ TL_OPTION_UPDATING))
YYABORT;
}
| DROP DATABASE if_exists ident
@@ -2959,7 +3013,11 @@ table_list:
table_name:
table_ident
- { if (!Select->add_table_to_list(YYTHD, $1, NULL, 1)) YYABORT; };
+ {
+ if (!Select->add_table_to_list(YYTHD, $1, NULL, TL_OPTION_UPDATING))
+ YYABORT;
+ }
+ ;
if_exists:
/* empty */ { $$= 0; }
@@ -3194,7 +3252,8 @@ delete:
single_multi:
FROM table_ident
{
- if (!Select->add_table_to_list(YYTHD, $2, NULL, 1, Lex->lock_option))
+ if (!Select->add_table_to_list(YYTHD, $2, NULL, TL_OPTION_UPDATING,
+ Lex->lock_option))
YYABORT;
}
where_clause opt_order_clause
@@ -3215,14 +3274,15 @@ table_wild_list:
table_wild_one:
ident opt_wild opt_table_alias
{
- if (!Select->add_table_to_list(YYTHD, new Table_ident($1), $3, 1,
- Lex->lock_option))
+ if (!Select->add_table_to_list(YYTHD, new Table_ident($1), $3,
+ TL_OPTION_UPDATING, Lex->lock_option))
YYABORT;
}
| ident '.' ident opt_wild opt_table_alias
{
if (!Select->add_table_to_list(YYTHD, new Table_ident($1, $3, 0),
- $5, 1, Lex->lock_option))
+ $5, TL_OPTION_UPDATING,
+ Lex->lock_option))
YYABORT;
}
;
@@ -3386,7 +3446,7 @@ show_param:
| CREATE TABLE_SYM table_ident
{
Lex->sql_command = SQLCOM_SHOW_CREATE;
- if(!Select->add_table_to_list(YYTHD, $3, NULL,0))
+ if (!Select->add_table_to_list(YYTHD, $3, NULL,0))
YYABORT;
}
| MASTER_SYM STATUS_SYM
@@ -3522,7 +3582,7 @@ kill:
KILL_SYM expr
{
LEX *lex=Lex;
- if ($2->check_cols(1) || $2->fix_fields(lex->thd, 0, &$2))
+ if ($2->fix_fields(lex->thd, 0, &$2) || $2->check_cols(1))
{
send_error(lex->thd, ER_SET_CONSTANTS_ONLY);
YYABORT;
@@ -3555,14 +3615,14 @@ load: LOAD DATA_SYM load_data_lock opt_local INFILE TEXT_STRING
opt_duplicate INTO TABLE_SYM table_ident opt_field_term opt_line_term
opt_ignore_lines opt_field_spec
{
- if (!Select->add_table_to_list(YYTHD, $11, NULL, 1))
+ if (!Select->add_table_to_list(YYTHD, $11, NULL, TL_OPTION_UPDATING))
YYABORT;
}
|
LOAD TABLE_SYM table_ident FROM MASTER_SYM
{
Lex->sql_command = SQLCOM_LOAD_MASTER_TABLE;
- if (!Select->add_table_to_list(YYTHD, $3, NULL, 1))
+ if (!Select->add_table_to_list(YYTHD, $3, NULL, TL_OPTION_UPDATING))
YYABORT;
}
@@ -3692,17 +3752,41 @@ simple_ident:
}
| ident '.' ident
{
- SELECT_LEX_NODE *sel=Select;
+ THD *thd= YYTHD;
+ LEX *lex= &thd->lex;
+ SELECT_LEX_NODE *sel= lex->current_select;
+ if (sel->no_table_names_allowed)
+ {
+ my_printf_error(ER_TABLENAME_NOT_ALLOWED_HERE,
+ ER(ER_TABLENAME_NOT_ALLOWED_HERE),
+ MYF(0), $1.str, thd->where);
+ }
$$ = !sel->create_refs || sel->get_in_sum_expr() > 0 ? (Item*) new Item_field(NullS,$1.str,$3.str) : (Item*) new Item_ref(NullS,$1.str,$3.str);
}
| '.' ident '.' ident
{
- SELECT_LEX_NODE *sel=Select;
+ THD *thd= YYTHD;
+ LEX *lex= &thd->lex;
+ SELECT_LEX_NODE *sel= lex->current_select;
+ if (sel->no_table_names_allowed)
+ {
+ my_printf_error(ER_TABLENAME_NOT_ALLOWED_HERE,
+ ER(ER_TABLENAME_NOT_ALLOWED_HERE),
+ MYF(0), $2.str, thd->where);
+ }
$$ = !sel->create_refs || sel->get_in_sum_expr() > 0 ? (Item*) new Item_field(NullS,$2.str,$4.str) : (Item*) new Item_ref(NullS,$2.str,$4.str);
}
| ident '.' ident '.' ident
{
- SELECT_LEX_NODE *sel=Select;
+ THD *thd= YYTHD;
+ LEX *lex= &thd->lex;
+ SELECT_LEX_NODE *sel= lex->current_select;
+ if (sel->no_table_names_allowed)
+ {
+ my_printf_error(ER_TABLENAME_NOT_ALLOWED_HERE,
+ ER(ER_TABLENAME_NOT_ALLOWED_HERE),
+ MYF(0), $3.str, thd->where);
+ }
$$ = !sel->create_refs || sel->get_in_sum_expr() > 0 ? (Item*) new Item_field((YYTHD->client_capabilities & CLIENT_NO_SCHEMA ? NullS :$1.str),$3.str,$5.str) : (Item*) new Item_ref((YYTHD->client_capabilities & CLIENT_NO_SCHEMA ? NullS :$1.str),$3.str,$5.str);
};
@@ -4034,7 +4118,8 @@ text_or_password:
else
{
char *buff=(char*) YYTHD->alloc(HASH_PASSWORD_LENGTH+1);
- make_scrambled_password(buff,$3.str,opt_old_passwords,&current_thd->rand);
+ make_scrambled_password(buff,$3.str,use_old_passwords,
+ &YYTHD->rand);
$$=buff;
}
}
@@ -4336,7 +4421,8 @@ grant_user:
char *buff=(char*) YYTHD->alloc(HASH_PASSWORD_LENGTH+1);
if (buff)
{
- make_scrambled_password(buff,$4.str,opt_old_passwords,&current_thd->rand);
+ make_scrambled_password(buff,$4.str,use_old_passwords,
+ &YYTHD->rand);
$1->password.str=buff;
$1->password.length=HASH_PASSWORD_LENGTH;
}
@@ -4487,7 +4573,8 @@ optional_order_or_limit:
/* Empty */ {}
|
{
- LEX *lex=Lex;
+ THD *thd= YYTHD;
+ LEX *lex= &thd->lex;
if (!lex->current_select->linkage == GLOBAL_OPTIONS_TYPE)
{
send_error(lex->thd, ER_SYNTAX_ERROR);
@@ -4499,8 +4586,15 @@ optional_order_or_limit:
lex->current_select= sel->master_unit();
lex->current_select->select_limit=
lex->thd->variables.select_limit;
+ lex->current_select->no_table_names_allowed= 1;
+ thd->where= "global ORDER clause";
}
order_or_limit
+ {
+ THD *thd= YYTHD;
+ thd->lex.current_select->no_table_names_allowed= 0;
+ thd->where= "";
+ }
;
order_or_limit:
@@ -4559,6 +4653,12 @@ in_subselect_init:
subselect_start:
'(' SELECT_SYM
{
+ LEX *lex=Lex;
+ if (((int)lex->sql_command >= (int)SQLCOM_HA_OPEN &&
+ lex->sql_command <= (int)SQLCOM_HA_READ) || lex->sql_command == (int)SQLCOM_KILL) {
+ send_error(lex->thd, ER_SYNTAX_ERROR);
+ YYABORT;
+ }
if (mysql_new_select(Lex, 1))
YYABORT;
};
diff --git a/sql/structs.h b/sql/structs.h
index 604be6fcc6e..59b9335a5c4 100644
--- a/sql/structs.h
+++ b/sql/structs.h
@@ -130,7 +130,7 @@ enum SHOW_TYPE
SHOW_UNDEF,
SHOW_LONG, SHOW_LONGLONG, SHOW_INT, SHOW_CHAR, SHOW_CHAR_PTR, SHOW_BOOL,
SHOW_MY_BOOL, SHOW_OPENTABLES, SHOW_STARTTIME, SHOW_QUESTION,
- SHOW_LONG_CONST, SHOW_INT_CONST, SHOW_HAVE, SHOW_SYS,
+ SHOW_LONG_CONST, SHOW_INT_CONST, SHOW_HAVE, SHOW_SYS, SHOW_HA_ROWS,
#ifdef HAVE_OPENSSL
SHOW_SSL_CTX_SESS_ACCEPT, SHOW_SSL_CTX_SESS_ACCEPT_GOOD,
SHOW_SSL_GET_VERSION, SHOW_SSL_CTX_GET_SESSION_CACHE_MODE,
diff --git a/sql/table.cc b/sql/table.cc
index f6dbaaf3584..57a0831bf2e 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -146,7 +146,7 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag,
bzero((char*) keyinfo,n_length);
outparam->key_info=keyinfo;
outparam->max_key_length= outparam->total_key_length= 0;
- key_part= (KEY_PART_INFO*) (keyinfo+keys);
+ key_part= my_reinterpret_cast(KEY_PART_INFO*) (keyinfo+keys);
strpos=disk_buff+6;
ulong *rec_per_key;
diff --git a/sql/table.h b/sql/table.h
index dedad37f6c6..ceffdcc9dc7 100644
--- a/sql/table.h
+++ b/sql/table.h
@@ -91,6 +91,7 @@ struct st_table {
my_bool copy_blobs; /* copy_blobs when storing */
my_bool null_row; /* All columns are null */
my_bool maybe_null,outer_join; /* Used with OUTER JOIN */
+ my_bool force_index;
my_bool distinct,const_table,no_rows;
my_bool key_read, bulk_insert;
my_bool crypted;
@@ -169,6 +170,7 @@ typedef struct st_table_list
bool straight; /* optimize with prev table */
bool updating; /* for replicate-do/ignore table */
bool do_redirect; /* To get the struct in UNION's */
+ bool force_index; /* Prefer index over table scan */
} TABLE_LIST;
typedef struct st_changed_table_list