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

Some system_charset_info and default_charset_info were replaced by my_charset_latin1

parent 34033b93
...@@ -433,17 +433,7 @@ CONVERT *get_convert_set(const char *name) ...@@ -433,17 +433,7 @@ CONVERT *get_convert_set(const char *name)
{ {
for (CONVERT **ptr=convert_tables ; *ptr ; ptr++) for (CONVERT **ptr=convert_tables ; *ptr ; ptr++)
{ {
/* if (!my_strcasecmp(my_charset_latin1,(*ptr)->name,name))
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))
return (*ptr); return (*ptr);
} }
return 0; return 0;
......
...@@ -290,23 +290,23 @@ void Field::store_time(TIME *ltime,timestamp_type type) ...@@ -290,23 +290,23 @@ void Field::store_time(TIME *ltime,timestamp_type type)
char buff[25]; char buff[25];
switch (type) { switch (type) {
case TIMESTAMP_NONE: case TIMESTAMP_NONE:
store("",0,default_charset_info); // Probably an error store("",0,my_charset_latin1); // Probably an error
break; break;
case TIMESTAMP_DATE: case TIMESTAMP_DATE:
sprintf(buff,"%04d-%02d-%02d", ltime->year,ltime->month,ltime->day); sprintf(buff,"%04d-%02d-%02d", ltime->year,ltime->month,ltime->day);
store(buff,10,default_charset_info); store(buff,10,my_charset_latin1);
break; break;
case TIMESTAMP_FULL: case TIMESTAMP_FULL:
sprintf(buff,"%04d-%02d-%02d %02d:%02d:%02d", sprintf(buff,"%04d-%02d-%02d %02d:%02d:%02d",
ltime->year,ltime->month,ltime->day, ltime->year,ltime->month,ltime->day,
ltime->hour,ltime->minute,ltime->second); ltime->hour,ltime->minute,ltime->second);
store(buff,19,default_charset_info); store(buff,19,my_charset_latin1);
break; break;
case TIMESTAMP_TIME: case TIMESTAMP_TIME:
{ {
ulong length= my_sprintf(buff, (buff, "%02d:%02d:%02d", ulong length= my_sprintf(buff, (buff, "%02d:%02d:%02d",
ltime->hour,ltime->minute,ltime->second)); ltime->hour,ltime->minute,ltime->second));
store(buff,(uint) length, default_charset_info); store(buff,(uint) length, my_charset_latin1);
break; break;
} }
} }
...@@ -326,7 +326,7 @@ bool Field::optimize_range(uint idx) ...@@ -326,7 +326,7 @@ bool Field::optimize_range(uint idx)
void void
Field_decimal::reset(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) void Field_decimal::overflow(bool negative)
...@@ -3785,7 +3785,7 @@ int Field_string::store(double nr) ...@@ -3785,7 +3785,7 @@ int Field_string::store(double nr)
int width=min(field_length,DBL_DIG+5); int width=min(field_length,DBL_DIG+5);
sprintf(buff,"%-*.*g",width,max(width-5,0),nr); sprintf(buff,"%-*.*g",width,max(width-5,0),nr);
end=strcend(buff,' '); 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) ...@@ -3984,7 +3984,7 @@ int Field_varstring::store(double nr)
int width=min(field_length,DBL_DIG+5); int width=min(field_length,DBL_DIG+5);
sprintf(buff,"%-*.*g",width,max(width-5,0),nr); sprintf(buff,"%-*.*g",width,max(width-5,0),nr);
end=strcend(buff,' '); 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 ...@@ -4550,7 +4550,7 @@ void Field_blob::sql_type(String &res) const
case 3: str="medium"; break; case 3: str="medium"; break;
case 4: str="long"; 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"); res.append(binary() ? "blob" : "text");
if (!binary()) if (!binary())
{ {
...@@ -5314,7 +5314,7 @@ create_field::create_field(Field *old_field,Field *orig_field) ...@@ -5314,7 +5314,7 @@ create_field::create_field(Field *old_field,Field *orig_field)
orig_field) orig_field)
{ {
char buff[MAX_FIELD_WIDTH],*pos; 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); String tmp(buff,sizeof(buff),field_charset);
/* Get the value from record[2] (the default value row) */ /* Get the value from record[2] (the default value row) */
......
...@@ -263,7 +263,8 @@ static void do_conv_blob(Copy_field *copy) ...@@ -263,7 +263,8 @@ static void do_conv_blob(Copy_field *copy)
{ {
copy->from_field->val_str(&copy->tmp,&copy->tmp); copy->from_field->val_str(&copy->tmp,&copy->tmp);
((Field_blob *) copy->to_field)->store(copy->tmp.ptr(), ((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 */ /* Save blob in copy->tmp for GROUP BY */
...@@ -275,7 +276,8 @@ static void do_save_blob(Copy_field *copy) ...@@ -275,7 +276,8 @@ static void do_save_blob(Copy_field *copy)
copy->from_field->val_str(&res,&res); copy->from_field->val_str(&res,&res);
copy->tmp.copy(res); copy->tmp.copy(res);
((Field_blob *) copy->to_field)->store(copy->tmp.ptr(), ((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) ...@@ -284,7 +286,7 @@ static void do_field_string(Copy_field *copy)
char buff[MAX_FIELD_WIDTH]; char buff[MAX_FIELD_WIDTH];
copy->tmp.set_quick(buff,sizeof(buff),default_charset_info); copy->tmp.set_quick(buff,sizeof(buff),default_charset_info);
copy->from_field->val_str(&copy->tmp,&copy->tmp); 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());
} }
......
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