summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <bar@bar.mysql.r18.ru>2002-12-20 17:57:24 +0400
committerunknown <bar@bar.mysql.r18.ru>2002-12-20 17:57:24 +0400
commit3ebec6335139ff28537d6eb79344a682e2d853be (patch)
tree76cff86a72f4bce6c49c77e4b2e9972a31fed1cd
parent197e7a29283ae4d567eca72682984ae53e13d184 (diff)
downloadmariadb-git-3ebec6335139ff28537d6eb79344a682e2d853be.tar.gz
less default_charset_info
-rw-r--r--sql/item_func.cc8
-rw-r--r--sql/item_strfunc.cc15
-rw-r--r--sql/mysqld.cc14
-rw-r--r--sql/sql_class.cc11
-rw-r--r--sql/sql_help.cc20
5 files changed, 38 insertions, 30 deletions
diff --git a/sql/item_func.cc b/sql/item_func.cc
index c0b6a872831..19fd6b12c67 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -1883,7 +1883,7 @@ longlong Item_func_set_last_insert_id::val_int()
longlong Item_func_benchmark::val_int()
{
char buff[MAX_FIELD_WIDTH];
- String tmp(buff,sizeof(buff), default_charset_info);
+ String tmp(buff,sizeof(buff), NULL);
THD *thd=current_thd;
for (ulong loop=0 ; loop < loop_count && !thd->killed; loop++)
@@ -2029,7 +2029,7 @@ Item_func_set_user_var::update()
case STRING_RESULT:
{
char buffer[MAX_FIELD_WIDTH];
- String tmp(buffer,sizeof(buffer),default_charset_info);
+ String tmp(buffer,sizeof(buffer),NULL);
(void) val_str(&tmp);
break;
}
@@ -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 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
goto err;
null_value=0;
@@ -2275,7 +2275,7 @@ void Item_func_match::init_search(bool no_order)
String *ft_tmp= 0;
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
if (!(ft_tmp=key_item()->val_str(&tmp2)))
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index 240b3c213a5..78689bb3044 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -1438,6 +1438,8 @@ String *Item_func_soundex::val_str(String *str)
{
String *res =args[0]->val_str(str);
char last_ch,ch;
+ CHARSET_INFO *cs=my_charset_latin1;
+
if ((null_value=args[0]->null_value))
return 0; /* purecov: inspected */
@@ -1445,22 +1447,23 @@ String *Item_func_soundex::val_str(String *str)
return str; /* purecov: inspected */
char *to= (char *) tmp_value.ptr();
char *from= (char *) res->ptr(), *end=from+res->length();
-
- while (from != end && my_isspace(str->charset(),*from)) // Skip pre-space
+ tmp_value.set_charset(cs);
+
+ while (from != end && my_isspace(cs,*from)) // Skip pre-space
from++; /* purecov: inspected */
if (from == end)
return &empty_string; // No alpha characters.
- *to++ = my_toupper(str->charset(),*from);// Copy first letter
- last_ch = get_scode(str->charset(),from);// code of the first letter
+ *to++ = my_toupper(cs,*from); // Copy first letter
+ last_ch = get_scode(cs,from); // code of the first letter
// for the first 'double-letter check.
// Loop on input letters until
// end of input (null) or output
// letter code count = 3
for (from++ ; from < end ; from++)
{
- if (!my_isalpha(str->charset(),*from))
+ if (!my_isalpha(cs,*from))
continue;
- ch=get_scode(str->charset(),from);
+ ch=get_scode(cs,from);
if ((ch != '0') && (ch != last_ch)) // if not skipped or double
{
*to++ = ch; // letter, copy to output
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 943af7b44be..694f1a49f95 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -34,6 +34,8 @@
#include <ft_global.h>
#include <assert.h>
+#define mysqld_charset my_charset_latin1
+
#ifndef DBUG_OFF
#define ONE_THREAD
#endif
@@ -981,7 +983,7 @@ static void set_user(const char *user)
{
// allow a numeric uid to be used
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
{
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)),
exit(1);
}
val= p--;
- while (my_isspace(system_charset_info, *p) && p > argument)
+ while (my_isspace(mysqld_charset, *p) && p > argument)
*p-- = 0;
if (p == argument)
{
@@ -4383,7 +4385,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
}
*val= 0;
val+= 2;
- while (*val && my_isspace(system_charset_info, *val))
+ while (*val && my_isspace(mysqld_charset, *val))
*val++;
if (!*val)
{
@@ -4525,7 +4527,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
have_symlink=SHOW_OPTION_DISABLED;
break;
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);
}
@@ -4938,8 +4940,8 @@ static ulong find_bit_type(const char *x, TYPELIB *bit_lib)
j=pos;
while (j != end)
{
- if (my_toupper(system_charset_info,*i++) !=
- my_toupper(system_charset_info,*j++))
+ if (my_toupper(mysqld_charset,*i++) !=
+ my_toupper(mysqld_charset,*j++))
goto skipp;
}
found_int=bit;
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index 9e0489edb28..ef40ebeb273 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -526,7 +526,7 @@ bool select_send::send_data(List<Item> &items)
List_iterator_fast<Item> li(items);
Protocol *protocol= thd->protocol;
char buff[MAX_FIELD_WIDTH];
- String buffer(buff, sizeof(buff), system_charset_info);
+ String buffer(buff, sizeof(buff), NULL);
DBUG_ENTER("send_data");
protocol->prepare_for_resend();
@@ -649,7 +649,7 @@ bool select_export::send_data(List<Item> &items)
DBUG_ENTER("send_data");
char buff[MAX_FIELD_WIDTH],null_buff[2],space[MAX_FIELD_WIDTH];
bool space_inited=0;
- String tmp(buff,sizeof(buff),default_charset_info),*res;
+ String tmp(buff,sizeof(buff),NULL),*res;
tmp.length(0);
if (unit->offset_limit_cnt)
@@ -710,10 +710,11 @@ bool select_export::send_data(List<Item> &items)
pos++)
{
#ifdef USE_MB
- if (use_mb(default_charset_info))
+ CHARSET_INFO *res_charset=res->charset();
+ if (use_mb(res_charset))
{
int l;
- if ((l=my_ismbchar(default_charset_info, pos, end)))
+ if ((l=my_ismbchar(res_charset, pos, end)))
{
pos += l-1;
continue;
@@ -856,7 +857,7 @@ bool select_dump::send_data(List<Item> &items)
{
List_iterator_fast<Item> li(items);
char buff[MAX_FIELD_WIDTH];
- String tmp(buff,sizeof(buff),default_charset_info),*res;
+ String tmp(buff,sizeof(buff),NULL),*res;
tmp.length(0);
Item *item;
DBUG_ENTER("send_data");
diff --git a/sql/sql_help.cc b/sql/sql_help.cc
index db28823a43d..5d12f023842 100644
--- a/sql/sql_help.cc
+++ b/sql/sql_help.cc
@@ -22,6 +22,8 @@
** Get help on string
***************************************************************************/
+#define help_charset my_charset_latin1
+
MI_INFO *open_help_file(THD *thd, const char *name)
{
char path[FN_REFLEN];
@@ -104,21 +106,21 @@ int search_functions(MI_INFO *file_leafs, const char *mask,
leaf.prepare_fields();
const char *lname= leaf.get_name();
- if (wild_case_compare(system_charset_info,lname,mask))
+ if (wild_case_compare(help_charset,lname,mask))
continue;
count++;
if (count>2)
{
- String *s= new String(lname,system_charset_info);
+ String *s= new String(lname,help_charset);
if (!s->copy())
names->push_back(s);
}
else if (count==1)
{
- *description= new String(leaf.get_description(),system_charset_info);
- *example= new String(leaf.get_example(),system_charset_info);
- *name= new String(lname,system_charset_info);
+ *description= new String(leaf.get_description(),help_charset);
+ *example= new String(leaf.get_example(),help_charset);
+ *name= new String(lname,help_charset);
(*description)->copy();
(*example)->copy();
(*name)->copy();
@@ -132,7 +134,7 @@ int search_functions(MI_INFO *file_leafs, const char *mask,
*description= 0;
*example= 0;
- String *s= new String(lname,system_charset_info);
+ String *s= new String(lname,help_charset);
if (!s->copy())
names->push_back(s);
}
@@ -203,14 +205,14 @@ int search_categories(THD *thd,
category.prepare_fields();
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;
count++;
if (count==1 && res_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())
names->push_back(s);
}
@@ -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))
{
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())
res->push_back(s);
}