Some system_charset_info and default_charset_info were replaced by my_charset_latin1

This commit is contained in:
bar@bar.mysql.r18.ru 2002-12-11 17:12:55 +04:00
parent 34033b9389
commit 40f828d5f1
3 changed files with 15 additions and 23 deletions

View File

@ -433,17 +433,7 @@ CONVERT *get_convert_set(const char *name)
{
for (CONVERT **ptr=convert_tables ; *ptr ; ptr++)
{
/*
BAR TODO: Monty's comments:
Why is this using system_charset_info ?
Isn't the character-set string given in the users default charset?
Please add a TODO note to the code that this has to be fixed when the user
will be able to cast strings to different character sets...
The current code will also not work if/when we introduce support for
16 bit characters...
(I know that there is a LOT of changes to do if we ever want do this...)
*/
if (!my_strcasecmp(system_charset_info,(*ptr)->name,name))
if (!my_strcasecmp(my_charset_latin1,(*ptr)->name,name))
return (*ptr);
}
return 0;

View File

@ -290,23 +290,23 @@ void Field::store_time(TIME *ltime,timestamp_type type)
char buff[25];
switch (type) {
case TIMESTAMP_NONE:
store("",0,default_charset_info); // Probably an error
store("",0,my_charset_latin1); // Probably an error
break;
case TIMESTAMP_DATE:
sprintf(buff,"%04d-%02d-%02d", ltime->year,ltime->month,ltime->day);
store(buff,10,default_charset_info);
store(buff,10,my_charset_latin1);
break;
case TIMESTAMP_FULL:
sprintf(buff,"%04d-%02d-%02d %02d:%02d:%02d",
ltime->year,ltime->month,ltime->day,
ltime->hour,ltime->minute,ltime->second);
store(buff,19,default_charset_info);
store(buff,19,my_charset_latin1);
break;
case TIMESTAMP_TIME:
{
ulong length= my_sprintf(buff, (buff, "%02d:%02d:%02d",
ltime->hour,ltime->minute,ltime->second));
store(buff,(uint) length, default_charset_info);
store(buff,(uint) length, my_charset_latin1);
break;
}
}
@ -326,7 +326,7 @@ bool Field::optimize_range(uint idx)
void
Field_decimal::reset(void)
{
Field_decimal::store("0",1,default_charset_info);
Field_decimal::store("0",1,my_charset_latin1);
}
void Field_decimal::overflow(bool negative)
@ -3785,7 +3785,7 @@ int Field_string::store(double nr)
int width=min(field_length,DBL_DIG+5);
sprintf(buff,"%-*.*g",width,max(width-5,0),nr);
end=strcend(buff,' ');
return Field_string::store(buff,(uint) (end - buff), default_charset_info);
return Field_string::store(buff,(uint) (end - buff), my_charset_latin1);
}
@ -3984,7 +3984,7 @@ int Field_varstring::store(double nr)
int width=min(field_length,DBL_DIG+5);
sprintf(buff,"%-*.*g",width,max(width-5,0),nr);
end=strcend(buff,' ');
return Field_varstring::store(buff,(uint) (end - buff), default_charset_info);
return Field_varstring::store(buff,(uint) (end - buff), my_charset_latin1);
}
@ -4550,7 +4550,7 @@ void Field_blob::sql_type(String &res) const
case 3: str="medium"; break;
case 4: str="long"; break;
}
res.set(str,(uint) strlen(str),default_charset_info);
res.set(str,(uint) strlen(str),my_charset_latin1);
res.append(binary() ? "blob" : "text");
if (!binary())
{
@ -5314,7 +5314,7 @@ create_field::create_field(Field *old_field,Field *orig_field)
orig_field)
{
char buff[MAX_FIELD_WIDTH],*pos;
CHARSET_INFO *field_charset= charset ? charset : default_charset_info;
CHARSET_INFO *field_charset= charset;
String tmp(buff,sizeof(buff),field_charset);
/* Get the value from record[2] (the default value row) */

View File

@ -263,7 +263,8 @@ static void do_conv_blob(Copy_field *copy)
{
copy->from_field->val_str(&copy->tmp,&copy->tmp);
((Field_blob *) copy->to_field)->store(copy->tmp.ptr(),
copy->tmp.length(),default_charset_info);
copy->tmp.length(),
copy->tmp.charset());
}
/* Save blob in copy->tmp for GROUP BY */
@ -275,7 +276,8 @@ static void do_save_blob(Copy_field *copy)
copy->from_field->val_str(&res,&res);
copy->tmp.copy(res);
((Field_blob *) copy->to_field)->store(copy->tmp.ptr(),
copy->tmp.length(),default_charset_info);
copy->tmp.length(),
copy->tmp.charset());
}
@ -284,7 +286,7 @@ static void do_field_string(Copy_field *copy)
char buff[MAX_FIELD_WIDTH];
copy->tmp.set_quick(buff,sizeof(buff),default_charset_info);
copy->from_field->val_str(&copy->tmp,&copy->tmp);
copy->to_field->store(copy->tmp.c_ptr_quick(),copy->tmp.length(),default_charset_info);
copy->to_field->store(copy->tmp.c_ptr_quick(),copy->tmp.length(),copy->tmp.charset());
}