mirror of
https://github.com/MariaDB/server.git
synced 2025-01-20 22:12:30 +01:00
Merge work.mysql.com:/home/bk/mysql-4.1
into myvenu.com:/home/venu/work/sql/dev-4.1
This commit is contained in:
commit
6a9273fa95
15 changed files with 133 additions and 123 deletions
|
@ -47,8 +47,11 @@ __os_rename(dbenv, oldname, newname, flags)
|
||||||
* There is no MoveFileEx for Win9x/Me, so we have to
|
* There is no MoveFileEx for Win9x/Me, so we have to
|
||||||
* do the best we can.
|
* do the best we can.
|
||||||
*/
|
*/
|
||||||
if (!GetLongPathName(oldname, oldbuf, sizeof oldbuf) ||
|
LPTSTR FilePath;
|
||||||
!GetLongPathName(newname, newbuf, sizeof newbuf)) {
|
if (!GetFullPathName(oldname, sizeof(oldbuf), oldbuf,
|
||||||
|
&FilePath) ||
|
||||||
|
!GetFullPathName(newname, sizeof(newbuf), newbuf,
|
||||||
|
&FilePath)) {
|
||||||
ret = __os_win32_errno();
|
ret = __os_win32_errno();
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
20
sql/item.cc
20
sql/item.cc
|
@ -163,9 +163,9 @@ bool Item::get_time(TIME *ltime)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
CHARSET_INFO * Item::thd_charset() const
|
CHARSET_INFO * Item::default_charset() const
|
||||||
{
|
{
|
||||||
return current_thd->variables.thd_charset;
|
return current_thd->db_charset;
|
||||||
}
|
}
|
||||||
|
|
||||||
Item_field::Item_field(Field *f) :Item_ident(NullS,f->table_name,f->field_name)
|
Item_field::Item_field(Field *f) :Item_ident(NullS,f->table_name,f->field_name)
|
||||||
|
@ -303,7 +303,7 @@ Item *Item_field::get_tmp_table_item(THD *thd)
|
||||||
|
|
||||||
String *Item_int::val_str(String *str)
|
String *Item_int::val_str(String *str)
|
||||||
{
|
{
|
||||||
str->set(value, thd_charset());
|
str->set(value, default_charset());
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -311,7 +311,7 @@ void Item_int::print(String *str)
|
||||||
{
|
{
|
||||||
if (!name)
|
if (!name)
|
||||||
{
|
{
|
||||||
str_value.set(value, thd_charset());
|
str_value.set(value, default_charset());
|
||||||
name=str_value.c_ptr();
|
name=str_value.c_ptr();
|
||||||
}
|
}
|
||||||
str->append(name);
|
str->append(name);
|
||||||
|
@ -319,7 +319,7 @@ void Item_int::print(String *str)
|
||||||
|
|
||||||
String *Item_uint::val_str(String *str)
|
String *Item_uint::val_str(String *str)
|
||||||
{
|
{
|
||||||
str->set((ulonglong) value, thd_charset());
|
str->set((ulonglong) value, default_charset());
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -327,7 +327,7 @@ void Item_uint::print(String *str)
|
||||||
{
|
{
|
||||||
if (!name)
|
if (!name)
|
||||||
{
|
{
|
||||||
str_value.set((ulonglong) value, thd_charset());
|
str_value.set((ulonglong) value, default_charset());
|
||||||
name=str_value.c_ptr();
|
name=str_value.c_ptr();
|
||||||
}
|
}
|
||||||
str->append(name);
|
str->append(name);
|
||||||
|
@ -336,7 +336,7 @@ void Item_uint::print(String *str)
|
||||||
|
|
||||||
String *Item_real::val_str(String *str)
|
String *Item_real::val_str(String *str)
|
||||||
{
|
{
|
||||||
str->set(value,decimals,thd_charset());
|
str->set(value,decimals,default_charset());
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -377,7 +377,7 @@ void Item_param::set_double(double value)
|
||||||
|
|
||||||
void Item_param::set_value(const char *str, uint length)
|
void Item_param::set_value(const char *str, uint length)
|
||||||
{
|
{
|
||||||
str_value.set(str,length,thd_charset());
|
str_value.set(str,length,default_charset());
|
||||||
item_type = STRING_ITEM;
|
item_type = STRING_ITEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -474,10 +474,10 @@ String *Item_param::val_str(String* str)
|
||||||
{
|
{
|
||||||
switch (item_result_type) {
|
switch (item_result_type) {
|
||||||
case INT_RESULT:
|
case INT_RESULT:
|
||||||
str->set(int_value, thd_charset());
|
str->set(int_value, default_charset());
|
||||||
return str;
|
return str;
|
||||||
case REAL_RESULT:
|
case REAL_RESULT:
|
||||||
str->set(real_value, 2, thd_charset());
|
str->set(real_value, 2, default_charset());
|
||||||
return str;
|
return str;
|
||||||
default:
|
default:
|
||||||
return (String*) &str_value;
|
return (String*) &str_value;
|
||||||
|
|
10
sql/item.h
10
sql/item.h
|
@ -39,8 +39,8 @@ public:
|
||||||
SUBSELECT_ITEM, ROW_ITEM, CACHE_ITEM};
|
SUBSELECT_ITEM, ROW_ITEM, CACHE_ITEM};
|
||||||
|
|
||||||
enum cond_result { COND_UNDEF,COND_OK,COND_TRUE,COND_FALSE };
|
enum cond_result { COND_UNDEF,COND_OK,COND_TRUE,COND_FALSE };
|
||||||
enum coercion { COER_NOCOLL=0, COER_COERCIBLE=1,
|
enum coercion { COER_NOCOLL=3, COER_COERCIBLE=2,
|
||||||
COER_IMPLICIT=2, COER_EXPLICIT=3 };
|
COER_IMPLICIT=1, COER_EXPLICIT=0 };
|
||||||
|
|
||||||
String str_value; /* used to store value */
|
String str_value; /* used to store value */
|
||||||
my_string name; /* Name from select */
|
my_string name; /* Name from select */
|
||||||
|
@ -110,7 +110,7 @@ public:
|
||||||
|
|
||||||
virtual bool binary() const
|
virtual bool binary() const
|
||||||
{ return str_value.charset()->state & MY_CS_BINSORT ? 1 : 0 ; }
|
{ return str_value.charset()->state & MY_CS_BINSORT ? 1 : 0 ; }
|
||||||
CHARSET_INFO *thd_charset() const;
|
CHARSET_INFO *default_charset() const;
|
||||||
CHARSET_INFO *charset() const { return str_value.charset(); };
|
CHARSET_INFO *charset() const { return str_value.charset(); };
|
||||||
void set_charset(CHARSET_INFO *cs) { str_value.set_charset(cs); }
|
void set_charset(CHARSET_INFO *cs) { str_value.set_charset(cs); }
|
||||||
virtual void set_outer_resolving() {}
|
virtual void set_outer_resolving() {}
|
||||||
|
@ -773,7 +773,7 @@ public:
|
||||||
}
|
}
|
||||||
double val() { return (double) value; }
|
double val() { return (double) value; }
|
||||||
longlong val_int() { return value; }
|
longlong val_int() { return value; }
|
||||||
String* val_str(String *str) { str->set(value, thd_charset()); return str; }
|
String* val_str(String *str) { str->set(value, default_charset()); return str; }
|
||||||
enum Item_result result_type() const { return INT_RESULT; }
|
enum Item_result result_type() const { return INT_RESULT; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -792,7 +792,7 @@ public:
|
||||||
longlong val_int() { return (longlong) (value+(value > 0 ? 0.5 : -0.5)); }
|
longlong val_int() { return (longlong) (value+(value > 0 ? 0.5 : -0.5)); }
|
||||||
String* val_str(String *str)
|
String* val_str(String *str)
|
||||||
{
|
{
|
||||||
str->set(value, decimals, thd_charset());
|
str->set(value, decimals, default_charset());
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
enum Item_result result_type() const { return REAL_RESULT; }
|
enum Item_result result_type() const { return REAL_RESULT; }
|
||||||
|
|
|
@ -873,7 +873,7 @@ String *Item_func_case::val_str(String *str)
|
||||||
longlong Item_func_case::val_int()
|
longlong Item_func_case::val_int()
|
||||||
{
|
{
|
||||||
char buff[MAX_FIELD_WIDTH];
|
char buff[MAX_FIELD_WIDTH];
|
||||||
String dummy_str(buff,sizeof(buff),thd_charset());
|
String dummy_str(buff,sizeof(buff),default_charset());
|
||||||
Item *item=find_item(&dummy_str);
|
Item *item=find_item(&dummy_str);
|
||||||
longlong res;
|
longlong res;
|
||||||
|
|
||||||
|
@ -890,7 +890,7 @@ longlong Item_func_case::val_int()
|
||||||
double Item_func_case::val()
|
double Item_func_case::val()
|
||||||
{
|
{
|
||||||
char buff[MAX_FIELD_WIDTH];
|
char buff[MAX_FIELD_WIDTH];
|
||||||
String dummy_str(buff,sizeof(buff),thd_charset());
|
String dummy_str(buff,sizeof(buff),default_charset());
|
||||||
Item *item=find_item(&dummy_str);
|
Item *item=find_item(&dummy_str);
|
||||||
double res;
|
double res;
|
||||||
|
|
||||||
|
|
|
@ -132,7 +132,7 @@ Item_func::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
|
||||||
coercibility= (*arg)->coercibility;
|
coercibility= (*arg)->coercibility;
|
||||||
set_charset((*arg)->charset());
|
set_charset((*arg)->charset());
|
||||||
}
|
}
|
||||||
else if ((*arg)->coercibility > coercibility)
|
else if ((*arg)->coercibility < coercibility)
|
||||||
{
|
{
|
||||||
if (strcmp(charset()->csname,(*arg)->charset()->csname))
|
if (strcmp(charset()->csname,(*arg)->charset()->csname))
|
||||||
{
|
{
|
||||||
|
@ -286,7 +286,7 @@ String *Item_real_func::val_str(String *str)
|
||||||
if (null_value)
|
if (null_value)
|
||||||
return 0; /* purecov: inspected */
|
return 0; /* purecov: inspected */
|
||||||
else
|
else
|
||||||
str->set(nr,decimals,thd_charset());
|
str->set(nr,decimals,default_charset());
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -299,9 +299,9 @@ String *Item_num_func::val_str(String *str)
|
||||||
if (null_value)
|
if (null_value)
|
||||||
return 0; /* purecov: inspected */
|
return 0; /* purecov: inspected */
|
||||||
else if (!unsigned_flag)
|
else if (!unsigned_flag)
|
||||||
str->set(nr,thd_charset());
|
str->set(nr,default_charset());
|
||||||
else
|
else
|
||||||
str->set((ulonglong) nr,thd_charset());
|
str->set((ulonglong) nr,default_charset());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -309,7 +309,7 @@ String *Item_num_func::val_str(String *str)
|
||||||
if (null_value)
|
if (null_value)
|
||||||
return 0; /* purecov: inspected */
|
return 0; /* purecov: inspected */
|
||||||
else
|
else
|
||||||
str->set(nr,decimals,thd_charset());
|
str->set(nr,decimals,default_charset());
|
||||||
}
|
}
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
@ -336,9 +336,9 @@ String *Item_int_func::val_str(String *str)
|
||||||
if (null_value)
|
if (null_value)
|
||||||
return 0;
|
return 0;
|
||||||
else if (!unsigned_flag)
|
else if (!unsigned_flag)
|
||||||
str->set(nr,thd_charset());
|
str->set(nr,default_charset());
|
||||||
else
|
else
|
||||||
str->set((ulonglong) nr,thd_charset());
|
str->set((ulonglong) nr,default_charset());
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -365,9 +365,9 @@ String *Item_num_op::val_str(String *str)
|
||||||
if (null_value)
|
if (null_value)
|
||||||
return 0; /* purecov: inspected */
|
return 0; /* purecov: inspected */
|
||||||
else if (!unsigned_flag)
|
else if (!unsigned_flag)
|
||||||
str->set(nr,thd_charset());
|
str->set(nr,default_charset());
|
||||||
else
|
else
|
||||||
str->set((ulonglong) nr,thd_charset());
|
str->set((ulonglong) nr,default_charset());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -375,7 +375,7 @@ String *Item_num_op::val_str(String *str)
|
||||||
if (null_value)
|
if (null_value)
|
||||||
return 0; /* purecov: inspected */
|
return 0; /* purecov: inspected */
|
||||||
else
|
else
|
||||||
str->set(nr,decimals,thd_charset());
|
str->set(nr,decimals,default_charset());
|
||||||
}
|
}
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
@ -890,9 +890,9 @@ String *Item_func_min_max::val_str(String *str)
|
||||||
if (null_value)
|
if (null_value)
|
||||||
return 0;
|
return 0;
|
||||||
else if (!unsigned_flag)
|
else if (!unsigned_flag)
|
||||||
str->set(nr,thd_charset());
|
str->set(nr,default_charset());
|
||||||
else
|
else
|
||||||
str->set((ulonglong) nr,thd_charset());
|
str->set((ulonglong) nr,default_charset());
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
case REAL_RESULT:
|
case REAL_RESULT:
|
||||||
|
@ -901,7 +901,7 @@ String *Item_func_min_max::val_str(String *str)
|
||||||
if (null_value)
|
if (null_value)
|
||||||
return 0; /* purecov: inspected */
|
return 0; /* purecov: inspected */
|
||||||
else
|
else
|
||||||
str->set(nr,decimals,thd_charset());
|
str->set(nr,decimals,default_charset());
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
case STRING_RESULT:
|
case STRING_RESULT:
|
||||||
|
@ -1563,7 +1563,7 @@ String *Item_func_udf_float::val_str(String *str)
|
||||||
if (null_value)
|
if (null_value)
|
||||||
return 0; /* purecov: inspected */
|
return 0; /* purecov: inspected */
|
||||||
else
|
else
|
||||||
str->set(nr,decimals,thd_charset());
|
str->set(nr,decimals,default_charset());
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1584,9 +1584,9 @@ String *Item_func_udf_int::val_str(String *str)
|
||||||
if (null_value)
|
if (null_value)
|
||||||
return 0;
|
return 0;
|
||||||
else if (!unsigned_flag)
|
else if (!unsigned_flag)
|
||||||
str->set(nr,thd_charset());
|
str->set(nr,default_charset());
|
||||||
else
|
else
|
||||||
str->set((ulonglong) nr,thd_charset());
|
str->set((ulonglong) nr,default_charset());
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2007,6 +2007,7 @@ static user_var_entry *get_variable(HASH *hash, LEX_STRING &name,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool Item_func_set_user_var::fix_fields(THD *thd, TABLE_LIST *tables,
|
bool Item_func_set_user_var::fix_fields(THD *thd, TABLE_LIST *tables,
|
||||||
Item **ref)
|
Item **ref)
|
||||||
{
|
{
|
||||||
|
@ -2030,7 +2031,8 @@ Item_func_set_user_var::fix_length_and_dec()
|
||||||
|
|
||||||
void Item_func_set_user_var::update_hash(void *ptr, uint length,
|
void Item_func_set_user_var::update_hash(void *ptr, uint length,
|
||||||
Item_result type,
|
Item_result type,
|
||||||
CHARSET_INFO *cs)
|
CHARSET_INFO *cs,
|
||||||
|
enum coercion coercibility)
|
||||||
{
|
{
|
||||||
if ((null_value=args[0]->null_value))
|
if ((null_value=args[0]->null_value))
|
||||||
{
|
{
|
||||||
|
@ -2040,6 +2042,7 @@ void Item_func_set_user_var::update_hash(void *ptr, uint length,
|
||||||
entry->value=0;
|
entry->value=0;
|
||||||
entry->length=0;
|
entry->length=0;
|
||||||
entry->var_charset=cs;
|
entry->var_charset=cs;
|
||||||
|
entry->var_coercibility= coercibility;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -2071,6 +2074,7 @@ void Item_func_set_user_var::update_hash(void *ptr, uint length,
|
||||||
entry->length= length;
|
entry->length= length;
|
||||||
entry->type=type;
|
entry->type=type;
|
||||||
entry->var_charset=cs;
|
entry->var_charset=cs;
|
||||||
|
entry->var_coercibility= coercibility;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -2112,7 +2116,8 @@ double
|
||||||
Item_func_set_user_var::val()
|
Item_func_set_user_var::val()
|
||||||
{
|
{
|
||||||
double value=args[0]->val();
|
double value=args[0]->val();
|
||||||
update_hash((void*) &value,sizeof(value), REAL_RESULT, default_charset_info);
|
update_hash((void*) &value,sizeof(value), REAL_RESULT,
|
||||||
|
&my_charset_bin, COER_NOCOLL);
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2121,7 +2126,7 @@ Item_func_set_user_var::val_int()
|
||||||
{
|
{
|
||||||
longlong value=args[0]->val_int();
|
longlong value=args[0]->val_int();
|
||||||
update_hash((void*) &value, sizeof(longlong), INT_RESULT,
|
update_hash((void*) &value, sizeof(longlong), INT_RESULT,
|
||||||
default_charset_info);
|
&my_charset_bin, COER_NOCOLL);
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2130,10 +2135,10 @@ Item_func_set_user_var::val_str(String *str)
|
||||||
{
|
{
|
||||||
String *res=args[0]->val_str(str);
|
String *res=args[0]->val_str(str);
|
||||||
if (!res) // Null value
|
if (!res) // Null value
|
||||||
update_hash((void*) 0, 0, STRING_RESULT, &my_charset_bin);
|
update_hash((void*) 0, 0, STRING_RESULT, &my_charset_bin, COER_NOCOLL);
|
||||||
else
|
else
|
||||||
update_hash((void*) res->ptr(), res->length(), STRING_RESULT,
|
update_hash((void*) res->ptr(), res->length(), STRING_RESULT,
|
||||||
res->charset());
|
res->charset(), args[0]->coercibility);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -934,7 +934,8 @@ public:
|
||||||
double val();
|
double val();
|
||||||
longlong val_int();
|
longlong val_int();
|
||||||
String *val_str(String *str);
|
String *val_str(String *str);
|
||||||
void update_hash(void *ptr, uint length, enum Item_result type, CHARSET_INFO *cs);
|
void update_hash(void *ptr, uint length, enum Item_result type,
|
||||||
|
CHARSET_INFO *cs, enum coercion coercibility);
|
||||||
bool update();
|
bool update();
|
||||||
enum Item_result result_type () const { return cached_result_type; }
|
enum Item_result result_type () const { return cached_result_type; }
|
||||||
bool fix_fields(THD *thd, struct st_table_list *tables, Item **ref);
|
bool fix_fields(THD *thd, struct st_table_list *tables, Item **ref);
|
||||||
|
|
|
@ -1429,14 +1429,14 @@ String *Item_func_database::val_str(String *str)
|
||||||
str->length(0);
|
str->length(0);
|
||||||
else
|
else
|
||||||
str->copy((const char*) thd->db,(uint) strlen(thd->db),
|
str->copy((const char*) thd->db,(uint) strlen(thd->db),
|
||||||
system_charset_info, thd->variables.thd_charset);
|
system_charset_info, default_charset());
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
String *Item_func_user::val_str(String *str)
|
String *Item_func_user::val_str(String *str)
|
||||||
{
|
{
|
||||||
THD *thd=current_thd;
|
THD *thd=current_thd;
|
||||||
CHARSET_INFO *cs=thd->variables.thd_charset;
|
CHARSET_INFO *cs= default_charset();
|
||||||
const char *host=thd->host ? thd->host : thd->ip ? thd->ip : "";
|
const char *host=thd->host ? thd->host : thd->ip ? thd->ip : "";
|
||||||
uint32 res_length=(strlen(thd->user)+strlen(host)+10) * cs->mbmaxlen;
|
uint32 res_length=(strlen(thd->user)+strlen(host)+10) * cs->mbmaxlen;
|
||||||
|
|
||||||
|
@ -1543,7 +1543,7 @@ String *Item_func_format::val_str(String *str)
|
||||||
if ((null_value=args[0]->null_value))
|
if ((null_value=args[0]->null_value))
|
||||||
return 0; /* purecov: inspected */
|
return 0; /* purecov: inspected */
|
||||||
dec= decimals ? decimals+1 : 0;
|
dec= decimals ? decimals+1 : 0;
|
||||||
str->set(nr,decimals,thd_charset());
|
str->set(nr,decimals,default_charset());
|
||||||
str_length=str->length();
|
str_length=str->length();
|
||||||
if (nr < 0)
|
if (nr < 0)
|
||||||
str_length--; // Don't count sign
|
str_length--; // Don't count sign
|
||||||
|
@ -2007,7 +2007,7 @@ String *Item_func_conv::val_str(String *str)
|
||||||
else
|
else
|
||||||
dec= (longlong) my_strntoull(res->charset(),res->ptr(),res->length(),from_base,&endptr,&err);
|
dec= (longlong) my_strntoull(res->charset(),res->ptr(),res->length(),from_base,&endptr,&err);
|
||||||
ptr= longlong2str(dec,ans,to_base);
|
ptr= longlong2str(dec,ans,to_base);
|
||||||
if (str->copy(ans,(uint32) (ptr-ans), thd_charset()))
|
if (str->copy(ans,(uint32) (ptr-ans), default_charset()))
|
||||||
return &empty_string;
|
return &empty_string;
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
@ -2242,7 +2242,7 @@ String *Item_func_charset::val_str(String *str)
|
||||||
if ((null_value=(args[0]->null_value || !res->charset())))
|
if ((null_value=(args[0]->null_value || !res->charset())))
|
||||||
return 0;
|
return 0;
|
||||||
str->copy(res->charset()->csname,strlen(res->charset()->csname),
|
str->copy(res->charset()->csname,strlen(res->charset()->csname),
|
||||||
&my_charset_latin1, thd_charset());
|
&my_charset_latin1, default_charset());
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2253,7 +2253,7 @@ String *Item_func_collation::val_str(String *str)
|
||||||
if ((null_value=(args[0]->null_value || !res->charset())))
|
if ((null_value=(args[0]->null_value || !res->charset())))
|
||||||
return 0;
|
return 0;
|
||||||
str->copy(res->charset()->name,strlen(res->charset()->name),
|
str->copy(res->charset()->name,strlen(res->charset()->name),
|
||||||
&my_charset_latin1, thd_charset());
|
&my_charset_latin1, default_charset());
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -333,8 +333,8 @@ public:
|
||||||
String *val_str(String *);
|
String *val_str(String *);
|
||||||
void fix_length_and_dec()
|
void fix_length_and_dec()
|
||||||
{
|
{
|
||||||
max_length= MAX_FIELD_NAME * thd_charset()->mbmaxlen;
|
max_length= MAX_FIELD_NAME * default_charset()->mbmaxlen;
|
||||||
set_charset(thd_charset());
|
set_charset(default_charset());
|
||||||
}
|
}
|
||||||
const char *func_name() const { return "database"; }
|
const char *func_name() const { return "database"; }
|
||||||
};
|
};
|
||||||
|
@ -346,8 +346,8 @@ public:
|
||||||
String *val_str(String *);
|
String *val_str(String *);
|
||||||
void fix_length_and_dec()
|
void fix_length_and_dec()
|
||||||
{
|
{
|
||||||
max_length= (USERNAME_LENGTH+HOSTNAME_LENGTH+1)*thd_charset()->mbmaxlen;
|
max_length= (USERNAME_LENGTH+HOSTNAME_LENGTH+1)*default_charset()->mbmaxlen;
|
||||||
set_charset(thd_charset());
|
set_charset(default_charset());
|
||||||
}
|
}
|
||||||
const char *func_name() const { return "user"; }
|
const char *func_name() const { return "user"; }
|
||||||
};
|
};
|
||||||
|
@ -612,7 +612,7 @@ public:
|
||||||
void fix_length_and_dec()
|
void fix_length_and_dec()
|
||||||
{
|
{
|
||||||
max_length=40; // should be enough
|
max_length=40; // should be enough
|
||||||
set_charset(thd_charset());
|
set_charset(default_charset());
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -625,7 +625,7 @@ public:
|
||||||
void fix_length_and_dec()
|
void fix_length_and_dec()
|
||||||
{
|
{
|
||||||
max_length=40; // should be enough
|
max_length=40; // should be enough
|
||||||
set_charset(thd_charset());
|
set_charset(default_charset());
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -372,7 +372,7 @@ String *Item_exists_subselect::val_str(String *str)
|
||||||
reset();
|
reset();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
str->set(value,thd_charset());
|
str->set(value,default_charset());
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -415,7 +415,7 @@ String *Item_in_subselect::val_str(String *str)
|
||||||
null_value= 1;
|
null_value= 1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
str->set(value,thd_charset());
|
str->set(value,default_charset());
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -124,7 +124,7 @@ Item_sum_num::val_str(String *str)
|
||||||
double nr=val();
|
double nr=val();
|
||||||
if (null_value)
|
if (null_value)
|
||||||
return 0;
|
return 0;
|
||||||
str->set(nr,decimals,thd_charset());
|
str->set(nr,decimals,default_charset());
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -135,7 +135,7 @@ Item_sum_int::val_str(String *str)
|
||||||
longlong nr=val_int();
|
longlong nr=val_int();
|
||||||
if (null_value)
|
if (null_value)
|
||||||
return 0;
|
return 0;
|
||||||
str->set(nr,thd_charset());
|
str->set(nr,default_charset());
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -416,13 +416,13 @@ Item_sum_hybrid::val_str(String *str)
|
||||||
case STRING_RESULT:
|
case STRING_RESULT:
|
||||||
return &value;
|
return &value;
|
||||||
case REAL_RESULT:
|
case REAL_RESULT:
|
||||||
str->set(sum,decimals,thd_charset());
|
str->set(sum,decimals,default_charset());
|
||||||
break;
|
break;
|
||||||
case INT_RESULT:
|
case INT_RESULT:
|
||||||
if (unsigned_flag)
|
if (unsigned_flag)
|
||||||
str->set((ulonglong) sum_int,thd_charset());
|
str->set((ulonglong) sum_int,default_charset());
|
||||||
else
|
else
|
||||||
str->set((longlong) sum_int,thd_charset());
|
str->set((longlong) sum_int,default_charset());
|
||||||
break;
|
break;
|
||||||
case ROW_RESULT:
|
case ROW_RESULT:
|
||||||
default:
|
default:
|
||||||
|
@ -879,7 +879,7 @@ String *Item_avg_field::val_str(String *str)
|
||||||
double nr=Item_avg_field::val();
|
double nr=Item_avg_field::val();
|
||||||
if (null_value)
|
if (null_value)
|
||||||
return 0;
|
return 0;
|
||||||
str->set(nr,decimals,thd_charset());
|
str->set(nr,decimals,default_charset());
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -927,7 +927,7 @@ String *Item_variance_field::val_str(String *str)
|
||||||
double nr=val();
|
double nr=val();
|
||||||
if (null_value)
|
if (null_value)
|
||||||
return 0;
|
return 0;
|
||||||
str->set(nr,decimals,thd_charset());
|
str->set(nr,decimals,default_charset());
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1281,7 +1281,7 @@ String *Item_sum_udf_float::val_str(String *str)
|
||||||
if (null_value)
|
if (null_value)
|
||||||
return 0; /* purecov: inspected */
|
return 0; /* purecov: inspected */
|
||||||
else
|
else
|
||||||
str->set(nr,decimals,thd_charset());
|
str->set(nr,decimals,default_charset());
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1300,7 +1300,7 @@ String *Item_sum_udf_int::val_str(String *str)
|
||||||
if (null_value)
|
if (null_value)
|
||||||
return 0;
|
return 0;
|
||||||
else
|
else
|
||||||
str->set(nr,thd_charset());
|
str->set(nr,default_charset());
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -162,7 +162,7 @@ String* Item_func_monthname::val_str(String* str)
|
||||||
null_value=0;
|
null_value=0;
|
||||||
|
|
||||||
String *m=&month_names[month-1];
|
String *m=&month_names[month-1];
|
||||||
str->copy(m->ptr(), m->length(), m->charset(), thd_charset());
|
str->copy(m->ptr(), m->length(), m->charset(), default_charset());
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -252,7 +252,7 @@ String* Item_func_dayname::val_str(String* str)
|
||||||
return (String*) 0;
|
return (String*) 0;
|
||||||
|
|
||||||
String *d=&day_names[weekday];
|
String *d=&day_names[weekday];
|
||||||
str->copy(d->ptr(), d->length(), d->charset(), thd_charset());
|
str->copy(d->ptr(), d->length(), d->charset(), default_charset());
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -416,7 +416,7 @@ String *Item_date::val_str(String *str)
|
||||||
return (String*) 0;
|
return (String*) 0;
|
||||||
if (!value) // zero daynr
|
if (!value) // zero daynr
|
||||||
{
|
{
|
||||||
str->copy("0000-00-00",10,&my_charset_latin1,thd_charset());
|
str->copy("0000-00-00",10,&my_charset_latin1,default_charset());
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -425,7 +425,7 @@ String *Item_date::val_str(String *str)
|
||||||
(int) (value/10000L) % 10000,
|
(int) (value/10000L) % 10000,
|
||||||
(int) (value/100)%100,
|
(int) (value/100)%100,
|
||||||
(int) (value%100));
|
(int) (value%100));
|
||||||
str->copy(tmpbuff,10,&my_charset_latin1,thd_charset());
|
str->copy(tmpbuff,10,&my_charset_latin1,default_charset());
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -463,9 +463,9 @@ void Item_func_curdate::fix_length_and_dec()
|
||||||
struct tm tm_tmp,*start;
|
struct tm tm_tmp,*start;
|
||||||
time_t query_start=current_thd->query_start();
|
time_t query_start=current_thd->query_start();
|
||||||
|
|
||||||
set_charset(thd_charset());
|
set_charset(default_charset());
|
||||||
decimals=0;
|
decimals=0;
|
||||||
max_length=10*thd_charset()->mbmaxlen;
|
max_length=10*default_charset()->mbmaxlen;
|
||||||
localtime_r(&query_start,&tm_tmp);
|
localtime_r(&query_start,&tm_tmp);
|
||||||
start=&tm_tmp;
|
start=&tm_tmp;
|
||||||
value=(longlong) ((ulong) ((uint) start->tm_year+1900)*10000L+
|
value=(longlong) ((ulong) ((uint) start->tm_year+1900)*10000L+
|
||||||
|
@ -492,7 +492,7 @@ bool Item_func_curdate::get_date(TIME *res,
|
||||||
|
|
||||||
String *Item_func_curtime::val_str(String *str)
|
String *Item_func_curtime::val_str(String *str)
|
||||||
{
|
{
|
||||||
str_value.set(buff,buff_length,thd_charset());
|
str_value.set(buff,buff_length,default_charset());
|
||||||
return &str_value;
|
return &str_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -500,7 +500,7 @@ void Item_func_curtime::fix_length_and_dec()
|
||||||
{
|
{
|
||||||
struct tm tm_tmp,*start;
|
struct tm tm_tmp,*start;
|
||||||
time_t query_start=current_thd->query_start();
|
time_t query_start=current_thd->query_start();
|
||||||
CHARSET_INFO *cs=thd_charset();
|
CHARSET_INFO *cs=default_charset();
|
||||||
|
|
||||||
decimals=0;
|
decimals=0;
|
||||||
max_length=8*cs->mbmaxlen;
|
max_length=8*cs->mbmaxlen;
|
||||||
|
@ -520,7 +520,7 @@ void Item_func_curtime::fix_length_and_dec()
|
||||||
|
|
||||||
String *Item_func_now::val_str(String *str)
|
String *Item_func_now::val_str(String *str)
|
||||||
{
|
{
|
||||||
str_value.set(buff,buff_length,thd_charset());
|
str_value.set(buff,buff_length,default_charset());
|
||||||
return &str_value;
|
return &str_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -595,7 +595,7 @@ String *Item_func_sec_to_time::val_str(String *str)
|
||||||
uint sec= (uint) ((ulonglong) seconds % 3600);
|
uint sec= (uint) ((ulonglong) seconds % 3600);
|
||||||
length= my_sprintf(buff,(buff,"%s%02lu:%02u:%02u",sign,(long) (seconds/3600),
|
length= my_sprintf(buff,(buff,"%s%02lu:%02u:%02u",sign,(long) (seconds/3600),
|
||||||
sec/60, sec % 60));
|
sec/60, sec % 60));
|
||||||
str->copy(buff, length, &my_charset_latin1, thd_charset());
|
str->copy(buff, length, &my_charset_latin1, default_charset());
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -940,7 +940,7 @@ String *Item_func_from_unixtime::val_str(String *str)
|
||||||
struct tm tm_tmp,*start;
|
struct tm tm_tmp,*start;
|
||||||
time_t tmp=(time_t) args[0]->val_int();
|
time_t tmp=(time_t) args[0]->val_int();
|
||||||
uint32 l;
|
uint32 l;
|
||||||
CHARSET_INFO *cs=thd_charset();
|
CHARSET_INFO *cs=default_charset();
|
||||||
|
|
||||||
if ((null_value=args[0]->null_value))
|
if ((null_value=args[0]->null_value))
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1003,9 +1003,9 @@ bool Item_func_from_unixtime::get_date(TIME *ltime,
|
||||||
void Item_date_add_interval::fix_length_and_dec()
|
void Item_date_add_interval::fix_length_and_dec()
|
||||||
{
|
{
|
||||||
enum_field_types arg0_field_type;
|
enum_field_types arg0_field_type;
|
||||||
set_charset(thd_charset());
|
set_charset(default_charset());
|
||||||
maybe_null=1;
|
maybe_null=1;
|
||||||
max_length=19*thd_charset()->mbmaxlen;
|
max_length=19*default_charset()->mbmaxlen;
|
||||||
value.alloc(32);
|
value.alloc(32);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1124,7 +1124,7 @@ bool Item_date_add_interval::get_date(TIME *ltime, bool fuzzy_date)
|
||||||
String *Item_date_add_interval::val_str(String *str)
|
String *Item_date_add_interval::val_str(String *str)
|
||||||
{
|
{
|
||||||
TIME ltime;
|
TIME ltime;
|
||||||
CHARSET_INFO *cs=thd_charset();
|
CHARSET_INFO *cs=default_charset();
|
||||||
uint32 l;
|
uint32 l;
|
||||||
|
|
||||||
if (Item_date_add_interval::get_date(<ime,0))
|
if (Item_date_add_interval::get_date(<ime,0))
|
||||||
|
|
|
@ -29,7 +29,7 @@ public:
|
||||||
const char *func_name() const { return "period_add"; }
|
const char *func_name() const { return "period_add"; }
|
||||||
void fix_length_and_dec()
|
void fix_length_and_dec()
|
||||||
{
|
{
|
||||||
max_length=6*thd_charset()->mbmaxlen;
|
max_length=6*default_charset()->mbmaxlen;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ public:
|
||||||
void fix_length_and_dec()
|
void fix_length_and_dec()
|
||||||
{
|
{
|
||||||
decimals=0;
|
decimals=0;
|
||||||
max_length=6*thd_charset()->mbmaxlen;
|
max_length=6*default_charset()->mbmaxlen;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ public:
|
||||||
void fix_length_and_dec()
|
void fix_length_and_dec()
|
||||||
{
|
{
|
||||||
decimals=0;
|
decimals=0;
|
||||||
max_length=6*thd_charset()->mbmaxlen;
|
max_length=6*default_charset()->mbmaxlen;
|
||||||
maybe_null=1;
|
maybe_null=1;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -72,7 +72,7 @@ public:
|
||||||
void fix_length_and_dec()
|
void fix_length_and_dec()
|
||||||
{
|
{
|
||||||
decimals=0;
|
decimals=0;
|
||||||
max_length=2*thd_charset()->mbmaxlen;
|
max_length=2*default_charset()->mbmaxlen;
|
||||||
maybe_null=1;
|
maybe_null=1;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -86,16 +86,16 @@ public:
|
||||||
double val() { return (double) Item_func_month::val_int(); }
|
double val() { return (double) Item_func_month::val_int(); }
|
||||||
String *val_str(String *str)
|
String *val_str(String *str)
|
||||||
{
|
{
|
||||||
str->set(val_int(), thd_charset());
|
str->set(val_int(), default_charset());
|
||||||
return null_value ? 0 : str;
|
return null_value ? 0 : str;
|
||||||
}
|
}
|
||||||
const char *func_name() const { return "month"; }
|
const char *func_name() const { return "month"; }
|
||||||
enum Item_result result_type () const { return INT_RESULT; }
|
enum Item_result result_type () const { return INT_RESULT; }
|
||||||
void fix_length_and_dec()
|
void fix_length_and_dec()
|
||||||
{
|
{
|
||||||
set_charset(thd_charset());
|
set_charset(default_charset());
|
||||||
decimals=0;
|
decimals=0;
|
||||||
max_length=2*thd_charset()->mbmaxlen;
|
max_length=2*default_charset()->mbmaxlen;
|
||||||
maybe_null=1;
|
maybe_null=1;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -110,9 +110,9 @@ public:
|
||||||
enum Item_result result_type () const { return STRING_RESULT; }
|
enum Item_result result_type () const { return STRING_RESULT; }
|
||||||
void fix_length_and_dec()
|
void fix_length_and_dec()
|
||||||
{
|
{
|
||||||
set_charset(thd_charset());
|
set_charset(default_charset());
|
||||||
decimals=0;
|
decimals=0;
|
||||||
max_length=10*thd_charset()->mbmaxlen;
|
max_length=10*default_charset()->mbmaxlen;
|
||||||
maybe_null=1;
|
maybe_null=1;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -127,7 +127,7 @@ public:
|
||||||
void fix_length_and_dec()
|
void fix_length_and_dec()
|
||||||
{
|
{
|
||||||
decimals=0;
|
decimals=0;
|
||||||
max_length=3*thd_charset()->mbmaxlen;
|
max_length=3*default_charset()->mbmaxlen;
|
||||||
maybe_null=1;
|
maybe_null=1;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -142,7 +142,7 @@ public:
|
||||||
void fix_length_and_dec()
|
void fix_length_and_dec()
|
||||||
{
|
{
|
||||||
decimals=0;
|
decimals=0;
|
||||||
max_length=2*thd_charset()->mbmaxlen;
|
max_length=2*default_charset()->mbmaxlen;
|
||||||
maybe_null=1;
|
maybe_null=1;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -157,7 +157,7 @@ public:
|
||||||
void fix_length_and_dec()
|
void fix_length_and_dec()
|
||||||
{
|
{
|
||||||
decimals=0;
|
decimals=0;
|
||||||
max_length=2*thd_charset()->mbmaxlen;
|
max_length=2*default_charset()->mbmaxlen;
|
||||||
maybe_null=1;
|
maybe_null=1;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -172,7 +172,7 @@ public:
|
||||||
void fix_length_and_dec()
|
void fix_length_and_dec()
|
||||||
{
|
{
|
||||||
decimals=0;
|
decimals=0;
|
||||||
max_length=1*thd_charset()->mbmaxlen;
|
max_length=1*default_charset()->mbmaxlen;
|
||||||
maybe_null=1;
|
maybe_null=1;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -187,7 +187,7 @@ public:
|
||||||
void fix_length_and_dec()
|
void fix_length_and_dec()
|
||||||
{
|
{
|
||||||
decimals=0;
|
decimals=0;
|
||||||
max_length=2*thd_charset()->mbmaxlen;
|
max_length=2*default_charset()->mbmaxlen;
|
||||||
maybe_null=1;
|
maybe_null=1;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -202,7 +202,7 @@ public:
|
||||||
void fix_length_and_dec()
|
void fix_length_and_dec()
|
||||||
{
|
{
|
||||||
decimals=0;
|
decimals=0;
|
||||||
max_length=2*thd_charset()->mbmaxlen;
|
max_length=2*default_charset()->mbmaxlen;
|
||||||
maybe_null=1;
|
maybe_null=1;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -216,7 +216,7 @@ public:
|
||||||
void fix_length_and_dec()
|
void fix_length_and_dec()
|
||||||
{
|
{
|
||||||
decimals=0;
|
decimals=0;
|
||||||
max_length=6*thd_charset()->mbmaxlen;
|
max_length=6*default_charset()->mbmaxlen;
|
||||||
maybe_null=1;
|
maybe_null=1;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -231,7 +231,7 @@ public:
|
||||||
void fix_length_and_dec()
|
void fix_length_and_dec()
|
||||||
{
|
{
|
||||||
decimals=0;
|
decimals=0;
|
||||||
max_length=4*thd_charset()->mbmaxlen;
|
max_length=4*default_charset()->mbmaxlen;
|
||||||
maybe_null=1;
|
maybe_null=1;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -247,16 +247,16 @@ public:
|
||||||
double val() { return (double) val_int(); }
|
double val() { return (double) val_int(); }
|
||||||
String *val_str(String *str)
|
String *val_str(String *str)
|
||||||
{
|
{
|
||||||
str->set(val_int(), thd_charset());
|
str->set(val_int(), default_charset());
|
||||||
return null_value ? 0 : str;
|
return null_value ? 0 : str;
|
||||||
}
|
}
|
||||||
const char *func_name() const { return "weekday"; }
|
const char *func_name() const { return "weekday"; }
|
||||||
enum Item_result result_type () const { return INT_RESULT; }
|
enum Item_result result_type () const { return INT_RESULT; }
|
||||||
void fix_length_and_dec()
|
void fix_length_and_dec()
|
||||||
{
|
{
|
||||||
set_charset(thd_charset());
|
set_charset(default_charset());
|
||||||
decimals=0;
|
decimals=0;
|
||||||
max_length=1*thd_charset()->mbmaxlen;
|
max_length=1*default_charset()->mbmaxlen;
|
||||||
maybe_null=1;
|
maybe_null=1;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -270,9 +270,9 @@ class Item_func_dayname :public Item_func_weekday
|
||||||
enum Item_result result_type () const { return STRING_RESULT; }
|
enum Item_result result_type () const { return STRING_RESULT; }
|
||||||
void fix_length_and_dec()
|
void fix_length_and_dec()
|
||||||
{
|
{
|
||||||
set_charset(thd_charset());
|
set_charset(default_charset());
|
||||||
decimals=0;
|
decimals=0;
|
||||||
max_length=9*thd_charset()->mbmaxlen;
|
max_length=9*default_charset()->mbmaxlen;
|
||||||
maybe_null=1;
|
maybe_null=1;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -289,7 +289,7 @@ public:
|
||||||
void fix_length_and_dec()
|
void fix_length_and_dec()
|
||||||
{
|
{
|
||||||
decimals=0;
|
decimals=0;
|
||||||
max_length=10*thd_charset()->mbmaxlen;
|
max_length=10*default_charset()->mbmaxlen;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -303,7 +303,7 @@ public:
|
||||||
void fix_length_and_dec()
|
void fix_length_and_dec()
|
||||||
{
|
{
|
||||||
decimals=0;
|
decimals=0;
|
||||||
max_length=10*thd_charset()->mbmaxlen;
|
max_length=10*default_charset()->mbmaxlen;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -322,15 +322,15 @@ public:
|
||||||
const char *func_name() const { return "date"; }
|
const char *func_name() const { return "date"; }
|
||||||
void fix_length_and_dec()
|
void fix_length_and_dec()
|
||||||
{
|
{
|
||||||
set_charset(thd_charset());
|
set_charset(default_charset());
|
||||||
decimals=0;
|
decimals=0;
|
||||||
max_length=10*thd_charset()->mbmaxlen;
|
max_length=10*default_charset()->mbmaxlen;
|
||||||
}
|
}
|
||||||
int save_in_field(Field *to, bool no_conversions);
|
int save_in_field(Field *to, bool no_conversions);
|
||||||
Field *tmp_table_field() { return result_field; }
|
Field *tmp_table_field() { return result_field; }
|
||||||
Field *tmp_table_field(TABLE *t_arg)
|
Field *tmp_table_field(TABLE *t_arg)
|
||||||
{
|
{
|
||||||
return (new Field_date(maybe_null, name, t_arg, thd_charset()));
|
return (new Field_date(maybe_null, name, t_arg, default_charset()));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -345,7 +345,7 @@ public:
|
||||||
Field *tmp_table_field() { return result_field; }
|
Field *tmp_table_field() { return result_field; }
|
||||||
Field *tmp_table_field(TABLE *t_arg)
|
Field *tmp_table_field(TABLE *t_arg)
|
||||||
{
|
{
|
||||||
return (new Field_datetime(maybe_null, name, t_arg, thd_charset()));
|
return (new Field_datetime(maybe_null, name, t_arg, default_charset()));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -368,7 +368,7 @@ public:
|
||||||
Field *tmp_table_field() { return result_field; }
|
Field *tmp_table_field() { return result_field; }
|
||||||
Field *tmp_table_field(TABLE *t_arg)
|
Field *tmp_table_field(TABLE *t_arg)
|
||||||
{
|
{
|
||||||
return (new Field_time(maybe_null, name, t_arg, thd_charset()));
|
return (new Field_time(maybe_null, name, t_arg, default_charset()));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -440,9 +440,9 @@ class Item_func_from_unixtime :public Item_date_func
|
||||||
const char *func_name() const { return "from_unixtime"; }
|
const char *func_name() const { return "from_unixtime"; }
|
||||||
void fix_length_and_dec()
|
void fix_length_and_dec()
|
||||||
{
|
{
|
||||||
set_charset(thd_charset());
|
set_charset(default_charset());
|
||||||
decimals=0;
|
decimals=0;
|
||||||
max_length=19*thd_charset()->mbmaxlen;
|
max_length=19*default_charset()->mbmaxlen;
|
||||||
}
|
}
|
||||||
bool get_date(TIME *res,bool fuzzy_date);
|
bool get_date(TIME *res,bool fuzzy_date);
|
||||||
};
|
};
|
||||||
|
@ -457,16 +457,16 @@ public:
|
||||||
String *val_str(String *);
|
String *val_str(String *);
|
||||||
void fix_length_and_dec()
|
void fix_length_and_dec()
|
||||||
{
|
{
|
||||||
set_charset(thd_charset());
|
set_charset(default_charset());
|
||||||
maybe_null=1;
|
maybe_null=1;
|
||||||
max_length=13*thd_charset()->mbmaxlen;
|
max_length=13*default_charset()->mbmaxlen;
|
||||||
}
|
}
|
||||||
enum_field_types field_type() const { return MYSQL_TYPE_TIME; }
|
enum_field_types field_type() const { return MYSQL_TYPE_TIME; }
|
||||||
const char *func_name() const { return "sec_to_time"; }
|
const char *func_name() const { return "sec_to_time"; }
|
||||||
Field *tmp_table_field() { return result_field; }
|
Field *tmp_table_field() { return result_field; }
|
||||||
Field *tmp_table_field(TABLE *t_arg)
|
Field *tmp_table_field(TABLE *t_arg)
|
||||||
{
|
{
|
||||||
return (new Field_time(maybe_null, name, t_arg, thd_charset()));
|
return (new Field_time(maybe_null, name, t_arg, default_charset()));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -532,7 +532,7 @@ public:
|
||||||
}
|
}
|
||||||
void fix_length_and_dec()
|
void fix_length_and_dec()
|
||||||
{
|
{
|
||||||
set_charset(thd_charset());
|
set_charset(default_charset());
|
||||||
max_length=args[0]->max_length;
|
max_length=args[0]->max_length;
|
||||||
}
|
}
|
||||||
void print(String *str);
|
void print(String *str);
|
||||||
|
@ -545,7 +545,7 @@ public:
|
||||||
Item_char_typecast(Item *a) :Item_typecast(a) {}
|
Item_char_typecast(Item *a) :Item_typecast(a) {}
|
||||||
void fix_length_and_dec()
|
void fix_length_and_dec()
|
||||||
{
|
{
|
||||||
set_charset(thd_charset());
|
set_charset(default_charset());
|
||||||
max_length=args[0]->max_length;
|
max_length=args[0]->max_length;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -560,7 +560,7 @@ public:
|
||||||
Field *tmp_table_field() { return result_field; }
|
Field *tmp_table_field() { return result_field; }
|
||||||
Field *tmp_table_field(TABLE *t_arg)
|
Field *tmp_table_field(TABLE *t_arg)
|
||||||
{
|
{
|
||||||
return (new Field_date(maybe_null, name, t_arg, thd_charset()));
|
return (new Field_date(maybe_null, name, t_arg, default_charset()));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -574,7 +574,7 @@ public:
|
||||||
Field *tmp_table_field() { return result_field; }
|
Field *tmp_table_field() { return result_field; }
|
||||||
Field *tmp_table_field(TABLE *t_arg)
|
Field *tmp_table_field(TABLE *t_arg)
|
||||||
{
|
{
|
||||||
return (new Field_time(maybe_null, name, t_arg, thd_charset()));
|
return (new Field_time(maybe_null, name, t_arg, default_charset()));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -588,6 +588,6 @@ public:
|
||||||
Field *tmp_table_field() { return result_field; }
|
Field *tmp_table_field() { return result_field; }
|
||||||
Field *tmp_table_field(TABLE *t_arg)
|
Field *tmp_table_field(TABLE *t_arg)
|
||||||
{
|
{
|
||||||
return (new Field_datetime(maybe_null, name, t_arg, thd_charset()));
|
return (new Field_datetime(maybe_null, name, t_arg, default_charset()));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -2177,7 +2177,7 @@ int User_var_log_event::exec_event(struct st_relay_log_info* rli)
|
||||||
}
|
}
|
||||||
Item_func_set_user_var e(user_var_name, it);
|
Item_func_set_user_var e(user_var_name, it);
|
||||||
e.fix_fields(thd, 0, 0);
|
e.fix_fields(thd, 0, 0);
|
||||||
e.update_hash(val, val_len, type, charset);
|
e.update_hash(val, val_len, type, charset, Item::COER_NOCOLL);
|
||||||
free_root(&thd->mem_root,0);
|
free_root(&thd->mem_root,0);
|
||||||
|
|
||||||
rli->inc_pending(get_event_len());
|
rli->inc_pending(get_event_len());
|
||||||
|
|
|
@ -38,7 +38,7 @@ public:
|
||||||
virtual void set(const char *str,uint length,CHARSET_INFO *cs)=0;
|
virtual void set(const char *str,uint length,CHARSET_INFO *cs)=0;
|
||||||
virtual void set(longlong nr)=0;
|
virtual void set(longlong nr)=0;
|
||||||
virtual enum_field_types field_type() const=0;
|
virtual enum_field_types field_type() const=0;
|
||||||
void set(const char *str) { set(str,(uint) strlen(str), thd_charset()); }
|
void set(const char *str) { set(str,(uint) strlen(str), default_charset()); }
|
||||||
void make_field(Send_field *tmp_field)
|
void make_field(Send_field *tmp_field)
|
||||||
{
|
{
|
||||||
init_make_field(tmp_field,field_type());
|
init_make_field(tmp_field,field_type());
|
||||||
|
@ -62,7 +62,7 @@ public:
|
||||||
{ int err; value=my_strntod(cs,(char*) str,length,(char**)0,&err); }
|
{ int err; value=my_strntod(cs,(char*) str,length,(char**)0,&err); }
|
||||||
double val() { return value; }
|
double val() { return value; }
|
||||||
longlong val_int() { return (longlong) value; }
|
longlong val_int() { return (longlong) value; }
|
||||||
String *val_str(String *s) { s->set(value,decimals,thd_charset()); return s; }
|
String *val_str(String *s) { s->set(value,decimals,default_charset()); return s; }
|
||||||
unsigned int size_of() { return sizeof(*this);}
|
unsigned int size_of() { return sizeof(*this);}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -80,7 +80,7 @@ public:
|
||||||
{ int err; value=my_strntoll(cs,str,length,10,NULL,&err); }
|
{ int err; value=my_strntoll(cs,str,length,10,NULL,&err); }
|
||||||
double val() { return (double) value; }
|
double val() { return (double) value; }
|
||||||
longlong val_int() { return value; }
|
longlong val_int() { return value; }
|
||||||
String *val_str(String *s) { s->set(value, thd_charset()); return s; }
|
String *val_str(String *s) { s->set(value, default_charset()); return s; }
|
||||||
unsigned int size_of() { return sizeof(*this);}
|
unsigned int size_of() { return sizeof(*this);}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -92,8 +92,8 @@ public:
|
||||||
{ this->max_length=length; }
|
{ this->max_length=length; }
|
||||||
enum Item_result result_type () const { return STRING_RESULT; }
|
enum Item_result result_type () const { return STRING_RESULT; }
|
||||||
enum_field_types field_type() const { return MYSQL_TYPE_STRING; }
|
enum_field_types field_type() const { return MYSQL_TYPE_STRING; }
|
||||||
void set(double nr) { str_value.set(nr, 2, thd_charset()); }
|
void set(double nr) { str_value.set(nr, 2, default_charset()); }
|
||||||
void set(longlong nr) { str_value.set(nr, thd_charset()); }
|
void set(longlong nr) { str_value.set(nr, default_charset()); }
|
||||||
void set(const char *str, uint length, CHARSET_INFO *cs)
|
void set(const char *str, uint length, CHARSET_INFO *cs)
|
||||||
{ str_value.copy(str,length,cs); }
|
{ str_value.copy(str,length,cs); }
|
||||||
double val()
|
double val()
|
||||||
|
|
|
@ -935,6 +935,7 @@ class user_var_entry
|
||||||
ulong length, update_query_id, used_query_id;
|
ulong length, update_query_id, used_query_id;
|
||||||
Item_result type;
|
Item_result type;
|
||||||
CHARSET_INFO *var_charset;
|
CHARSET_INFO *var_charset;
|
||||||
|
enum Item::coercion var_coercibility;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Class for unique (removing of duplicates) */
|
/* Class for unique (removing of duplicates) */
|
||||||
|
|
Loading…
Reference in a new issue