Commit c1017541 authored by bar@bar.mysql.r18.ru's avatar bar@bar.mysql.r18.ru

Merge abarkov@work.mysql.com:/home/bk/mysql-4.1

into bar.mysql.r18.ru:/usr/home/bar/mysql-4.1.wrk
parents 8bb19fac bca773e6
......@@ -118,6 +118,7 @@ typedef struct charset_info_st
extern CHARSET_INFO *my_charset_bin;
extern CHARSET_INFO *my_charset_latin1;
extern CHARSET_INFO *default_charset_info;
extern CHARSET_INFO *system_charset_info;
extern CHARSET_INFO *all_charsets[256];
......
......@@ -5283,19 +5283,19 @@ Field *make_field(char *ptr, uint32 field_length,
unireg_check, field_name, table);
case FIELD_TYPE_DATE:
return new Field_date(ptr,null_pos,null_bit,
unireg_check, field_name, table);
unireg_check, field_name, table, field_charset);
case FIELD_TYPE_NEWDATE:
return new Field_newdate(ptr,null_pos,null_bit,
unireg_check, field_name, table);
unireg_check, field_name, table, field_charset);
case FIELD_TYPE_TIME:
return new Field_time(ptr,null_pos,null_bit,
unireg_check, field_name, table);
unireg_check, field_name, table, field_charset);
case FIELD_TYPE_DATETIME:
return new Field_datetime(ptr,null_pos,null_bit,
unireg_check, field_name, table);
unireg_check, field_name, table, field_charset);
case FIELD_TYPE_NULL:
default: // Impossible (Wrong version)
return new Field_null(ptr,field_length,unireg_check,field_name,table);
return new Field_null(ptr,field_length,unireg_check,field_name,table, field_charset);
}
return 0; // Impossible (Wrong version)
}
......
......@@ -528,9 +528,9 @@ class Field_null :public Field_str {
public:
Field_null(char *ptr_arg, uint32 len_arg,
enum utype unireg_check_arg, const char *field_name_arg,
struct st_table *table_arg)
struct st_table *table_arg, CHARSET_INFO *cs)
:Field_str(ptr_arg, len_arg, null, 1,
unireg_check_arg, field_name_arg, table_arg, default_charset_info)
unireg_check_arg, field_name_arg, table_arg, cs)
{}
enum_field_types type() const { return FIELD_TYPE_NULL;}
int store(const char *to, uint length, CHARSET_INFO *cs) { null[0]=1; return 0; }
......@@ -544,7 +544,7 @@ class Field_null :public Field_str {
int cmp(const char *a, const char *b) { return 0;}
void sort_string(char *buff, uint length) {}
uint32 pack_length() const { return 0; }
void sql_type(String &str) const { str.set("null",4,default_charset_info); }
void sql_type(String &str) const { str.set("null",4,my_thd_charset); }
uint size_of() const { return sizeof(*this); }
};
......@@ -615,14 +615,14 @@ class Field_date :public Field_str {
public:
Field_date(char *ptr_arg, uchar *null_ptr_arg, uchar null_bit_arg,
enum utype unireg_check_arg, const char *field_name_arg,
struct st_table *table_arg)
struct st_table *table_arg, CHARSET_INFO *cs)
:Field_str(ptr_arg, 10, null_ptr_arg, null_bit_arg,
unireg_check_arg, field_name_arg, table_arg, default_charset_info)
unireg_check_arg, field_name_arg, table_arg, cs)
{}
Field_date(bool maybe_null_arg, const char *field_name_arg,
struct st_table *table_arg)
struct st_table *table_arg, CHARSET_INFO *cs)
:Field_str((char*) 0,10, maybe_null_arg ? (uchar*) "": 0,0,
NONE, field_name_arg, table_arg, default_charset_info) {}
NONE, field_name_arg, table_arg, cs) {}
enum_field_types type() const { return FIELD_TYPE_DATE;}
enum ha_base_keytype key_type() const { return HA_KEYTYPE_ULONG_INT; }
enum Item_result cmp_type () const { return INT_RESULT; }
......@@ -645,9 +645,9 @@ class Field_newdate :public Field_str {
public:
Field_newdate(char *ptr_arg, uchar *null_ptr_arg, uchar null_bit_arg,
enum utype unireg_check_arg, const char *field_name_arg,
struct st_table *table_arg)
struct st_table *table_arg, CHARSET_INFO *cs)
:Field_str(ptr_arg, 10, null_ptr_arg, null_bit_arg,
unireg_check_arg, field_name_arg, table_arg, default_charset_info)
unireg_check_arg, field_name_arg, table_arg, cs)
{}
enum_field_types type() const { return FIELD_TYPE_DATE;}
enum_field_types real_type() const { return FIELD_TYPE_NEWDATE; }
......@@ -676,14 +676,14 @@ class Field_time :public Field_str {
public:
Field_time(char *ptr_arg, uchar *null_ptr_arg, uchar null_bit_arg,
enum utype unireg_check_arg, const char *field_name_arg,
struct st_table *table_arg)
struct st_table *table_arg, CHARSET_INFO *cs)
:Field_str(ptr_arg, 8, null_ptr_arg, null_bit_arg,
unireg_check_arg, field_name_arg, table_arg, default_charset_info)
unireg_check_arg, field_name_arg, table_arg, cs)
{}
Field_time(bool maybe_null_arg, const char *field_name_arg,
struct st_table *table_arg)
struct st_table *table_arg, CHARSET_INFO *cs)
:Field_str((char*) 0,8, maybe_null_arg ? (uchar*) "": 0,0,
NONE, field_name_arg, table_arg, default_charset_info) {}
NONE, field_name_arg, table_arg, cs) {}
enum_field_types type() const { return FIELD_TYPE_TIME;}
enum ha_base_keytype key_type() const { return HA_KEYTYPE_INT24; }
enum Item_result cmp_type () const { return INT_RESULT; }
......@@ -708,14 +708,14 @@ class Field_datetime :public Field_str {
public:
Field_datetime(char *ptr_arg, uchar *null_ptr_arg, uchar null_bit_arg,
enum utype unireg_check_arg, const char *field_name_arg,
struct st_table *table_arg)
struct st_table *table_arg, CHARSET_INFO *cs)
:Field_str(ptr_arg, 19, null_ptr_arg, null_bit_arg,
unireg_check_arg, field_name_arg, table_arg, default_charset_info)
unireg_check_arg, field_name_arg, table_arg, cs)
{}
Field_datetime(bool maybe_null_arg, const char *field_name_arg,
struct st_table *table_arg)
struct st_table *table_arg, CHARSET_INFO *cs)
:Field_str((char*) 0,19, maybe_null_arg ? (uchar*) "": 0,0,
NONE, field_name_arg, table_arg, default_charset_info) {}
NONE, field_name_arg, table_arg, cs) {}
enum_field_types type() const { return FIELD_TYPE_DATETIME;}
#ifdef HAVE_LONG_LONG
enum ha_base_keytype key_type() const { return HA_KEYTYPE_ULONGLONG; }
......
......@@ -950,7 +950,7 @@ sortlength(SORT_FIELD *sortorder, uint s_length)
#ifdef USE_STRCOLL
if (!sortorder->item->binary())
{
CHARSET_INFO *cs=sortorder->item->str_value.charset();
CHARSET_INFO *cs=sortorder->item->charset();
if (use_strnxfrm(cs))
sortorder->length= sortorder->length*cs->strxfrm_multiply;
}
......
......@@ -228,11 +228,9 @@ Field *Item_func::tmp_table_field(TABLE *t_arg)
break;
case STRING_RESULT:
if (max_length > 255)
res= new Field_blob(max_length, maybe_null, name, t_arg,
str_value.charset());
res= new Field_blob(max_length, maybe_null, name, t_arg, charset());
else
res= new Field_string(max_length, maybe_null, name, t_arg,
str_value.charset());
res= new Field_string(max_length, maybe_null, name, t_arg, charset());
break;
}
return res;
......
......@@ -243,7 +243,7 @@ class Item_date :public Item_func
}
Field *tmp_table_field(TABLE *t_arg)
{
return (!t_arg) ? result_field : new Field_date(maybe_null, name, t_arg);
return (!t_arg) ? result_field : new Field_date(maybe_null, name, t_arg, my_thd_charset);
}
};
......@@ -261,7 +261,7 @@ class Item_date_func :public Item_str_func
Field *tmp_table_field(TABLE *t_arg)
{
return (!t_arg) ? result_field : new Field_datetime(maybe_null, name,
t_arg);
t_arg, my_thd_charset);
}
};
......@@ -287,7 +287,8 @@ class Item_func_curtime :public Item_func
}
Field *tmp_table_field(TABLE *t_arg)
{
return (!t_arg) ? result_field : new Field_time(maybe_null, name, t_arg);
return (!t_arg) ? result_field :
new Field_time(maybe_null, name, t_arg, my_thd_charset);
}
};
......@@ -379,7 +380,8 @@ class Item_func_sec_to_time :public Item_str_func
}
Field *tmp_table_field(TABLE *t_arg)
{
return (!t_arg) ? result_field : new Field_time(maybe_null, name, t_arg);
return (!t_arg) ? result_field :
new Field_time(maybe_null, name, t_arg, my_thd_charset);
}
};
......@@ -443,7 +445,8 @@ class Item_date_typecast :public Item_typecast
}
Field *tmp_table_field(TABLE *t_arg)
{
return (!t_arg) ? result_field : new Field_date(maybe_null, name, t_arg);
return (!t_arg) ? result_field :
new Field_date(maybe_null, name, t_arg, my_thd_charset);
}
};
......@@ -458,7 +461,8 @@ class Item_time_typecast :public Item_typecast
}
Field *tmp_table_field(TABLE *t_arg)
{
return (!t_arg) ? result_field : new Field_time(maybe_null, name, t_arg);
return (!t_arg) ? result_field :
new Field_time(maybe_null, name, t_arg, my_thd_charset);
}
};
......@@ -474,6 +478,6 @@ class Item_datetime_typecast :public Item_typecast
Field *tmp_table_field(TABLE *t_arg)
{
return (!t_arg) ? result_field : new Field_datetime(maybe_null, name,
t_arg);
t_arg, my_thd_charset);
}
};
......@@ -3624,9 +3624,9 @@ Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type,
case STRING_RESULT:
if (item_sum->max_length > 255)
return new Field_blob(item_sum->max_length,maybe_null,
item->name,table,item->str_value.charset());
item->name,table,item->charset());
return new Field_string(item_sum->max_length,maybe_null,
item->name,table,item->str_value.charset());
item->name,table,item->charset());
}
}
thd->fatal_error=1;
......
......@@ -20,6 +20,10 @@
#include <m_string.h>
#endif
#ifndef HAVE_CHARSET_latin1
#define HAVE_CHARSET_latin1
#endif
#if defined(HAVE_CHARSET_latin1)||defined(HAVE_CHARSET_latin1_de)||\
defined(HAVE_CHARSET_danish)||defined(HAVE_CHARSET_german1)
......@@ -3651,6 +3655,7 @@ static CHARSET_INFO compiled_charsets[] = {
};
CHARSET_INFO *my_charset_latin1 = &compiled_charsets[0];
CHARSET_INFO *all_charsets[256];
CHARSET_INFO *default_charset_info = &compiled_charsets[0];
CHARSET_INFO *system_charset_info = &compiled_charsets[0];
......
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