Commit 82192717 authored by ram@mysql.r18.ru's avatar ram@mysql.r18.ru

Merge rkalimullin@work.mysql.com:/home/bk/mysql-4.1

into mysql.r18.ru:/usr/home/ram/work/mysql-4.1.bdb
parents dbd1e63e bd925bbc
......@@ -947,7 +947,7 @@ static int add_init_command(struct st_mysql_options *options, const char *cmd)
}
if (!(tmp= my_strdup(cmd,MYF(MY_WME))) ||
insert_dynamic(options->init_commands, (byte*)&tmp))
insert_dynamic(options->init_commands, (gptr)&tmp))
{
my_free(tmp, MYF(MY_ALLOW_ZERO_PTR));
return 1;
......@@ -2623,8 +2623,13 @@ mysql_close(MYSQL *mysql)
my_free(mysql->options.charset_name,MYF(MY_ALLOW_ZERO_PTR));
if (mysql->options.init_commands)
{
delete_dynamic(mysql->options.init_commands);
my_free((char*)mysql->options.init_commands,MYF(MY_WME));
DYNAMIC_ARRAY *init_commands= mysql->options.init_commands;
char **ptr= (char**)init_commands->buffer;
char **end= ptr + init_commands->elements;
for (; ptr<end; ptr++)
my_free(*ptr,MYF(MY_WME));
delete_dynamic(init_commands);
my_free((char*)init_commands,MYF(MY_WME));
}
#ifdef HAVE_OPENSSL
mysql_ssl_free(mysql);
......
......@@ -463,7 +463,7 @@ static int add_init_command(struct st_mysql_options *options, const char *cmd)
}
if (!(tmp= my_strdup(cmd,MYF(MY_WME))) ||
insert_dynamic(options->init_commands, (byte*)&tmp))
insert_dynamic(options->init_commands, (gptr)&tmp))
{
my_free(tmp, MYF(MY_ALLOW_ZERO_PTR));
return 1;
......@@ -1152,8 +1152,13 @@ mysql_close(MYSQL *mysql)
my_free(mysql->options.charset_name,MYF(MY_ALLOW_ZERO_PTR));
if (mysql->options.init_commands)
{
delete_dynamic(mysql->options.init_commands);
my_free((char*)mysql->options.init_commands,MYF(MY_WME));
DYNAMIC_ARRAY *init_commands= mysql->options.init_commands;
char **ptr= (char**)init_commands->buffer;
char **end= ptr + init_commands->elements;
for (; ptr<end; ptr++)
my_free(*ptr,MYF(MY_WME));
delete_dynamic(init_commands);
my_free((char*)init_commands,MYF(MY_WME));
}
/* Clear pointers for better safety */
mysql->host_info=mysql->user=mysql->passwd=mysql->db=0;
......
......@@ -121,7 +121,7 @@ bool Item_string::eq(const Item *item, bool binary_cmp) const
bool Item::get_date(TIME *ltime,bool fuzzydate)
{
char buff[40];
String tmp(buff,sizeof(buff),default_charset_info),*res;
String tmp(buff,sizeof(buff),NULL),*res;
if (!(res=val_str(&tmp)) ||
str_to_TIME(res->ptr(),res->length(),ltime,fuzzydate) == TIMESTAMP_NONE)
{
......@@ -139,7 +139,7 @@ bool Item::get_date(TIME *ltime,bool fuzzydate)
bool Item::get_time(TIME *ltime)
{
char buff[40];
String tmp(buff,sizeof(buff),default_charset_info),*res;
String tmp(buff,sizeof(buff),NULL),*res;
if (!(res=val_str(&tmp)) ||
str_to_time(res->ptr(),res->length(),ltime))
{
......@@ -1146,7 +1146,7 @@ Item *resolve_const_item(Item *item,Item *comp_item)
if (res_type == STRING_RESULT)
{
char buff[MAX_FIELD_WIDTH];
String tmp(buff,sizeof(buff),default_charset_info),*result;
String tmp(buff,sizeof(buff),NULL),*result;
result=item->val_str(&tmp);
if (item->null_value)
{
......@@ -1160,7 +1160,7 @@ Item *resolve_const_item(Item *item,Item *comp_item)
#ifdef DELETE_ITEMS
delete item;
#endif
return new Item_string(name,tmp_str,length,default_charset_info);
return new Item_string(name,tmp_str,length,result->charset());
}
if (res_type == INT_RESULT)
{
......@@ -1201,8 +1201,8 @@ bool field_is_equal_to_item(Field *field,Item *item)
{
char item_buff[MAX_FIELD_WIDTH];
char field_buff[MAX_FIELD_WIDTH];
String item_tmp(item_buff,sizeof(item_buff),default_charset_info),*item_result;
String field_tmp(field_buff,sizeof(field_buff),default_charset_info);
String item_tmp(item_buff,sizeof(item_buff),NULL),*item_result;
String field_tmp(field_buff,sizeof(field_buff),NULL);
item_result=item->val_str(&item_tmp);
if (item->null_value)
return 1; // This must be true
......
......@@ -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)))
......
......@@ -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
......
......@@ -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;
......
......@@ -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");
......
......@@ -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);
}
......
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