mirror of
https://github.com/MariaDB/server.git
synced 2025-01-17 12:32:27 +01:00
Merge sinisa@work.mysql.com:/home/bk/mysql-4.1
into sinisa.nasamreza.org:/mnt/work/mysql-4.1 sql/item.cc: Auto merged
This commit is contained in:
commit
9528812119
16 changed files with 78 additions and 70 deletions
|
@ -34,6 +34,8 @@ static int initialized;
|
|||
1 Error
|
||||
*/
|
||||
|
||||
#define des_cs my_charset_latin1
|
||||
|
||||
bool
|
||||
load_des_key_file(const char *file_name)
|
||||
{
|
||||
|
@ -70,10 +72,10 @@ load_des_key_file(const char *file_name)
|
|||
{
|
||||
offset=(char) (offset - '0');
|
||||
// Remove newline and possible other control characters
|
||||
for (start=buf+1 ; my_isspace(system_charset_info, *start) ; start++) ;
|
||||
for (start=buf+1 ; my_isspace(des_cs, *start) ; start++) ;
|
||||
end=buf+length;
|
||||
for (end=strend(buf) ;
|
||||
end > start && !my_isgraph(system_charset_info, end[-1]) ; end--) ;
|
||||
end > start && !my_isgraph(des_cs, end[-1]) ; end--) ;
|
||||
|
||||
if (start != end)
|
||||
{
|
||||
|
|
42
sql/field.cc
42
sql/field.cc
|
@ -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),default_charset_info),tmp2,*res;
|
||||
String tmp(buff,sizeof(buff),my_charset_latin1),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),default_charset_info),tmp2,*res;
|
||||
String tmp(buff,sizeof(buff),my_charset_latin1),tmp2,*res;
|
||||
if (!(res=val_str(&tmp,&tmp2)) ||
|
||||
str_to_time(res->ptr(),res->length(),ltime))
|
||||
return 1;
|
||||
|
@ -404,6 +404,12 @@ void Field_decimal::overflow(bool negative)
|
|||
|
||||
int Field_decimal::store(const char *from, uint len, CHARSET_INFO *cs)
|
||||
{
|
||||
String l1from;
|
||||
|
||||
l1from.copy(from,len,cs,my_charset_latin1);
|
||||
from=l1from.ptr();
|
||||
len=l1from.length();
|
||||
|
||||
const char *end= from+len;
|
||||
/* The pointer where the field value starts (i.e., "where to write") */
|
||||
char *to=ptr;
|
||||
|
@ -463,7 +469,7 @@ int Field_decimal::store(const char *from, uint len, CHARSET_INFO *cs)
|
|||
tmp_dec++;
|
||||
|
||||
/* skip pre-space */
|
||||
while (from != end && my_isspace(system_charset_info,*from))
|
||||
while (from != end && my_isspace(my_charset_latin1,*from))
|
||||
from++;
|
||||
if (from == end)
|
||||
{
|
||||
|
@ -500,13 +506,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(system_charset_info, *from) ; from++) ;
|
||||
for (; from != end && my_isdigit(my_charset_latin1, *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(system_charset_info, *from); from++) ;
|
||||
for (;from!=end && my_isdigit(my_charset_latin1, *from); from++) ;
|
||||
frac_digits_end=from;
|
||||
// Some exponentiation symbol ?
|
||||
if (from != end && (*from == 'e' || *from == 'E'))
|
||||
|
@ -522,7 +528,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(system_charset_info, *from); from++)
|
||||
for (;from!=end && my_isdigit(my_charset_latin1, *from); from++)
|
||||
{
|
||||
exponent=10*exponent+(*from-'0');
|
||||
if (exponent>MAX_EXPONENT)
|
||||
|
@ -540,7 +546,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(system_charset_info, *from); from++) ;
|
||||
for (;from != end && my_isspace(my_charset_latin1, *from); from++) ;
|
||||
if (from != end) // If still something left, warn
|
||||
{
|
||||
current_thd->cuted_fields++;
|
||||
|
@ -871,9 +877,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(system_charset_info,*a_ptr) || *a_ptr == '+' ||
|
||||
((my_isspace(my_charset_latin1,*a_ptr) || *a_ptr == '+' ||
|
||||
*a_ptr == '0') &&
|
||||
(my_isspace(system_charset_info,*b_ptr) || *b_ptr == '+' ||
|
||||
(my_isspace(my_charset_latin1,*b_ptr) || *b_ptr == '+' ||
|
||||
*b_ptr == '0')));
|
||||
a_ptr++,b_ptr++)
|
||||
{
|
||||
|
@ -901,7 +907,7 @@ void Field_decimal::sort_string(char *to,uint length)
|
|||
char *str,*end;
|
||||
for (str=ptr,end=ptr+length;
|
||||
str != end &&
|
||||
((my_isspace(system_charset_info,*str) || *str == '+' ||
|
||||
((my_isspace(my_charset_latin1,*str) || *str == '+' ||
|
||||
*str == '0')) ;
|
||||
str++)
|
||||
*to++=' ';
|
||||
|
@ -913,7 +919,7 @@ void Field_decimal::sort_string(char *to,uint length)
|
|||
*to++=1; // Smaller than any number
|
||||
str++;
|
||||
while (str != end)
|
||||
if (my_isdigit(system_charset_info,*str))
|
||||
if (my_isdigit(my_charset_latin1,*str))
|
||||
*to++= (char) ('9' - *str++);
|
||||
else
|
||||
*to++= *str++;
|
||||
|
@ -1091,7 +1097,7 @@ longlong Field_tiny::val_int(void)
|
|||
String *Field_tiny::val_str(String *val_buffer,
|
||||
String *val_ptr __attribute__((unused)))
|
||||
{
|
||||
CHARSET_INFO *cs=current_thd->thd_charset;
|
||||
CHARSET_INFO *cs=current_thd->variables.thd_charset;
|
||||
uint length;
|
||||
uint mlength=max(field_length+1,5*cs->mbmaxlen);
|
||||
val_buffer->alloc(mlength);
|
||||
|
@ -1330,7 +1336,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->thd_charset;
|
||||
CHARSET_INFO *cs=current_thd->variables.thd_charset;
|
||||
uint length;
|
||||
uint mlength=max(field_length+1,7*cs->mbmaxlen);
|
||||
val_buffer->alloc(mlength);
|
||||
|
@ -1574,7 +1580,7 @@ longlong Field_medium::val_int(void)
|
|||
String *Field_medium::val_str(String *val_buffer,
|
||||
String *val_ptr __attribute__((unused)))
|
||||
{
|
||||
CHARSET_INFO *cs=current_thd->thd_charset;
|
||||
CHARSET_INFO *cs=current_thd->variables.thd_charset;
|
||||
uint length;
|
||||
uint mlength=max(field_length+1,10*cs->mbmaxlen);
|
||||
val_buffer->alloc(mlength);
|
||||
|
@ -1810,7 +1816,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->thd_charset;
|
||||
CHARSET_INFO *cs=current_thd->variables.thd_charset;
|
||||
uint length;
|
||||
uint mlength=max(field_length+1,12*cs->mbmaxlen);
|
||||
val_buffer->alloc(mlength);
|
||||
|
@ -2035,7 +2041,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->thd_charset;
|
||||
CHARSET_INFO *cs=current_thd->variables.thd_charset;
|
||||
uint length;
|
||||
uint mlength=max(field_length+1,22*cs->mbmaxlen);
|
||||
val_buffer->alloc(mlength);
|
||||
|
@ -4432,14 +4438,14 @@ int Field_blob::store(const char *from,uint len,CHARSET_INFO *cs)
|
|||
|
||||
int Field_blob::store(double nr)
|
||||
{
|
||||
value.set(nr,2,current_thd->thd_charset);
|
||||
value.set(nr,2,current_thd->variables.thd_charset);
|
||||
return Field_blob::store(value.ptr(),(uint) value.length(), value.charset());
|
||||
}
|
||||
|
||||
|
||||
int Field_blob::store(longlong nr)
|
||||
{
|
||||
value.set(nr,current_thd->thd_charset);
|
||||
value.set(nr,current_thd->variables.thd_charset);
|
||||
return Field_blob::store(value.ptr(), (uint) value.length(), value.charset());
|
||||
}
|
||||
|
||||
|
|
|
@ -272,7 +272,7 @@ static void do_conv_blob(Copy_field *copy)
|
|||
static void do_save_blob(Copy_field *copy)
|
||||
{
|
||||
char buff[MAX_FIELD_WIDTH];
|
||||
String res(buff,sizeof(buff),default_charset_info);
|
||||
String res(buff,sizeof(buff),copy->tmp.charset());
|
||||
copy->from_field->val_str(&res,&res);
|
||||
copy->tmp.copy(res);
|
||||
((Field_blob *) copy->to_field)->store(copy->tmp.ptr(),
|
||||
|
@ -284,7 +284,7 @@ static void do_save_blob(Copy_field *copy)
|
|||
static void do_field_string(Copy_field *copy)
|
||||
{
|
||||
char buff[MAX_FIELD_WIDTH];
|
||||
copy->tmp.set_quick(buff,sizeof(buff),default_charset_info);
|
||||
copy->tmp.set_quick(buff,sizeof(buff),copy->tmp.charset());
|
||||
copy->from_field->val_str(©->tmp,©->tmp);
|
||||
copy->to_field->store(copy->tmp.c_ptr_quick(),copy->tmp.length(),copy->tmp.charset());
|
||||
}
|
||||
|
@ -313,7 +313,7 @@ static void do_cut_string(Copy_field *copy)
|
|||
ptr != end ;
|
||||
ptr++)
|
||||
{
|
||||
if (!my_isspace(system_charset_info, *ptr))
|
||||
if (!my_isspace(system_charset_info, *ptr)) // QQ: ucs incompatible
|
||||
{
|
||||
current_thd->cuted_fields++; // Give a warning
|
||||
break;
|
||||
|
@ -555,7 +555,7 @@ void field_conv(Field *to,Field *from)
|
|||
to->type() == FIELD_TYPE_DECIMAL)
|
||||
{
|
||||
char buff[MAX_FIELD_WIDTH];
|
||||
String result(buff,sizeof(buff),default_charset_info);
|
||||
String result(buff,sizeof(buff),from->charset());
|
||||
from->val_str(&result,&result);
|
||||
to->store(result.c_ptr_quick(),result.length(),to->charset());
|
||||
// QQ: what to do if "from" and "to" are of dirrent charsets?
|
||||
|
|
|
@ -221,10 +221,10 @@ my_string ip_to_hostname(struct in_addr *in, uint *errors)
|
|||
|
||||
/* Don't accept hostnames that starts with digits because they may be
|
||||
false ip:s */
|
||||
if (my_isdigit(system_charset_info,name[0]))
|
||||
if (my_isdigit(my_charset_latin1,name[0]))
|
||||
{
|
||||
char *pos;
|
||||
for (pos= name+1 ; my_isdigit(system_charset_info,*pos); pos++) ;
|
||||
for (pos= name+1 ; my_isdigit(my_charset_latin1,*pos); pos++) ;
|
||||
if (*pos == '.')
|
||||
{
|
||||
DBUG_PRINT("error",("mysqld doesn't accept hostnames that starts with a number followed by a '.'"));
|
||||
|
|
|
@ -151,7 +151,7 @@ bool Item::get_time(TIME *ltime)
|
|||
|
||||
CHARSET_INFO * Item::thd_charset() const
|
||||
{
|
||||
return current_thd->thd_charset;
|
||||
return current_thd->variables.thd_charset;
|
||||
}
|
||||
|
||||
Item_field::Item_field(Field *f) :Item_ident(NullS,f->table_name,f->field_name)
|
||||
|
|
|
@ -1383,14 +1383,14 @@ String *Item_func_database::val_str(String *str)
|
|||
str->length(0);
|
||||
else
|
||||
str->copy((const char*) thd->db,(uint) strlen(thd->db),
|
||||
system_charset_info, thd->thd_charset);
|
||||
system_charset_info, thd->variables.thd_charset);
|
||||
return str;
|
||||
}
|
||||
|
||||
String *Item_func_user::val_str(String *str)
|
||||
{
|
||||
THD *thd=current_thd;
|
||||
CHARSET_INFO *cs=thd->thd_charset;
|
||||
CHARSET_INFO *cs=thd->variables.thd_charset;
|
||||
const char *host=thd->host ? thd->host : thd->ip ? thd->ip : "";
|
||||
uint32 res_length=(strlen(thd->user)+strlen(host)+10) * cs->mbmaxlen;
|
||||
|
||||
|
|
|
@ -64,21 +64,21 @@ static String day_names[] =
|
|||
** DAY_TO_SECOND as "D MM:HH:SS", "MM:HH:SS" "HH:SS" or as seconds.
|
||||
*/
|
||||
|
||||
bool get_interval_info(const char *str,uint length,uint count,
|
||||
long *values)
|
||||
bool get_interval_info(const char *str,uint length,CHARSET_INFO *cs,
|
||||
uint count, long *values)
|
||||
{
|
||||
const char *end=str+length;
|
||||
uint i;
|
||||
while (str != end && !my_isdigit(system_charset_info,*str))
|
||||
while (str != end && !my_isdigit(cs,*str))
|
||||
str++;
|
||||
|
||||
for (i=0 ; i < count ; i++)
|
||||
{
|
||||
long value;
|
||||
for (value=0; str != end && my_isdigit(system_charset_info,*str) ; str++)
|
||||
for (value=0; str != end && my_isdigit(cs,*str) ; str++)
|
||||
value=value*10L + (long) (*str - '0');
|
||||
values[i]= value;
|
||||
while (str != end && !my_isdigit(system_charset_info,*str))
|
||||
while (str != end && !my_isdigit(cs,*str))
|
||||
str++;
|
||||
if (str == end && i != count-1)
|
||||
{
|
||||
|
@ -306,6 +306,7 @@ static bool get_interval_value(Item *args,interval_type int_type,
|
|||
const char *str;
|
||||
uint32 length;
|
||||
LINT_INIT(value); LINT_INIT(str); LINT_INIT(length);
|
||||
CHARSET_INFO *cs=str_value->charset();
|
||||
|
||||
bzero((char*) t,sizeof(*t));
|
||||
if ((int) int_type <= INTERVAL_SECOND)
|
||||
|
@ -328,7 +329,7 @@ static bool get_interval_value(Item *args,interval_type int_type,
|
|||
/* record negative intervalls in t->neg */
|
||||
str=res->ptr();
|
||||
const char *end=str+res->length();
|
||||
while (str != end && my_isspace(system_charset_info,*str))
|
||||
while (str != end && my_isspace(cs,*str))
|
||||
str++;
|
||||
if (str != end && *str == '-')
|
||||
{
|
||||
|
@ -358,26 +359,26 @@ static bool get_interval_value(Item *args,interval_type int_type,
|
|||
t->second=value;
|
||||
break;
|
||||
case INTERVAL_YEAR_MONTH: // Allow YEAR-MONTH YYYYYMM
|
||||
if (get_interval_info(str,length,2,array))
|
||||
if (get_interval_info(str,length,cs,2,array))
|
||||
return (1);
|
||||
t->year=array[0];
|
||||
t->month=array[1];
|
||||
break;
|
||||
case INTERVAL_DAY_HOUR:
|
||||
if (get_interval_info(str,length,2,array))
|
||||
if (get_interval_info(str,length,cs,2,array))
|
||||
return (1);
|
||||
t->day=array[0];
|
||||
t->hour=array[1];
|
||||
break;
|
||||
case INTERVAL_DAY_MINUTE:
|
||||
if (get_interval_info(str,length,3,array))
|
||||
if (get_interval_info(str,length,cs,3,array))
|
||||
return (1);
|
||||
t->day=array[0];
|
||||
t->hour=array[1];
|
||||
t->minute=array[2];
|
||||
break;
|
||||
case INTERVAL_DAY_SECOND:
|
||||
if (get_interval_info(str,length,4,array))
|
||||
if (get_interval_info(str,length,cs,4,array))
|
||||
return (1);
|
||||
t->day=array[0];
|
||||
t->hour=array[1];
|
||||
|
@ -385,20 +386,20 @@ static bool get_interval_value(Item *args,interval_type int_type,
|
|||
t->second=array[3];
|
||||
break;
|
||||
case INTERVAL_HOUR_MINUTE:
|
||||
if (get_interval_info(str,length,2,array))
|
||||
if (get_interval_info(str,length,cs,2,array))
|
||||
return (1);
|
||||
t->hour=array[0];
|
||||
t->minute=array[1];
|
||||
break;
|
||||
case INTERVAL_HOUR_SECOND:
|
||||
if (get_interval_info(str,length,3,array))
|
||||
if (get_interval_info(str,length,cs,3,array))
|
||||
return (1);
|
||||
t->hour=array[0];
|
||||
t->minute=array[1];
|
||||
t->second=array[2];
|
||||
break;
|
||||
case INTERVAL_MINUTE_SECOND:
|
||||
if (get_interval_info(str,length,2,array))
|
||||
if (get_interval_info(str,length,cs,2,array))
|
||||
return (1);
|
||||
t->minute=array[0];
|
||||
t->second=array[1];
|
||||
|
|
|
@ -26,6 +26,8 @@
|
|||
|
||||
#include <assert.h>
|
||||
|
||||
#define log_cs my_charset_latin1
|
||||
|
||||
/*****************************************************************************
|
||||
|
||||
my_b_safe_write()
|
||||
|
@ -676,7 +678,7 @@ 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), system_charset_info);
|
||||
String tmp(buf, sizeof(buf), log_cs);
|
||||
tmp.length(0);
|
||||
if (db && db_len)
|
||||
{
|
||||
|
@ -930,7 +932,7 @@ int Query_log_event::exec_event(struct st_relay_log_info* rli)
|
|||
void Start_log_event::pack_info(Protocol *protocol)
|
||||
{
|
||||
char buf1[256];
|
||||
String tmp(buf1, sizeof(buf1), system_charset_info);
|
||||
String tmp(buf1, sizeof(buf1), log_cs);
|
||||
tmp.length(0);
|
||||
char buf[22];
|
||||
|
||||
|
@ -1041,7 +1043,7 @@ int Start_log_event::exec_event(struct st_relay_log_info* rli)
|
|||
void Load_log_event::pack_info(Protocol *protocol)
|
||||
{
|
||||
char buf[256];
|
||||
String tmp(buf, sizeof(buf), system_charset_info);
|
||||
String tmp(buf, sizeof(buf), log_cs);
|
||||
tmp.length(0);
|
||||
if (db && db_len)
|
||||
{
|
||||
|
@ -1453,15 +1455,11 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli)
|
|||
handle_dup = DUP_REPLACE;
|
||||
sql_exchange ex((char*)fname, sql_ex.opt_flags &&
|
||||
DUMPFILE_FLAG );
|
||||
String field_term(sql_ex.field_term,sql_ex.field_term_len,
|
||||
system_charset_info);
|
||||
String enclosed(sql_ex.enclosed,sql_ex.enclosed_len,
|
||||
system_charset_info);
|
||||
String line_term(sql_ex.line_term,sql_ex.line_term_len,
|
||||
system_charset_info);
|
||||
String line_start(sql_ex.line_start,sql_ex.line_start_len,
|
||||
system_charset_info);
|
||||
String escaped(sql_ex.escaped,sql_ex.escaped_len, system_charset_info);
|
||||
String field_term(sql_ex.field_term,sql_ex.field_term_len,log_cs);
|
||||
String enclosed(sql_ex.enclosed,sql_ex.enclosed_len,log_cs);
|
||||
String line_term(sql_ex.line_term,sql_ex.line_term_len,log_cs);
|
||||
String line_start(sql_ex.line_start,sql_ex.line_start_len,log_cs);
|
||||
String escaped(sql_ex.escaped,sql_ex.escaped_len, log_cs);
|
||||
|
||||
ex.opt_enclosed = (sql_ex.opt_flags & OPT_ENCLOSED_FLAG);
|
||||
if (sql_ex.empty_flags & FIELD_TERM_EMPTY)
|
||||
|
@ -1547,7 +1545,7 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli)
|
|||
void Rotate_log_event::pack_info(Protocol *protocol)
|
||||
{
|
||||
char buf1[256], buf[22];
|
||||
String tmp(buf1, sizeof(buf1), system_charset_info);
|
||||
String tmp(buf1, sizeof(buf1), log_cs);
|
||||
tmp.length(0);
|
||||
tmp.append(new_log_ident, ident_len);
|
||||
tmp.append(";pos=");
|
||||
|
@ -1685,7 +1683,7 @@ int Rotate_log_event::exec_event(struct st_relay_log_info* rli)
|
|||
void Intvar_log_event::pack_info(Protocol *protocol)
|
||||
{
|
||||
char buf1[256], buf[22];
|
||||
String tmp(buf1, sizeof(buf1), system_charset_info);
|
||||
String tmp(buf1, sizeof(buf1), log_cs);
|
||||
tmp.length(0);
|
||||
tmp.append(get_var_type_name());
|
||||
tmp.append('=');
|
||||
|
@ -1893,7 +1891,7 @@ int Rand_log_event::exec_event(struct st_relay_log_info* rli)
|
|||
void Slave_log_event::pack_info(Protocol *protocol)
|
||||
{
|
||||
char buf1[256], buf[22], *end;
|
||||
String tmp(buf1, sizeof(buf1), system_charset_info);
|
||||
String tmp(buf1, sizeof(buf1), log_cs);
|
||||
tmp.length(0);
|
||||
tmp.append("host=");
|
||||
tmp.append(master_host);
|
||||
|
@ -2241,7 +2239,7 @@ void Create_file_log_event::print(FILE* file, bool short_form,
|
|||
void Create_file_log_event::pack_info(Protocol *protocol)
|
||||
{
|
||||
char buf1[256],buf[22], *end;
|
||||
String tmp(buf1, sizeof(buf1), system_charset_info);
|
||||
String tmp(buf1, sizeof(buf1), log_cs);
|
||||
tmp.length(0);
|
||||
tmp.append("db=");
|
||||
tmp.append(db, db_len);
|
||||
|
|
|
@ -687,7 +687,7 @@ bool Protocol_simple::store(float from, uint32 decimals, String *buffer)
|
|||
DBUG_ASSERT(field_types == 0 ||
|
||||
field_types[field_pos++] == MYSQL_TYPE_FLOAT);
|
||||
#endif
|
||||
buffer->set((double) from, decimals, thd->thd_charset);
|
||||
buffer->set((double) from, decimals, thd->variables.thd_charset);
|
||||
return net_store_data(packet,(char*) buffer->ptr(), buffer->length());
|
||||
}
|
||||
|
||||
|
@ -697,7 +697,7 @@ bool Protocol_simple::store(double from, uint32 decimals, String *buffer)
|
|||
DBUG_ASSERT(field_types == 0 ||
|
||||
field_types[field_pos++] == MYSQL_TYPE_DOUBLE);
|
||||
#endif
|
||||
buffer->set(from, decimals, thd->thd_charset);
|
||||
buffer->set(from, decimals, thd->variables.thd_charset);
|
||||
return net_store_data(packet,(char*) buffer->ptr(), buffer->length());
|
||||
}
|
||||
|
||||
|
|
|
@ -452,7 +452,7 @@ public:
|
|||
{
|
||||
Item_field *item= (Item_field*) value_arg;
|
||||
if (!(value=new Item_string(item->field_name, strlen(item->field_name),
|
||||
system_charset_info)))
|
||||
item->charset())))
|
||||
value=value_arg; /* Give error message later */
|
||||
}
|
||||
else
|
||||
|
|
|
@ -898,14 +898,14 @@ int collect_real(double *element, element_count count __attribute__((unused)),
|
|||
TREE_INFO *info)
|
||||
{
|
||||
char buff[MAX_FIELD_WIDTH];
|
||||
String s(buff, sizeof(buff),current_thd->thd_charset);
|
||||
String s(buff, sizeof(buff),current_thd->variables.thd_charset);
|
||||
|
||||
if (info->found)
|
||||
info->str->append(',');
|
||||
else
|
||||
info->found = 1;
|
||||
info->str->append('\'');
|
||||
s.set(*element, info->item->decimals, current_thd->thd_charset);
|
||||
s.set(*element, info->item->decimals, current_thd->variables.thd_charset);
|
||||
info->str->append(s);
|
||||
info->str->append('\'');
|
||||
return 0;
|
||||
|
|
|
@ -105,7 +105,6 @@ THD::THD():user_time(0), fatal_error(0),
|
|||
cond_count=0;
|
||||
warn_id= 0;
|
||||
db_charset=default_charset_info;
|
||||
thd_charset=default_charset_info;
|
||||
mysys_var=0;
|
||||
#ifndef DBUG_OFF
|
||||
dbug_sentry=THD_SENTRY_MAGIC;
|
||||
|
@ -190,6 +189,7 @@ void THD::init(void)
|
|||
{
|
||||
pthread_mutex_lock(&LOCK_global_system_variables);
|
||||
variables= global_system_variables;
|
||||
variables.thd_charset=default_charset_info;
|
||||
pthread_mutex_unlock(&LOCK_global_system_variables);
|
||||
server_status= SERVER_STATUS_AUTOCOMMIT;
|
||||
options= thd_startup_options;
|
||||
|
|
|
@ -373,7 +373,8 @@ struct system_variables
|
|||
my_bool log_warnings;
|
||||
my_bool low_priority_updates;
|
||||
|
||||
CONVERT *convert_set;
|
||||
CONVERT *convert_set;
|
||||
CHARSET_INFO *thd_charset;
|
||||
};
|
||||
|
||||
|
||||
|
@ -487,7 +488,6 @@ public:
|
|||
table_map used_tables;
|
||||
USER_CONN *user_connect;
|
||||
CHARSET_INFO *db_charset;
|
||||
CHARSET_INFO *thd_charset;
|
||||
List<Item> *possible_loops; // Items that may cause loops in subselects
|
||||
List <MYSQL_ERROR> warn_list;
|
||||
uint warn_count[(uint) MYSQL_ERROR::WARN_LEVEL_END];
|
||||
|
|
|
@ -599,7 +599,7 @@ bool mysql_change_db(THD *thd, const char *name)
|
|||
strmov(path+unpack_dirname(path,path), MY_DB_OPT_FILE);
|
||||
load_db_opt(path, &create);
|
||||
thd->db_charset=create.table_charset;
|
||||
thd->thd_charset=thd->db_charset ? thd->db_charset : default_charset_info;
|
||||
thd->variables.thd_charset=thd->db_charset ? thd->db_charset : default_charset_info;
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
|
|
|
@ -713,7 +713,7 @@ mysqld_show_fields(THD *thd, TABLE_LIST *table_list,const char *wild,
|
|||
{
|
||||
byte *pos;
|
||||
uint flags=field->flags;
|
||||
String type(tmp,sizeof(tmp),current_thd->thd_charset);
|
||||
String type(tmp,sizeof(tmp),current_thd->variables.thd_charset);
|
||||
uint col_access;
|
||||
bool null_default_value=0;
|
||||
|
||||
|
|
|
@ -1270,6 +1270,7 @@ opt_binary:
|
|||
YYABORT;
|
||||
}
|
||||
}
|
||||
| COLLATE_SYM charset_name { Lex->charset=$2; }
|
||||
| CHAR_SYM SET charset_name { Lex->charset=$3; } ;
|
||||
|
||||
opt_primary:
|
||||
|
@ -3599,13 +3600,13 @@ opt_ignore_lines:
|
|||
/* Common definitions */
|
||||
|
||||
text_literal:
|
||||
TEXT_STRING { $$ = new Item_string($1.str,$1.length,YYTHD->thd_charset); }
|
||||
TEXT_STRING { $$ = new Item_string($1.str,$1.length,YYTHD->variables.thd_charset); }
|
||||
| UNDERSCORE_CHARSET TEXT_STRING { $$ = new Item_string($2.str,$2.length,Lex->charset); }
|
||||
| text_literal TEXT_STRING
|
||||
{ ((Item_string*) $1)->append($2.str,$2.length); };
|
||||
|
||||
text_string:
|
||||
TEXT_STRING { $$= new String($1.str,$1.length,YYTHD->thd_charset); }
|
||||
TEXT_STRING { $$= new String($1.str,$1.length,YYTHD->variables.thd_charset); }
|
||||
| HEX_NUM
|
||||
{
|
||||
Item *tmp = new Item_varbinary($1.str,$1.length);
|
||||
|
|
Loading…
Reference in a new issue