summaryrefslogtreecommitdiff
path: root/sql/sql_db.cc
diff options
context:
space:
mode:
authorunknown <monty@mashka.mysql.fi>2003-11-18 13:51:48 +0200
committerunknown <monty@mashka.mysql.fi>2003-11-18 13:51:48 +0200
commit6b671182125b2e3aa19cc65f0ecf1fbb5df194ad (patch)
tree083e126c99f25d93a326bfde6eab71e95addb881 /sql/sql_db.cc
parent5a24433d271e6317886102448f2b60728b738940 (diff)
parente72124c4ccad5b390b84562389175dcd7355769c (diff)
downloadmariadb-git-6b671182125b2e3aa19cc65f0ecf1fbb5df194ad.tar.gz
merge
myisam/ft_nlq_search.c: Auto merged myisam/myisamchk.c: Auto merged mysql-test/r/fulltext.result: Auto merged mysql-test/r/func_str.result: Auto merged mysql-test/r/innodb.result: Auto merged mysql-test/r/subselect.result: Auto merged sql/item_func.cc: Auto merged sql/mysql_priv.h: Auto merged sql/mysqld.cc: Auto merged sql/set_var.cc: Auto merged sql/share/czech/errmsg.txt: Auto merged sql/share/danish/errmsg.txt: Auto merged sql/share/dutch/errmsg.txt: Auto merged sql/share/english/errmsg.txt: Auto merged sql/sql_db.cc: Auto merged sql/sql_parse.cc: Auto merged sql/sql_table.cc: Auto merged sql/share/estonian/errmsg.txt: Auto merged sql/share/french/errmsg.txt: Auto merged sql/share/german/errmsg.txt: Auto merged sql/share/greek/errmsg.txt: Auto merged sql/share/hungarian/errmsg.txt: Auto merged sql/share/italian/errmsg.txt: Auto merged sql/share/japanese/errmsg.txt: Auto merged sql/share/korean/errmsg.txt: Auto merged sql/share/norwegian-ny/errmsg.txt: Auto merged sql/share/norwegian/errmsg.txt: Auto merged sql/share/polish/errmsg.txt: Auto merged sql/share/portuguese/errmsg.txt: Auto merged sql/share/romanian/errmsg.txt: Auto merged sql/share/russian/errmsg.txt: Auto merged sql/share/serbian/errmsg.txt: Auto merged sql/share/slovak/errmsg.txt: Auto merged sql/share/spanish/errmsg.txt: Auto merged sql/share/swedish/errmsg.txt: Auto merged sql/share/ukrainian/errmsg.txt: Auto merged
Diffstat (limited to 'sql/sql_db.cc')
-rw-r--r--sql/sql_db.cc36
1 files changed, 20 insertions, 16 deletions
diff --git a/sql/sql_db.cc b/sql/sql_db.cc
index 09d32dfa5ee..d4e3fe753d3 100644
--- a/sql/sql_db.cc
+++ b/sql/sql_db.cc
@@ -60,10 +60,12 @@ static bool write_db_opt(THD *thd, const char *path, HA_CREATE_INFO *create)
if ((file=my_create(path, CREATE_MODE,O_RDWR | O_TRUNC,MYF(MY_WME))) >= 0)
{
ulong length;
- CHARSET_INFO *cs= (create && create->table_charset) ?
- create->table_charset :
+ CHARSET_INFO *cs= (create && create->default_table_charset) ?
+ create->default_table_charset :
thd->variables.collation_database;
- length= my_sprintf(buf,(buf, "default-character-set=%s\ndefault-collation=%s\n", cs->csname,cs->name));
+ length= my_sprintf(buf,(buf,
+ "default-character-set=%s\ndefault-collation=%s\n",
+ cs->csname,cs->name));
/* Error is written by my_write */
if (!my_write(file,(byte*) buf, length, MYF(MY_NABP+MY_WME)))
@@ -99,7 +101,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.collation_database;
+ create->default_table_charset= global_system_variables.collation_database;
if ((file=my_open(path, O_RDONLY | O_SHARE, MYF(0))) >= 0)
{
IO_CACHE cache;
@@ -116,16 +118,17 @@ static bool load_db_opt(THD *thd, const char *path, HA_CREATE_INFO *create)
{
if (!strncmp(buf,"default-character-set", (pos-buf)))
{
- if (!(create->table_charset=get_charset_by_csname(pos+1,
- MY_CS_PRIMARY,
- MYF(0))))
+ if (!(create->default_table_charset= get_charset_by_csname(pos+1,
+ MY_CS_PRIMARY,
+ MYF(0))))
{
sql_print_error(ER(ER_UNKNOWN_CHARACTER_SET),pos+1);
}
}
else if (!strncmp(buf,"default-collation", (pos-buf)))
{
- if (!(create->table_charset=get_charset_by_name(pos+1, MYF(0))))
+ if (!(create->default_table_charset= get_charset_by_name(pos+1,
+ MYF(0))))
{
sql_print_error(ER(ER_UNKNOWN_COLLATION),pos+1);
}
@@ -286,8 +289,8 @@ int mysql_alter_db(THD *thd, const char *db, HA_CREATE_INFO *create_info)
*/
if (thd->db && !strcmp(thd->db,db))
{
- thd->db_charset= (create_info && create_info->table_charset) ?
- create_info->table_charset :
+ thd->db_charset= (create_info && create_info->default_table_charset) ?
+ create_info->default_table_charset :
global_system_variables.collation_database;
thd->variables.collation_database= thd->db_charset;
}
@@ -653,8 +656,8 @@ bool mysql_change_db(THD *thd, const char *name)
#endif
strmov(path+unpack_dirname(path,path), MY_DB_OPT_FILE);
load_db_opt(thd, path, &create);
- thd->db_charset= create.table_charset ?
- create.table_charset :
+ thd->db_charset= create.default_table_charset ?
+ create.default_table_charset :
global_system_variables.collation_database;
thd->variables.collation_database= thd->db_charset;
DBUG_RETURN(0);
@@ -731,12 +734,13 @@ int mysqld_show_create_db(THD *thd, char *dbname,
to= strxmov(to,"/*!32312 IF NOT EXISTS*/ ", NullS);
to=strxmov(to,"`",dbname,"`", NullS);
- if (create.table_charset)
+ if (create.default_table_charset)
{
- int cl= (create.table_charset->state & MY_CS_PRIMARY) ? 0 : 1;
+ int cl= (create.default_table_charset->state & MY_CS_PRIMARY) ? 0 : 1;
to= strxmov(to," /*!40100"
- " DEFAULT CHARACTER SET ",create.table_charset->csname,
- cl ? " COLLATE " : "", cl ? create.table_charset->name : "",
+ " DEFAULT CHARACTER SET ",create.default_table_charset->csname,
+ cl ? " COLLATE " : "",
+ cl ? create.default_table_charset->name : "",
" */",NullS);
}
protocol->store(path, (uint) (to-path), system_charset_info);