Commit d5877319 authored by unknown's avatar unknown

Merge abarkov@build.mysql.com:/home/bk/mysql-4.1

into bar.mysql.r18.ru:/usr/home/bar/mysql-4.1


sql/sql_yacc.yy:
  Auto merged
parents 34da7161 ebda1ae2
......@@ -2094,11 +2094,11 @@ static int init_common_variables(const char *conf_file_name, int argc,
}
default_charset_info= default_collation;
}
global_system_variables.character_set_server= default_charset_info;
global_system_variables.character_set_database= default_charset_info;
global_system_variables.collation_server= default_charset_info;
global_system_variables.collation_database= default_charset_info;
global_system_variables.collation_connection= default_charset_info;
global_system_variables.character_set_results= default_charset_info;
global_system_variables.character_set_client= default_charset_info;
global_system_variables.collation_connection= default_charset_info;
if (use_temp_pool && bitmap_init(&temp_pool,1024,1))
return 1;
......@@ -4825,11 +4825,11 @@ static void mysql_init_variables(void)
/* Set default values for some option variables */
global_system_variables.character_set_server= default_charset_info;
global_system_variables.character_set_database= default_charset_info;
global_system_variables.collation_server= default_charset_info;
global_system_variables.collation_database= default_charset_info;
global_system_variables.collation_connection= default_charset_info;
global_system_variables.character_set_results= default_charset_info;
global_system_variables.character_set_client= default_charset_info;
global_system_variables.collation_connection= default_charset_info;
global_system_variables.table_type= DB_TYPE_MYISAM;
global_system_variables.tx_isolation= ISO_REPEATABLE_READ;
global_system_variables.select_limit= (ulonglong) HA_POS_ERROR;
......
......@@ -116,6 +116,8 @@ sys_var_character_set_client sys_character_set_client("character_set_client");
sys_var_character_set_connection sys_character_set_connection("character_set_connection");
sys_var_character_set_results sys_character_set_results("character_set_results");
sys_var_collation_connection sys_collation_connection("collation_connection");
sys_var_collation_database sys_collation_database("collation_database");
sys_var_collation_server sys_collation_server("collation_server");
sys_var_bool_ptr sys_concurrent_insert("concurrent_insert",
&myisam_concurrent_insert);
sys_var_long_ptr sys_connect_timeout("connect_timeout",
......@@ -381,6 +383,8 @@ sys_var *sys_variables[]=
&sys_character_set_connection,
&sys_character_set_results,
&sys_collation_connection,
&sys_collation_database,
&sys_collation_server,
&sys_concurrent_insert,
&sys_connect_timeout,
&sys_default_week_format,
......@@ -509,6 +513,8 @@ struct show_var_st init_vars[]= {
{sys_character_set_connection.name,(char*) &sys_character_set_connection,SHOW_SYS},
{sys_character_set_results.name,(char*) &sys_character_set_results, SHOW_SYS},
{sys_collation_connection.name,(char*) &sys_collation_connection, SHOW_SYS},
{sys_collation_database.name,(char*) &sys_collation_database, SHOW_SYS},
{sys_collation_server.name,(char*) &sys_collation_server, SHOW_SYS},
{sys_concurrent_insert.name,(char*) &sys_concurrent_insert, SHOW_SYS},
{sys_connect_timeout.name, (char*) &sys_connect_timeout, SHOW_SYS},
{"datadir", mysql_real_data_home, SHOW_CHAR},
......@@ -1422,20 +1428,19 @@ CHARSET_INFO **
sys_var_character_set_server::ci_ptr(THD *thd, enum_var_type type)
{
if (type == OPT_GLOBAL)
return &global_system_variables.character_set_server;
return &global_system_variables.collation_server;
else
return &thd->variables.character_set_server;
return &thd->variables.collation_server;
}
void sys_var_character_set_server::set_default(THD *thd, enum_var_type type)
{
if (type == OPT_GLOBAL)
global_system_variables.character_set_server= default_charset_info;
global_system_variables.collation_server= default_charset_info;
else
{
thd->variables.character_set_server= (global_system_variables.
character_set_server);
thd->variables.collation_server= global_system_variables.collation_server;
thd->update_charset();
}
}
......@@ -1445,19 +1450,19 @@ CHARSET_INFO ** sys_var_character_set_database::ci_ptr(THD *thd,
enum_var_type type)
{
if (type == OPT_GLOBAL)
return &global_system_variables.character_set_database;
return &global_system_variables.collation_database;
else
return &thd->variables.character_set_database;
return &thd->variables.collation_database;
}
void sys_var_character_set_database::set_default(THD *thd, enum_var_type type)
{
if (type == OPT_GLOBAL)
global_system_variables.character_set_database= default_charset_info;
global_system_variables.collation_database= default_charset_info;
else
{
thd->variables.character_set_database= thd->db_charset;
thd->variables.collation_database= thd->db_charset;
thd->update_charset();
}
}
......@@ -1498,6 +1503,77 @@ void sys_var_collation_connection::set_default(THD *thd, enum_var_type type)
}
}
bool sys_var_collation_database::update(THD *thd, set_var *var)
{
if (var->type == OPT_GLOBAL)
global_system_variables.collation_database= var->save_result.charset;
else
{
thd->variables.collation_database= var->save_result.charset;
thd->update_charset();
}
return 0;
}
byte *sys_var_collation_database::value_ptr(THD *thd, enum_var_type type,
LEX_STRING *base)
{
CHARSET_INFO *cs= ((type == OPT_GLOBAL) ?
global_system_variables.collation_database :
thd->variables.collation_database);
return cs ? (byte*) cs->name : (byte*) "NULL";
}
void sys_var_collation_database::set_default(THD *thd, enum_var_type type)
{
if (type == OPT_GLOBAL)
global_system_variables.collation_database= default_charset_info;
else
{
thd->variables.collation_database= (global_system_variables.
collation_database);
thd->update_charset();
}
}
bool sys_var_collation_server::update(THD *thd, set_var *var)
{
if (var->type == OPT_GLOBAL)
global_system_variables.collation_server= var->save_result.charset;
else
{
thd->variables.collation_server= var->save_result.charset;
thd->update_charset();
}
return 0;
}
byte *sys_var_collation_server::value_ptr(THD *thd, enum_var_type type,
LEX_STRING *base)
{
CHARSET_INFO *cs= ((type == OPT_GLOBAL) ?
global_system_variables.collation_server :
thd->variables.collation_server);
return cs ? (byte*) cs->name : (byte*) "NULL";
}
void sys_var_collation_server::set_default(THD *thd, enum_var_type type)
{
if (type == OPT_GLOBAL)
global_system_variables.collation_server= default_charset_info;
else
{
thd->variables.collation_server= (global_system_variables.
collation_server);
thd->update_charset();
}
}
bool sys_var_key_buffer_size::update(THD *thd, set_var *var)
{
......
......@@ -523,6 +523,23 @@ class sys_var_collation_connection :public sys_var_collation
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
};
class sys_var_collation_server :public sys_var_collation
{
public:
sys_var_collation_server(const char *name_arg) :sys_var_collation(name_arg) {}
bool update(THD *thd, set_var *var);
void set_default(THD *thd, enum_var_type type);
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
};
class sys_var_collation_database :public sys_var_collation
{
public:
sys_var_collation_database(const char *name_arg) :sys_var_collation(name_arg) {}
bool update(THD *thd, set_var *var);
void set_default(THD *thd, enum_var_type type);
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
};
class sys_var_key_buffer_size :public sys_var
{
......
......@@ -2328,7 +2328,7 @@ int mysql_create_index(THD *thd, TABLE_LIST *table_list, List<Key> &keys)
DBUG_ENTER("mysql_create_index");
bzero((char*) &create_info,sizeof(create_info));
create_info.db_type=DB_TYPE_DEFAULT;
create_info.table_charset= thd->variables.character_set_database;
create_info.table_charset= thd->variables.collation_database;
DBUG_RETURN(mysql_alter_table(thd,table_list->db,table_list->real_name,
&create_info, table_list,
fields, keys, drop, alter, 0, (ORDER*)0, FALSE,
......@@ -2345,7 +2345,7 @@ int mysql_drop_index(THD *thd, TABLE_LIST *table_list, List<Alter_drop> &drop)
DBUG_ENTER("mysql_drop_index");
bzero((char*) &create_info,sizeof(create_info));
create_info.db_type=DB_TYPE_DEFAULT;
create_info.table_charset= thd->variables.character_set_database;
create_info.table_charset= thd->variables.collation_database;
DBUG_RETURN(mysql_alter_table(thd,table_list->db,table_list->real_name,
&create_info, table_list,
fields, keys, drop, alter, 0, (ORDER*)0, FALSE,
......
......@@ -107,7 +107,7 @@ THD::THD():user_time(0), is_fatal_error(0),
variables.pseudo_thread_id= 0;
file_id = 0;
warn_id= 0;
db_charset= global_system_variables.character_set_database;
db_charset= global_system_variables.collation_database;
mysys_var=0;
#ifndef DBUG_OFF
dbug_sentry=THD_SENTRY_MAGIC;
......
......@@ -401,10 +401,13 @@ struct system_variables
my_bool new_mode;
my_bool old_passwords;
CHARSET_INFO *character_set_server;
CHARSET_INFO *character_set_database;
/* Only charset part of these variables is sensible */
CHARSET_INFO *character_set_client;
CHARSET_INFO *character_set_results;
/* Both charset and collation parts of these variables are important */
CHARSET_INFO *collation_server;
CHARSET_INFO *collation_database;
CHARSET_INFO *collation_connection;
};
......
......@@ -62,7 +62,7 @@ static bool write_db_opt(THD *thd, const char *path, HA_CREATE_INFO *create)
ulong length;
CHARSET_INFO *cs= (create && create->table_charset) ?
create->table_charset :
thd->variables.character_set_database;
thd->variables.collation_database;
length= my_sprintf(buf,(buf, "default-character-set=%s\ndefault-collation=%s\n", cs->csname,cs->name));
/* Error is written by my_write */
......@@ -99,7 +99,7 @@ static bool load_db_opt(THD *thd, const char *path, HA_CREATE_INFO *create)
uint nbytes;
bzero((char*) create,sizeof(*create));
create->table_charset= global_system_variables.character_set_database;
create->table_charset= global_system_variables.collation_database;
if ((file=my_open(path, O_RDONLY | O_SHARE, MYF(0))) >= 0)
{
IO_CACHE cache;
......@@ -288,8 +288,8 @@ int mysql_alter_db(THD *thd, const char *db, HA_CREATE_INFO *create_info)
{
thd->db_charset= (create_info && create_info->table_charset) ?
create_info->table_charset :
global_system_variables.character_set_database;
thd->variables.character_set_database= thd->db_charset;
global_system_variables.collation_database;
thd->variables.collation_database= thd->db_charset;
}
mysql_update_log.write(thd,thd->query, thd->query_length);
......@@ -632,8 +632,8 @@ bool mysql_change_db(THD *thd, const char *name)
load_db_opt(thd, path, &create);
thd->db_charset= create.table_charset ?
create.table_charset :
global_system_variables.character_set_database;
thd->variables.character_set_database= thd->db_charset;
global_system_variables.collation_database;
thd->variables.collation_database= thd->db_charset;
DBUG_RETURN(0);
}
......
......@@ -224,7 +224,7 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
info.handle_duplicates=handle_duplicates;
info.escape_char=escaped->length() ? (*escaped)[0] : INT_MAX;
READ_INFO read_info(file,tot_length,thd->variables.character_set_database,
READ_INFO read_info(file,tot_length,thd->variables.collation_database,
*field_term,*ex->line_start, *ex->line_term, *enclosed,
info.escape_char, read_file_from_client, is_fifo);
if (read_info.error)
......
......@@ -914,7 +914,7 @@ create:
bzero((char*) &lex->create_info,sizeof(lex->create_info));
lex->create_info.options=$2 | $4;
lex->create_info.db_type= (enum db_type) lex->thd->variables.table_type;
lex->create_info.table_charset= thd->variables.character_set_database;
lex->create_info.table_charset= thd->variables.collation_database;
lex->name=0;
}
create2
......@@ -1632,7 +1632,7 @@ alter:
lex->select_lex.db=lex->name=0;
bzero((char*) &lex->create_info,sizeof(lex->create_info));
lex->create_info.db_type= DB_TYPE_DEFAULT;
lex->create_info.table_charset= thd->variables.character_set_database;
lex->create_info.table_charset= thd->variables.collation_database;
lex->create_info.row_type= ROW_TYPE_NOT_USED;
lex->alter_keys_onoff=LEAVE_AS_IS;
lex->simple_alter=1;
......@@ -4737,7 +4737,7 @@ option_value:
THD *thd= YYTHD;
LEX *lex= Lex;
$2= $2 ? $2: global_system_variables.character_set_client;
lex->var_list.push_back(new set_var_collation_client($2,thd->variables.character_set_database,$2));
lex->var_list.push_back(new set_var_collation_client($2,thd->variables.collation_database,$2));
}
| NAMES_SYM charset_name_or_default opt_collate
{
......
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