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

less default_charset_info

parent df64544b
...@@ -1883,7 +1883,7 @@ longlong Item_func_set_last_insert_id::val_int() ...@@ -1883,7 +1883,7 @@ longlong Item_func_set_last_insert_id::val_int()
longlong Item_func_benchmark::val_int() longlong Item_func_benchmark::val_int()
{ {
char buff[MAX_FIELD_WIDTH]; char buff[MAX_FIELD_WIDTH];
String tmp(buff,sizeof(buff), default_charset_info); String tmp(buff,sizeof(buff), NULL);
THD *thd=current_thd; THD *thd=current_thd;
for (ulong loop=0 ; loop < loop_count && !thd->killed; loop++) for (ulong loop=0 ; loop < loop_count && !thd->killed; loop++)
...@@ -2029,7 +2029,7 @@ Item_func_set_user_var::update() ...@@ -2029,7 +2029,7 @@ Item_func_set_user_var::update()
case STRING_RESULT: case STRING_RESULT:
{ {
char buffer[MAX_FIELD_WIDTH]; char buffer[MAX_FIELD_WIDTH];
String tmp(buffer,sizeof(buffer),default_charset_info); String tmp(buffer,sizeof(buffer),NULL);
(void) val_str(&tmp); (void) val_str(&tmp);
break; break;
} }
...@@ -2221,7 +2221,7 @@ longlong Item_func_inet_aton::val_int() ...@@ -2221,7 +2221,7 @@ longlong Item_func_inet_aton::val_int()
char c = '.'; // we mark c to indicate invalid IP in case length is 0 char c = '.'; // we mark c to indicate invalid IP in case length is 0
char buff[36]; char buff[36];
String *s,tmp(buff,sizeof(buff),default_charset_info); String *s,tmp(buff,sizeof(buff),NULL);
if (!(s = args[0]->val_str(&tmp))) // If null value if (!(s = args[0]->val_str(&tmp))) // If null value
goto err; goto err;
null_value=0; null_value=0;
...@@ -2275,7 +2275,7 @@ void Item_func_match::init_search(bool no_order) ...@@ -2275,7 +2275,7 @@ void Item_func_match::init_search(bool no_order)
String *ft_tmp= 0; String *ft_tmp= 0;
char tmp1[FT_QUERY_MAXLEN]; char tmp1[FT_QUERY_MAXLEN];
String tmp2(tmp1,sizeof(tmp1),default_charset_info); String tmp2(tmp1,sizeof(tmp1),NULL);
// MATCH ... AGAINST (NULL) is meaningless, but possible // MATCH ... AGAINST (NULL) is meaningless, but possible
if (!(ft_tmp=key_item()->val_str(&tmp2))) if (!(ft_tmp=key_item()->val_str(&tmp2)))
......
...@@ -1438,6 +1438,8 @@ String *Item_func_soundex::val_str(String *str) ...@@ -1438,6 +1438,8 @@ String *Item_func_soundex::val_str(String *str)
{ {
String *res =args[0]->val_str(str); String *res =args[0]->val_str(str);
char last_ch,ch; char last_ch,ch;
CHARSET_INFO *cs=my_charset_latin1;
if ((null_value=args[0]->null_value)) if ((null_value=args[0]->null_value))
return 0; /* purecov: inspected */ return 0; /* purecov: inspected */
...@@ -1445,22 +1447,23 @@ String *Item_func_soundex::val_str(String *str) ...@@ -1445,22 +1447,23 @@ String *Item_func_soundex::val_str(String *str)
return str; /* purecov: inspected */ return str; /* purecov: inspected */
char *to= (char *) tmp_value.ptr(); char *to= (char *) tmp_value.ptr();
char *from= (char *) res->ptr(), *end=from+res->length(); char *from= (char *) res->ptr(), *end=from+res->length();
tmp_value.set_charset(cs);
while (from != end && my_isspace(str->charset(),*from)) // Skip pre-space while (from != end && my_isspace(cs,*from)) // Skip pre-space
from++; /* purecov: inspected */ from++; /* purecov: inspected */
if (from == end) if (from == end)
return &empty_string; // No alpha characters. return &empty_string; // No alpha characters.
*to++ = my_toupper(str->charset(),*from);// Copy first letter *to++ = my_toupper(cs,*from); // Copy first letter
last_ch = get_scode(str->charset(),from);// code of the first letter last_ch = get_scode(cs,from); // code of the first letter
// for the first 'double-letter check. // for the first 'double-letter check.
// Loop on input letters until // Loop on input letters until
// end of input (null) or output // end of input (null) or output
// letter code count = 3 // letter code count = 3
for (from++ ; from < end ; from++) for (from++ ; from < end ; from++)
{ {
if (!my_isalpha(str->charset(),*from)) if (!my_isalpha(cs,*from))
continue; continue;
ch=get_scode(str->charset(),from); ch=get_scode(cs,from);
if ((ch != '0') && (ch != last_ch)) // if not skipped or double if ((ch != '0') && (ch != last_ch)) // if not skipped or double
{ {
*to++ = ch; // letter, copy to output *to++ = ch; // letter, copy to output
......
...@@ -34,6 +34,8 @@ ...@@ -34,6 +34,8 @@
#include <ft_global.h> #include <ft_global.h>
#include <assert.h> #include <assert.h>
#define mysqld_charset my_charset_latin1
#ifndef DBUG_OFF #ifndef DBUG_OFF
#define ONE_THREAD #define ONE_THREAD
#endif #endif
...@@ -981,7 +983,7 @@ static void set_user(const char *user) ...@@ -981,7 +983,7 @@ static void set_user(const char *user)
{ {
// allow a numeric uid to be used // allow a numeric uid to be used
const char *pos; const char *pos;
for (pos=user; my_isdigit(system_charset_info,*pos); pos++) ; for (pos=user; my_isdigit(mysqld_charset,*pos); pos++) ;
if (*pos) // Not numeric id if (*pos) // Not numeric id
{ {
fprintf(stderr,"Fatal error: Can't change to run as user '%s' ; Please check that the user exists!\n",user); fprintf(stderr,"Fatal error: Can't change to run as user '%s' ; Please check that the user exists!\n",user);
...@@ -4373,7 +4375,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), ...@@ -4373,7 +4375,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
exit(1); exit(1);
} }
val= p--; val= p--;
while (my_isspace(system_charset_info, *p) && p > argument) while (my_isspace(mysqld_charset, *p) && p > argument)
*p-- = 0; *p-- = 0;
if (p == argument) if (p == argument)
{ {
...@@ -4383,7 +4385,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), ...@@ -4383,7 +4385,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
} }
*val= 0; *val= 0;
val+= 2; val+= 2;
while (*val && my_isspace(system_charset_info, *val)) while (*val && my_isspace(mysqld_charset, *val))
*val++; *val++;
if (!*val) if (!*val)
{ {
...@@ -4525,7 +4527,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), ...@@ -4525,7 +4527,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
have_symlink=SHOW_OPTION_DISABLED; have_symlink=SHOW_OPTION_DISABLED;
break; break;
case (int) OPT_BIND_ADDRESS: case (int) OPT_BIND_ADDRESS:
if (argument && my_isdigit(system_charset_info, argument[0])) if (argument && my_isdigit(mysqld_charset, argument[0]))
{ {
my_bind_addr = (ulong) inet_addr(argument); my_bind_addr = (ulong) inet_addr(argument);
} }
...@@ -4938,8 +4940,8 @@ static ulong find_bit_type(const char *x, TYPELIB *bit_lib) ...@@ -4938,8 +4940,8 @@ static ulong find_bit_type(const char *x, TYPELIB *bit_lib)
j=pos; j=pos;
while (j != end) while (j != end)
{ {
if (my_toupper(system_charset_info,*i++) != if (my_toupper(mysqld_charset,*i++) !=
my_toupper(system_charset_info,*j++)) my_toupper(mysqld_charset,*j++))
goto skipp; goto skipp;
} }
found_int=bit; found_int=bit;
......
...@@ -526,7 +526,7 @@ bool select_send::send_data(List<Item> &items) ...@@ -526,7 +526,7 @@ bool select_send::send_data(List<Item> &items)
List_iterator_fast<Item> li(items); List_iterator_fast<Item> li(items);
Protocol *protocol= thd->protocol; Protocol *protocol= thd->protocol;
char buff[MAX_FIELD_WIDTH]; char buff[MAX_FIELD_WIDTH];
String buffer(buff, sizeof(buff), system_charset_info); String buffer(buff, sizeof(buff), NULL);
DBUG_ENTER("send_data"); DBUG_ENTER("send_data");
protocol->prepare_for_resend(); protocol->prepare_for_resend();
...@@ -649,7 +649,7 @@ bool select_export::send_data(List<Item> &items) ...@@ -649,7 +649,7 @@ bool select_export::send_data(List<Item> &items)
DBUG_ENTER("send_data"); DBUG_ENTER("send_data");
char buff[MAX_FIELD_WIDTH],null_buff[2],space[MAX_FIELD_WIDTH]; char buff[MAX_FIELD_WIDTH],null_buff[2],space[MAX_FIELD_WIDTH];
bool space_inited=0; bool space_inited=0;
String tmp(buff,sizeof(buff),default_charset_info),*res; String tmp(buff,sizeof(buff),NULL),*res;
tmp.length(0); tmp.length(0);
if (unit->offset_limit_cnt) if (unit->offset_limit_cnt)
...@@ -710,10 +710,11 @@ bool select_export::send_data(List<Item> &items) ...@@ -710,10 +710,11 @@ bool select_export::send_data(List<Item> &items)
pos++) pos++)
{ {
#ifdef USE_MB #ifdef USE_MB
if (use_mb(default_charset_info)) CHARSET_INFO *res_charset=res->charset();
if (use_mb(res_charset))
{ {
int l; int l;
if ((l=my_ismbchar(default_charset_info, pos, end))) if ((l=my_ismbchar(res_charset, pos, end)))
{ {
pos += l-1; pos += l-1;
continue; continue;
...@@ -856,7 +857,7 @@ bool select_dump::send_data(List<Item> &items) ...@@ -856,7 +857,7 @@ bool select_dump::send_data(List<Item> &items)
{ {
List_iterator_fast<Item> li(items); List_iterator_fast<Item> li(items);
char buff[MAX_FIELD_WIDTH]; char buff[MAX_FIELD_WIDTH];
String tmp(buff,sizeof(buff),default_charset_info),*res; String tmp(buff,sizeof(buff),NULL),*res;
tmp.length(0); tmp.length(0);
Item *item; Item *item;
DBUG_ENTER("send_data"); DBUG_ENTER("send_data");
......
...@@ -22,6 +22,8 @@ ...@@ -22,6 +22,8 @@
** Get help on string ** Get help on string
***************************************************************************/ ***************************************************************************/
#define help_charset my_charset_latin1
MI_INFO *open_help_file(THD *thd, const char *name) MI_INFO *open_help_file(THD *thd, const char *name)
{ {
char path[FN_REFLEN]; char path[FN_REFLEN];
...@@ -104,21 +106,21 @@ int search_functions(MI_INFO *file_leafs, const char *mask, ...@@ -104,21 +106,21 @@ int search_functions(MI_INFO *file_leafs, const char *mask,
leaf.prepare_fields(); leaf.prepare_fields();
const char *lname= leaf.get_name(); const char *lname= leaf.get_name();
if (wild_case_compare(system_charset_info,lname,mask)) if (wild_case_compare(help_charset,lname,mask))
continue; continue;
count++; count++;
if (count>2) if (count>2)
{ {
String *s= new String(lname,system_charset_info); String *s= new String(lname,help_charset);
if (!s->copy()) if (!s->copy())
names->push_back(s); names->push_back(s);
} }
else if (count==1) else if (count==1)
{ {
*description= new String(leaf.get_description(),system_charset_info); *description= new String(leaf.get_description(),help_charset);
*example= new String(leaf.get_example(),system_charset_info); *example= new String(leaf.get_example(),help_charset);
*name= new String(lname,system_charset_info); *name= new String(lname,help_charset);
(*description)->copy(); (*description)->copy();
(*example)->copy(); (*example)->copy();
(*name)->copy(); (*name)->copy();
...@@ -132,7 +134,7 @@ int search_functions(MI_INFO *file_leafs, const char *mask, ...@@ -132,7 +134,7 @@ int search_functions(MI_INFO *file_leafs, const char *mask,
*description= 0; *description= 0;
*example= 0; *example= 0;
String *s= new String(lname,system_charset_info); String *s= new String(lname,help_charset);
if (!s->copy()) if (!s->copy())
names->push_back(s); names->push_back(s);
} }
...@@ -203,14 +205,14 @@ int search_categories(THD *thd, ...@@ -203,14 +205,14 @@ int search_categories(THD *thd,
category.prepare_fields(); category.prepare_fields();
const char *lname= category.get_name(); const char *lname= category.get_name();
if (mask && wild_case_compare(system_charset_info,lname,mask)) if (mask && wild_case_compare(help_charset,lname,mask))
continue; continue;
count++; count++;
if (count==1 && res_id) if (count==1 && res_id)
*res_id= category.get_cat_id(); *res_id= category.get_cat_id();
String *s= new String(lname,system_charset_info); String *s= new String(lname,help_charset);
if (!s->copy()) if (!s->copy())
names->push_back(s); names->push_back(s);
} }
...@@ -282,7 +284,7 @@ int get_all_names_for_category(THD *thd,MI_INFO *file_leafs, ...@@ -282,7 +284,7 @@ int get_all_names_for_category(THD *thd,MI_INFO *file_leafs,
(const byte*)&leaf_id,4,HA_READ_KEY_EXACT)) (const byte*)&leaf_id,4,HA_READ_KEY_EXACT))
{ {
leaf.prepare_fields(); leaf.prepare_fields();
String *s= new String(leaf.get_name(),system_charset_info); String *s= new String(leaf.get_name(),help_charset);
if (!s->copy()) if (!s->copy())
res->push_back(s); res->push_back(s);
} }
......
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