Commit 3e679de2 authored by unknown's avatar unknown

Merge sanja.is.com.ua:/home/bell/mysql/mysql-4.1

into sanja.is.com.ua:/home/bell/mysql/work-select-4.1
parents 71bfb282 9248c03e
...@@ -309,9 +309,6 @@ ...@@ -309,9 +309,6 @@
/* Use MySQL RAID */ /* Use MySQL RAID */
#undef USE_RAID #undef USE_RAID
/* Use strcoll() functions when comparing and sorting. */
#undef USE_STRCOLL
/* Program version */ /* Program version */
#undef VERSION #undef VERSION
......
...@@ -576,7 +576,6 @@ int sortcmp(const String *x,const String *y) ...@@ -576,7 +576,6 @@ int sortcmp(const String *x,const String *y)
const char *t= y->ptr(); const char *t= y->ptr();
uint32 x_len=x->length(),y_len=y->length(),len=min(x_len,y_len); uint32 x_len=x->length(),y_len=y->length(),len=min(x_len,y_len);
#ifdef USE_STRCOLL
if (use_strnxfrm(x->str_charset)) if (use_strnxfrm(x->str_charset))
{ {
#ifndef CMP_ENDSPACE #ifndef CMP_ENDSPACE
...@@ -590,7 +589,6 @@ int sortcmp(const String *x,const String *y) ...@@ -590,7 +589,6 @@ int sortcmp(const String *x,const String *y)
} }
else else
{ {
#endif /* USE_STRCOLL */
x_len-=len; // For easy end space test x_len-=len; // For easy end space test
y_len-=len; y_len-=len;
if (x->str_charset->sort_order) if (x->str_charset->sort_order)
...@@ -633,9 +631,7 @@ int sortcmp(const String *x,const String *y) ...@@ -633,9 +631,7 @@ int sortcmp(const String *x,const String *y)
#else #else
return (int) (x_len-y_len); return (int) (x_len-y_len);
#endif /* CMP_ENDSPACE */ #endif /* CMP_ENDSPACE */
#ifdef USE_STRCOLL
} }
#endif
} }
......
...@@ -2256,9 +2256,6 @@ then ...@@ -2256,9 +2256,6 @@ then
AC_DEFINE(USE_MB_IDENT) AC_DEFINE(USE_MB_IDENT)
fi fi
# Temporary hack for USE_STRCOLL
AC_DEFINE(USE_STRCOLL)
AC_SUBST(default_charset) AC_SUBST(default_charset)
AC_DEFINE_UNQUOTED(DEFAULT_CHARSET_NAME,"$default_charset") AC_DEFINE_UNQUOTED(DEFAULT_CHARSET_NAME,"$default_charset")
......
...@@ -53,9 +53,7 @@ uint _nisam_make_key(register N_INFO *info, uint keynr, uchar *key, const char * ...@@ -53,9 +53,7 @@ uint _nisam_make_key(register N_INFO *info, uint keynr, uchar *key, const char *
} }
*key++= (uchar) (length=(uint) (end-pos)); *key++= (uchar) (length=(uint) (end-pos));
memcpy((byte*) key,(byte*) pos,(size_t) length); memcpy((byte*) key,(byte*) pos,(size_t) length);
#ifdef USE_STRCOLL
if (!use_strnxfrm(default_charset_info)) if (!use_strnxfrm(default_charset_info))
#endif
{ {
if (type == HA_KEYTYPE_TEXT) if (type == HA_KEYTYPE_TEXT)
my_tosort(default_charset_info,(byte*) key,length); my_tosort(default_charset_info,(byte*) key,length);
...@@ -66,9 +64,7 @@ uint _nisam_make_key(register N_INFO *info, uint keynr, uchar *key, const char * ...@@ -66,9 +64,7 @@ uint _nisam_make_key(register N_INFO *info, uint keynr, uchar *key, const char *
{ {
memcpy((byte*) key,(byte*) record+keyseg->base.start, memcpy((byte*) key,(byte*) record+keyseg->base.start,
(size_t) keyseg->base.length); (size_t) keyseg->base.length);
#ifdef USE_STRCOLL
if (!use_strnxfrm(default_charset_info)) if (!use_strnxfrm(default_charset_info))
#endif
{ {
if (type == HA_KEYTYPE_TEXT) if (type == HA_KEYTYPE_TEXT)
my_tosort(default_charset_info,(byte*) key,(uint) keyseg->base.length); my_tosort(default_charset_info,(byte*) key,(uint) keyseg->base.length);
...@@ -149,9 +145,7 @@ uint _nisam_pack_key(register N_INFO *info, uint keynr, uchar *key, uchar *old, ...@@ -149,9 +145,7 @@ uint _nisam_pack_key(register N_INFO *info, uint keynr, uchar *key, uchar *old,
} }
else else
memcpy((byte*) key,old,(size_t) length); memcpy((byte*) key,old,(size_t) length);
#ifdef USE_STRCOLL
if (!use_strnxfrm(default_charset_info)) if (!use_strnxfrm(default_charset_info))
#endif
{ {
if (type == HA_KEYTYPE_TEXT) if (type == HA_KEYTYPE_TEXT)
my_tosort(default_charset_info,(byte*) key,length); my_tosort(default_charset_info,(byte*) key,length);
......
...@@ -331,7 +331,6 @@ int _nisam_key_cmp(register N_KEYSEG *keyseg, register uchar *a, register uchar ...@@ -331,7 +331,6 @@ int _nisam_key_cmp(register N_KEYSEG *keyseg, register uchar *a, register uchar
(int) *as : b_length; (int) *as : b_length;
end= a+ min(key_length,(uint) length); end= a+ min(key_length,(uint) length);
#ifdef USE_STRCOLL
if (use_strnxfrm(default_charset_info)) { if (use_strnxfrm(default_charset_info)) {
if (((enum ha_base_keytype) keyseg->base.type) == HA_KEYTYPE_BINARY) if (((enum ha_base_keytype) keyseg->base.type) == HA_KEYTYPE_BINARY)
{ {
...@@ -349,7 +348,6 @@ int _nisam_key_cmp(register N_KEYSEG *keyseg, register uchar *a, register uchar ...@@ -349,7 +348,6 @@ int _nisam_key_cmp(register N_KEYSEG *keyseg, register uchar *a, register uchar
} }
} }
else else
#endif
{ {
while (a < end) while (a < end)
if ((flag= (int) *a++ - (int) *b++)) if ((flag= (int) *a++ - (int) *b++))
...@@ -382,7 +380,6 @@ int _nisam_key_cmp(register N_KEYSEG *keyseg, register uchar *a, register uchar ...@@ -382,7 +380,6 @@ int _nisam_key_cmp(register N_KEYSEG *keyseg, register uchar *a, register uchar
} }
else else
{ {
#ifdef USE_STRCOLL
if (use_strnxfrm(default_charset_info)) { if (use_strnxfrm(default_charset_info)) {
if (((enum ha_base_keytype) keyseg->base.type) == HA_KEYTYPE_BINARY) if (((enum ha_base_keytype) keyseg->base.type) == HA_KEYTYPE_BINARY)
{ {
...@@ -400,7 +397,6 @@ int _nisam_key_cmp(register N_KEYSEG *keyseg, register uchar *a, register uchar ...@@ -400,7 +397,6 @@ int _nisam_key_cmp(register N_KEYSEG *keyseg, register uchar *a, register uchar
} }
} }
else else
#endif
{ {
while (a < end) while (a < end)
if ((flag= (int) *a++ - (int) *b++)) if ((flag= (int) *a++ - (int) *b++))
......
...@@ -123,11 +123,9 @@ ha_rows filesort(THD *thd, TABLE *table, SORT_FIELD *sortorder, uint s_length, ...@@ -123,11 +123,9 @@ ha_rows filesort(THD *thd, TABLE *table, SORT_FIELD *sortorder, uint s_length,
if (param.sort_length == param.ref_length && records > param.max_rows) if (param.sort_length == param.ref_length && records > param.max_rows)
records=param.max_rows; /* purecov: inspected */ records=param.max_rows; /* purecov: inspected */
#ifdef USE_STRCOLL
if (use_strnxfrm(charset) && if (use_strnxfrm(charset) &&
!(param.tmp_buffer=my_malloc(param.sort_length,MYF(MY_WME)))) !(param.tmp_buffer=my_malloc(param.sort_length,MYF(MY_WME))))
goto err; goto err;
#endif
memavl= thd->variables.sortbuff_size; memavl= thd->variables.sortbuff_size;
while (memavl >= MIN_SORT_MEMORY) while (memavl >= MIN_SORT_MEMORY)
...@@ -200,10 +198,8 @@ ha_rows filesort(THD *thd, TABLE *table, SORT_FIELD *sortorder, uint s_length, ...@@ -200,10 +198,8 @@ ha_rows filesort(THD *thd, TABLE *table, SORT_FIELD *sortorder, uint s_length,
error =0; error =0;
err: err:
#ifdef USE_STRCOLL
if (param.tmp_buffer) if (param.tmp_buffer)
x_free(param.tmp_buffer); x_free(param.tmp_buffer);
#endif
x_free((gptr) sort_keys); x_free((gptr) sort_keys);
x_free((gptr) buffpek); x_free((gptr) buffpek);
close_cached_file(&tempfile); close_cached_file(&tempfile);
...@@ -494,7 +490,6 @@ static void make_sortkey(register SORTPARAM *param, ...@@ -494,7 +490,6 @@ static void make_sortkey(register SORTPARAM *param,
diff=0; /* purecov: inspected */ diff=0; /* purecov: inspected */
length=sort_field->length; length=sort_field->length;
} }
#ifdef USE_STRCOLL
if (use_strnxfrm(cs)) if (use_strnxfrm(cs))
{ {
if (item->binary()) if (item->binary())
...@@ -520,15 +515,12 @@ static void make_sortkey(register SORTPARAM *param, ...@@ -520,15 +515,12 @@ static void make_sortkey(register SORTPARAM *param,
} }
else else
{ {
#endif
if (res->ptr() != (char*) to) if (res->ptr() != (char*) to)
memcpy(to,res->ptr(),length); memcpy(to,res->ptr(),length);
bzero((char *)to+length,diff); bzero((char *)to+length,diff);
if (!item->binary()) if (!item->binary())
my_tosort(cs, (char*) to,length); my_tosort(cs, (char*) to,length);
#ifdef USE_STRCOLL
} }
#endif
break; break;
} }
case INT_RESULT: case INT_RESULT:
...@@ -930,34 +922,27 @@ sortlength(SORT_FIELD *sortorder, uint s_length) ...@@ -930,34 +922,27 @@ sortlength(SORT_FIELD *sortorder, uint s_length)
else else
{ {
sortorder->length=sortorder->field->pack_length(); sortorder->length=sortorder->field->pack_length();
#ifdef USE_STRCOLL
if (!sortorder->field->binary()) if (!sortorder->field->binary())
{ {
CHARSET_INFO *cs=sortorder->field->charset(); CHARSET_INFO *cs=sortorder->field->charset();
if (use_strnxfrm(cs)) if (use_strnxfrm(cs))
sortorder->length= sortorder->length*cs->strxfrm_multiply; sortorder->length= sortorder->length*cs->strxfrm_multiply;
} }
#endif
} }
if (sortorder->field->maybe_null()) if (sortorder->field->maybe_null())
length++; // Place for NULL marker length++; // Place for NULL marker
} }
else else
{ {
#ifdef USE_STRCOLL
#endif
switch ((sortorder->result_type=sortorder->item->result_type())) { switch ((sortorder->result_type=sortorder->item->result_type())) {
case STRING_RESULT: case STRING_RESULT:
sortorder->length=sortorder->item->max_length; sortorder->length=sortorder->item->max_length;
#ifdef USE_STRCOLL
if (!sortorder->item->binary()) if (!sortorder->item->binary())
{ {
CHARSET_INFO *cs=sortorder->item->charset(); CHARSET_INFO *cs=sortorder->item->charset();
if (use_strnxfrm(cs)) if (use_strnxfrm(cs))
sortorder->length= sortorder->length*cs->strxfrm_multiply; sortorder->length= sortorder->length*cs->strxfrm_multiply;
} }
#endif
break; break;
case INT_RESULT: case INT_RESULT:
#if SIZEOF_LONG_LONG > 4 #if SIZEOF_LONG_LONG > 4
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<charsets> <charsets>
<charset name=""> <charset name="cp1256">
<ctype> <ctype>
<map> <map>
......
...@@ -2476,7 +2476,9 @@ TABLE_COUNTER_TYPE Query_cache::is_cacheable(THD *thd, uint32 query_len, ...@@ -2476,7 +2476,9 @@ TABLE_COUNTER_TYPE Query_cache::is_cacheable(THD *thd, uint32 query_len,
(tables_used->db_length == 5 && (tables_used->db_length == 5 &&
#ifdef FN_NO_CASE_SENCE #ifdef FN_NO_CASE_SENCE
// TODO: latin1 charset should be replaced with system charset // TODO: latin1 charset should be replaced with system charset
my_strncasecmp(my_charset_latin1,tables_used->db,"mysql",5) == 0 my_strncasecmp(&my_charset_latin1,
tables_used->db,
"mysql",5) == 0
#else #else
tables_used->db[0]=='m' && tables_used->db[0]=='m' &&
tables_used->db[1]=='y' && tables_used->db[1]=='y' &&
......
...@@ -38,9 +38,7 @@ typedef struct st_sort_param { ...@@ -38,9 +38,7 @@ typedef struct st_sort_param {
SORT_FIELD *end; SORT_FIELD *end;
uchar *unique_buff; uchar *unique_buff;
bool not_killable; bool not_killable;
#ifdef USE_STRCOLL
char* tmp_buffer; char* tmp_buffer;
#endif
} SORTPARAM; } SORTPARAM;
......
...@@ -577,7 +577,6 @@ int sortcmp(const String *x,const String *y) ...@@ -577,7 +577,6 @@ int sortcmp(const String *x,const String *y)
const char *t= y->ptr(); const char *t= y->ptr();
uint32 x_len=x->length(),y_len=y->length(),len=min(x_len,y_len); uint32 x_len=x->length(),y_len=y->length(),len=min(x_len,y_len);
#ifdef USE_STRCOLL
if (use_strnxfrm(x->str_charset)) if (use_strnxfrm(x->str_charset))
{ {
#ifndef CMP_ENDSPACE #ifndef CMP_ENDSPACE
...@@ -591,7 +590,6 @@ int sortcmp(const String *x,const String *y) ...@@ -591,7 +590,6 @@ int sortcmp(const String *x,const String *y)
} }
else else
{ {
#endif /* USE_STRCOLL */
x_len-=len; // For easy end space test x_len-=len; // For easy end space test
y_len-=len; y_len-=len;
if (x->str_charset->sort_order) if (x->str_charset->sort_order)
...@@ -634,9 +632,7 @@ int sortcmp(const String *x,const String *y) ...@@ -634,9 +632,7 @@ int sortcmp(const String *x,const String *y)
#else #else
return (int) (x_len-y_len); return (int) (x_len-y_len);
#endif /* CMP_ENDSPACE */ #endif /* CMP_ENDSPACE */
#ifdef USE_STRCOLL
} }
#endif
} }
......
...@@ -25,12 +25,9 @@ ...@@ -25,12 +25,9 @@
#include <m_ctype.h> #include <m_ctype.h>
#include <my_xml.h> #include <my_xml.h>
#define CHARSETS_SUBDIR "sql/share/charsets"
#define CTYPE_TABLE_SIZE 257
#define TO_LOWER_TABLE_SIZE 256
#define TO_UPPER_TABLE_SIZE 256
#define SORT_ORDER_TABLE_SIZE 256
#define ROW_LEN 16
#define ROW16_LEN 8
#define MAX_BUF 16*1024 #define MAX_BUF 16*1024
static CHARSET_INFO all_charsets[256]; static CHARSET_INFO all_charsets[256];
...@@ -45,12 +42,30 @@ print_array(FILE *f, const char *set, const char *name, uchar *a, int n) ...@@ -45,12 +42,30 @@ print_array(FILE *f, const char *set, const char *name, uchar *a, int n)
for (i=0 ;i<n ; i++) for (i=0 ;i<n ; i++)
{ {
fprintf(f,"0x%02X%s%s",a[i], (i+1<n) ? "," :"", i % 16 ? "" : "\n"); fprintf(f,"0x%02X",a[i]);
fprintf(f, (i+1<n) ? "," :"" );
fprintf(f, ((i+1) % ROW_LEN == n % ROW_LEN) ? "\n" : "" );
} }
fprintf(f,"};\n\n"); fprintf(f,"};\n\n");
} }
void
print_array16(FILE *f, const char *set, const char *name, uint16 *a, int n)
{
int i;
fprintf(f,"uchar %s_%s[] = {\n", name, set);
for (i=0 ;i<n ; i++)
{
fprintf(f,"0x%04X",a[i]);
fprintf(f, (i+1<n) ? "," :"" );
fprintf(f, ((i+1) % ROW16_LEN == n % ROW16_LEN) ? "\n" : "" );
}
fprintf(f,"};\n\n");
}
static int get_charset_number(const char *charset_name) static int get_charset_number(const char *charset_name)
{ {
...@@ -261,10 +276,13 @@ main(int argc, char **argv __attribute__((unused))) ...@@ -261,10 +276,13 @@ main(int argc, char **argv __attribute__((unused)))
{ {
if (simple_cs_is_full(cs)) if (simple_cs_is_full(cs))
{ {
print_array(f, cs->name, "ctype", cs->ctype, CTYPE_TABLE_SIZE); fprintf(f,"#ifdef HAVE_CHARSET_%s\n",cs->csname);
print_array(f, cs->name, "to_lower", cs->to_lower, TO_LOWER_TABLE_SIZE); print_array(f, cs->name, "ctype", cs->ctype, MY_CS_CTYPE_TABLE_SIZE);
print_array(f, cs->name, "to_upper", cs->to_upper, TO_UPPER_TABLE_SIZE); print_array(f, cs->name, "to_lower", cs->to_lower, MY_CS_TO_LOWER_TABLE_SIZE);
print_array(f, cs->name, "sort_order", cs->sort_order, SORT_ORDER_TABLE_SIZE); print_array(f, cs->name, "to_upper", cs->to_upper, MY_CS_TO_UPPER_TABLE_SIZE);
print_array(f, cs->name, "sort_order", cs->sort_order, MY_CS_SORT_ORDER_TABLE_SIZE);
print_array16(f, cs->name, "to_uni", cs->tab_to_uni, MY_CS_TO_UNI_TABLE_SIZE);
fprintf(f,"#endif\n");
fprintf(f,"\n"); fprintf(f,"\n");
} }
} }
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
#include "m_ctype.h" #include "m_ctype.h"
static uint16 latin1_uni[256]={ static my_wc_t latin1_uni[256]={
0,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, 0,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007,
0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F, 0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F,
0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017, 0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017,
...@@ -72,12 +72,6 @@ static uchar uni_latin1[]={ ...@@ -72,12 +72,6 @@ static uchar uni_latin1[]={
0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, 0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF,
0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF}; 0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF};
static MY_UNI_IDX idx_uni_latin1[]={
{0x0000,0x00FF,uni_latin1},
{0,0,NULL}
};
static uchar ctype_latin1[] = { static uchar ctype_latin1[] = {
0, 0,
32, 32, 32, 32, 32, 32, 32, 32, 32, 40, 40, 40, 40, 40, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 40, 40, 40, 40, 40, 32, 32,
...@@ -156,6 +150,31 @@ static uchar sort_order_latin1[] = { ...@@ -156,6 +150,31 @@ static uchar sort_order_latin1[] = {
}; };
static
int my_mb_wc_latin1(CHARSET_INFO *cs __attribute__((unused)),
my_wc_t *wc,
const unsigned char *str,
const unsigned char *end)
{
if (str >= end)
return MY_CS_TOOFEW(0);
return ((wc[0]= latin1_uni[*str]) || (!str[0])) ? 1 : MY_CS_ILSEQ;
}
static
int my_wc_mb_latin1(CHARSET_INFO *cs __attribute__((unused)),
my_wc_t wc,
unsigned char *str,
unsigned char *end)
{
if (str >= end)
return MY_CS_TOOSMALL;
return ((wc < 256) && ((str[0]=uni_latin1[wc]) || (!wc))) ? 1 : MY_CS_ILUNI;
}
CHARSET_INFO my_charset_latin1 = CHARSET_INFO my_charset_latin1 =
{ {
8, /* number */ 8, /* number */
...@@ -167,8 +186,8 @@ CHARSET_INFO my_charset_latin1 = ...@@ -167,8 +186,8 @@ CHARSET_INFO my_charset_latin1 =
to_lower_latin1, to_lower_latin1,
to_upper_latin1, to_upper_latin1,
sort_order_latin1, sort_order_latin1,
latin1_uni, /* tab_to_uni */ NULL, /* tab_to_uni */
idx_uni_latin1, /* tab_from_uni */ NULL, /* tab_from_uni */
2, /* strxfrm_multiply */ 2, /* strxfrm_multiply */
my_strnncoll_simple, my_strnncoll_simple,
my_strnxfrm_simple, my_strnxfrm_simple,
...@@ -178,8 +197,8 @@ CHARSET_INFO my_charset_latin1 = ...@@ -178,8 +197,8 @@ CHARSET_INFO my_charset_latin1 =
NULL, /* ismbchar */ NULL, /* ismbchar */
NULL, /* ismbhead */ NULL, /* ismbhead */
NULL, /* mbcharlen */ NULL, /* mbcharlen */
my_mb_wc_8bit, /* mb_wc */ my_mb_wc_latin1, /* mb_wc */
my_wc_mb_8bit, /* wc_mb */ my_wc_mb_latin1, /* wc_mb */
my_caseup_str_8bit, my_caseup_str_8bit,
my_casedn_str_8bit, my_casedn_str_8bit,
my_caseup_8bit, my_caseup_8bit,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment