Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
e15ea029
Commit
e15ea029
authored
May 30, 2003
by
ram@mysql.r18.ru
Browse files
Options
Browse Files
Download
Plain Diff
Merge rkalimullin@bk-internal.mysql.com:/home/bk/mysql-4.1
into mysql.r18.ru:/usr/home/ram/work/4.1.latest
parents
a36d4212
84893b41
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
196 additions
and
85 deletions
+196
-85
.bzrignore
.bzrignore
+3
-2
client/mysqldump.c
client/mysqldump.c
+9
-2
sql/mysqld.cc
sql/mysqld.cc
+11
-7
sql/set_var.cc
sql/set_var.cc
+96
-42
sql/set_var.h
sql/set_var.h
+36
-6
sql/sql_base.cc
sql/sql_base.cc
+2
-2
sql/sql_class.cc
sql/sql_class.cc
+1
-1
sql/sql_class.h
sql/sql_class.h
+2
-0
sql/sql_db.cc
sql/sql_db.cc
+28
-16
sql/sql_help.cc
sql/sql_help.cc
+2
-2
sql/sql_load.cc
sql/sql_load.cc
+1
-1
sql/sql_table.cc
sql/sql_table.cc
+2
-1
sql/sql_yacc.yy
sql/sql_yacc.yy
+3
-3
No files found.
.bzrignore
View file @
e15ea029
...
@@ -277,6 +277,7 @@ help.h
...
@@ -277,6 +277,7 @@ help.h
include/my_config.h
include/my_config.h
include/my_global.h
include/my_global.h
include/mysql_version.h
include/mysql_version.h
include/readline/*.h
include/readline/readline.h
include/readline/readline.h
include/widec.h
include/widec.h
innobase/autom4te-2.53.cache/output.0
innobase/autom4te-2.53.cache/output.0
...
@@ -347,6 +348,7 @@ libmysqld/item_buff.cc
...
@@ -347,6 +348,7 @@ libmysqld/item_buff.cc
libmysqld/item_cmpfunc.cc
libmysqld/item_cmpfunc.cc
libmysqld/item_create.cc
libmysqld/item_create.cc
libmysqld/item_func.cc
libmysqld/item_func.cc
libmysqld/item_geofunc.cc
libmysqld/item_row.cc
libmysqld/item_row.cc
libmysqld/item_strfunc.cc
libmysqld/item_strfunc.cc
libmysqld/item_sum.cc
libmysqld/item_sum.cc
...
@@ -503,6 +505,7 @@ scripts/make_win_src_distribution
...
@@ -503,6 +505,7 @@ scripts/make_win_src_distribution
scripts/msql2mysql
scripts/msql2mysql
scripts/mysql_config
scripts/mysql_config
scripts/mysql_convert_table_format
scripts/mysql_convert_table_format
scripts/mysql_create_system_tables
scripts/mysql_explain_log
scripts/mysql_explain_log
scripts/mysql_find_rows
scripts/mysql_find_rows
scripts/mysql_fix_extensions
scripts/mysql_fix_extensions
...
@@ -616,5 +619,3 @@ vio/test-ssl
...
@@ -616,5 +619,3 @@ vio/test-ssl
vio/test-sslclient
vio/test-sslclient
vio/test-sslserver
vio/test-sslserver
vio/viotest-ssl
vio/viotest-ssl
include/readline/*.h
libmysqld/item_geofunc.cc
client/mysqldump.c
View file @
e15ea029
...
@@ -77,7 +77,7 @@ static my_bool verbose=0,tFlag=0,cFlag=0,dFlag=0,quick= 1, extended_insert= 1,
...
@@ -77,7 +77,7 @@ static my_bool verbose=0,tFlag=0,cFlag=0,dFlag=0,quick= 1, extended_insert= 1,
lock_tables
=
1
,
ignore_errors
=
0
,
flush_logs
=
0
,
replace
=
0
,
lock_tables
=
1
,
ignore_errors
=
0
,
flush_logs
=
0
,
replace
=
0
,
ignore
=
0
,
opt_drop
=
1
,
opt_keywords
=
0
,
opt_lock
=
1
,
opt_compress
=
0
,
ignore
=
0
,
opt_drop
=
1
,
opt_keywords
=
0
,
opt_lock
=
1
,
opt_compress
=
0
,
opt_delayed
=
0
,
create_options
=
1
,
opt_quoted
=
0
,
opt_databases
=
0
,
opt_delayed
=
0
,
create_options
=
1
,
opt_quoted
=
0
,
opt_databases
=
0
,
opt_alldbs
=
0
,
opt_create_db
=
0
,
opt_first_slave
=
0
,
opt_alldbs
=
0
,
opt_create_db
=
0
,
opt_first_slave
=
0
,
opt_set_names
=
0
,
opt_autocommit
=
0
,
opt_master_data
,
opt_disable_keys
=
1
,
opt_xml
=
0
,
opt_autocommit
=
0
,
opt_master_data
,
opt_disable_keys
=
1
,
opt_xml
=
0
,
opt_delete_master_logs
=
0
,
tty_password
=
0
,
opt_delete_master_logs
=
0
,
tty_password
=
0
,
opt_single_transaction
=
0
;
opt_single_transaction
=
0
;
...
@@ -85,7 +85,7 @@ static MYSQL mysql_connection,*sock=0;
...
@@ -85,7 +85,7 @@ static MYSQL mysql_connection,*sock=0;
static
char
insert_pat
[
12
*
1024
],
*
opt_password
=
0
,
*
current_user
=
0
,
static
char
insert_pat
[
12
*
1024
],
*
opt_password
=
0
,
*
current_user
=
0
,
*
current_host
=
0
,
*
path
=
0
,
*
fields_terminated
=
0
,
*
current_host
=
0
,
*
path
=
0
,
*
fields_terminated
=
0
,
*
lines_terminated
=
0
,
*
enclosed
=
0
,
*
opt_enclosed
=
0
,
*
escaped
=
0
,
*
lines_terminated
=
0
,
*
enclosed
=
0
,
*
opt_enclosed
=
0
,
*
escaped
=
0
,
*
where
=
0
,
*
default_charset
=
(
char
*
)
MYSQL_DEFAULT_CHARSET_NAME
,
*
where
=
0
,
*
default_charset
=
(
char
*
)
"binary"
,
*
opt_compatible_mode_str
=
0
,
*
opt_compatible_mode_str
=
0
,
*
err_ptr
=
0
;
*
err_ptr
=
0
;
static
ulong
opt_compatible_mode
=
0
;
static
ulong
opt_compatible_mode
=
0
;
...
@@ -212,6 +212,10 @@ static struct my_option my_long_options[] =
...
@@ -212,6 +212,10 @@ static struct my_option my_long_options[] =
(
gptr
*
)
&
tFlag
,
(
gptr
*
)
&
tFlag
,
0
,
GET_BOOL
,
NO_ARG
,
0
,
0
,
0
,
0
,
0
,
0
},
(
gptr
*
)
&
tFlag
,
(
gptr
*
)
&
tFlag
,
0
,
GET_BOOL
,
NO_ARG
,
0
,
0
,
0
,
0
,
0
,
0
},
{
"no-data"
,
'd'
,
"No row information."
,
(
gptr
*
)
&
dFlag
,
(
gptr
*
)
&
dFlag
,
0
,
{
"no-data"
,
'd'
,
"No row information."
,
(
gptr
*
)
&
dFlag
,
(
gptr
*
)
&
dFlag
,
0
,
GET_BOOL
,
NO_ARG
,
0
,
0
,
0
,
0
,
0
,
0
},
GET_BOOL
,
NO_ARG
,
0
,
0
,
0
,
0
,
0
,
0
},
{
"no-set-names"
,
'N'
,
"'SET NAMES charset_name' will not be put in the output."
,
(
gptr
*
)
&
opt_set_names
,
(
gptr
*
)
&
opt_set_names
,
0
,
GET_BOOL
,
NO_ARG
,
0
,
0
,
0
,
0
,
0
,
0
},
{
"set-variable"
,
'O'
,
{
"set-variable"
,
'O'
,
"Change the value of a variable. Please note that this option is deprecated; you can set variables directly with --variable-name=value."
,
"Change the value of a variable. Please note that this option is deprecated; you can set variables directly with --variable-name=value."
,
0
,
0
,
0
,
GET_STR
,
REQUIRED_ARG
,
0
,
0
,
0
,
0
,
0
,
0
},
0
,
0
,
0
,
GET_STR
,
REQUIRED_ARG
,
0
,
0
,
0
,
0
,
0
,
0
},
...
@@ -345,6 +349,8 @@ static void write_header(FILE *sql_file, char *db_name)
...
@@ -345,6 +349,8 @@ static void write_header(FILE *sql_file, char *db_name)
sql_file
);
sql_file
);
fprintf
(
sql_file
,
"-- Server version
\t
%s
\n
"
,
fprintf
(
sql_file
,
"-- Server version
\t
%s
\n
"
,
mysql_get_server_info
(
&
mysql_connection
));
mysql_get_server_info
(
&
mysql_connection
));
if
(
!
opt_set_names
)
fprintf
(
sql_file
,
"
\n
/*!40101 SET NAMES %s*/;
\n
"
,
default_charset
);
}
}
return
;
return
;
}
/* write_header */
}
/* write_header */
...
@@ -557,6 +563,7 @@ static int dbConnect(char *host, char *user,char *passwd)
...
@@ -557,6 +563,7 @@ static int dbConnect(char *host, char *user,char *passwd)
if
(
shared_memory_base_name
)
if
(
shared_memory_base_name
)
mysql_options
(
&
mysql_connection
,
MYSQL_SHARED_MEMORY_BASE_NAME
,
shared_memory_base_name
);
mysql_options
(
&
mysql_connection
,
MYSQL_SHARED_MEMORY_BASE_NAME
,
shared_memory_base_name
);
#endif
#endif
mysql_options
(
&
mysql_connection
,
MYSQL_SET_CHARSET_NAME
,
default_charset
);
if
(
!
(
sock
=
mysql_real_connect
(
&
mysql_connection
,
host
,
user
,
passwd
,
if
(
!
(
sock
=
mysql_real_connect
(
&
mysql_connection
,
host
,
user
,
passwd
,
NULL
,
opt_mysql_port
,
opt_mysql_unix_port
,
NULL
,
opt_mysql_port
,
opt_mysql_unix_port
,
0
)))
0
)))
...
...
sql/mysqld.cc
View file @
e15ea029
...
@@ -300,7 +300,7 @@ char* log_error_file_ptr= log_error_file;
...
@@ -300,7 +300,7 @@ char* log_error_file_ptr= log_error_file;
char
mysql_real_data_home
[
FN_REFLEN
],
char
mysql_real_data_home
[
FN_REFLEN
],
language
[
LIBLEN
],
reg_ext
[
FN_EXTLEN
],
mysql_charsets_dir
[
FN_REFLEN
],
language
[
LIBLEN
],
reg_ext
[
FN_EXTLEN
],
mysql_charsets_dir
[
FN_REFLEN
],
max_sort_char
,
*
mysqld_user
,
*
mysqld_chroot
,
*
opt_init_file
;
max_sort_char
,
*
mysqld_user
,
*
mysqld_chroot
,
*
opt_init_file
;
char
*
language_ptr
,
*
default_collation_name
;
char
*
language_ptr
,
*
default_collation_name
,
*
default_character_set_name
;
char
mysql_data_home_buff
[
2
],
*
mysql_data_home
=
mysql_real_data_home
;
char
mysql_data_home_buff
[
2
],
*
mysql_data_home
=
mysql_real_data_home
;
char
server_version
[
SERVER_VERSION_LENGTH
]
=
MYSQL_SERVER_VERSION
;
char
server_version
[
SERVER_VERSION_LENGTH
]
=
MYSQL_SERVER_VERSION
;
char
*
mysql_unix_port
,
*
opt_mysql_tmpdir
;
char
*
mysql_unix_port
,
*
opt_mysql_tmpdir
;
...
@@ -2028,7 +2028,7 @@ static int init_common_variables(const char *conf_file_name, int argc,
...
@@ -2028,7 +2028,7 @@ static int init_common_variables(const char *conf_file_name, int argc,
#ifdef USE_REGEX
#ifdef USE_REGEX
regex_init
(
&
my_charset_latin1
);
regex_init
(
&
my_charset_latin1
);
#endif
#endif
if
(
!
(
default_charset_info
=
get_charset_by_csname
(
sys_charset
.
value
,
if
(
!
(
default_charset_info
=
get_charset_by_csname
(
default_character_set_name
,
MY_CS_PRIMARY
,
MY_CS_PRIMARY
,
MYF
(
MY_WME
))))
MYF
(
MY_WME
))))
return
1
;
return
1
;
...
@@ -2046,6 +2046,8 @@ static int init_common_variables(const char *conf_file_name, int argc,
...
@@ -2046,6 +2046,8 @@ static int init_common_variables(const char *conf_file_name, int argc,
}
}
default_charset_info
=
default_collation
;
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
.
character_set_results
=
NULL
;
global_system_variables
.
character_set_results
=
NULL
;
global_system_variables
.
character_set_client
=
default_charset_info
;
global_system_variables
.
character_set_client
=
default_charset_info
;
global_system_variables
.
collation_connection
=
default_charset_info
;
global_system_variables
.
collation_connection
=
default_charset_info
;
...
@@ -3542,8 +3544,8 @@ Disable with --skip-bdb (will save memory)",
...
@@ -3542,8 +3544,8 @@ Disable with --skip-bdb (will save memory)",
0
,
0
,
0
,
0
,
0
,
0
},
0
,
0
,
0
,
0
,
0
,
0
},
#endif
/* HAVE_OPENSSL */
#endif
/* HAVE_OPENSSL */
{
"default-character-set"
,
'C'
,
"Set the default character set"
,
{
"default-character-set"
,
'C'
,
"Set the default character set"
,
(
gptr
*
)
&
sys_charset
.
value
,
(
gptr
*
)
&
sys_charset
.
value
,
0
,
GET_STR
,
(
gptr
*
)
&
default_character_set_name
,
(
gptr
*
)
&
default_character_set_name
,
REQUIRED_ARG
,
0
,
0
,
0
,
0
,
0
,
0
},
0
,
GET_STR
,
REQUIRED_ARG
,
0
,
0
,
0
,
0
,
0
,
0
},
{
"default-collation"
,
OPT_DEFAULT_COLLATION
,
"Set the default collation"
,
{
"default-collation"
,
OPT_DEFAULT_COLLATION
,
"Set the default collation"
,
(
gptr
*
)
&
default_collation_name
,
(
gptr
*
)
&
default_collation_name
,
(
gptr
*
)
&
default_collation_name
,
(
gptr
*
)
&
default_collation_name
,
0
,
GET_STR
,
REQUIRED_ARG
,
0
,
0
,
0
,
0
,
0
,
0
},
0
,
GET_STR
,
REQUIRED_ARG
,
0
,
0
,
0
,
0
,
0
,
0
},
...
@@ -4538,7 +4540,7 @@ static void use_help(void)
...
@@ -4538,7 +4540,7 @@ static void use_help(void)
static
void
usage
(
void
)
static
void
usage
(
void
)
{
{
if
(
!
(
default_charset_info
=
get_charset_by_csname
(
sys_charset
.
valu
e
,
if
(
!
(
default_charset_info
=
get_charset_by_csname
(
default_character_set_nam
e
,
MY_CS_PRIMARY
,
MY_CS_PRIMARY
,
MYF
(
MY_WME
))))
MYF
(
MY_WME
))))
exit
(
1
);
exit
(
1
);
...
@@ -4642,7 +4644,6 @@ static void mysql_init_variables(void)
...
@@ -4642,7 +4644,6 @@ static void mysql_init_variables(void)
pidfile_name_ptr
=
pidfile_name
;
pidfile_name_ptr
=
pidfile_name
;
log_error_file_ptr
=
log_error_file
;
log_error_file_ptr
=
log_error_file
;
language_ptr
=
language
;
language_ptr
=
language
;
default_collation_name
=
(
char
*
)
MYSQL_DEFAULT_COLLATION_NAME
;
mysql_data_home
=
mysql_real_data_home
;
mysql_data_home
=
mysql_real_data_home
;
thd_startup_options
=
(
OPTION_UPDATE_LOG
|
OPTION_AUTO_IS_NULL
|
thd_startup_options
=
(
OPTION_UPDATE_LOG
|
OPTION_AUTO_IS_NULL
|
OPTION_BIN_LOG
|
OPTION_QUOTE_SHOW_CREATE
);
OPTION_BIN_LOG
|
OPTION_QUOTE_SHOW_CREATE
);
...
@@ -4681,10 +4682,13 @@ static void mysql_init_variables(void)
...
@@ -4681,10 +4682,13 @@ static void mysql_init_variables(void)
/* Variables in libraries */
/* Variables in libraries */
charsets_dir
=
0
;
charsets_dir
=
0
;
sys_charset
.
value
=
(
char
*
)
MYSQL_DEFAULT_CHARSET_NAME
;
default_character_set_name
=
(
char
*
)
MYSQL_DEFAULT_CHARSET_NAME
;
default_collation_name
=
(
char
*
)
MYSQL_DEFAULT_COLLATION_NAME
;
sys_charset_system
.
value
=
(
char
*
)
system_charset_info
->
csname
;
sys_charset_system
.
value
=
(
char
*
)
system_charset_info
->
csname
;
/* Set default values for some option variables */
/* 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
.
character_set_results
=
NULL
;
global_system_variables
.
character_set_results
=
NULL
;
global_system_variables
.
character_set_client
=
default_charset_info
;
global_system_variables
.
character_set_client
=
default_charset_info
;
global_system_variables
.
collation_connection
=
default_charset_info
;
global_system_variables
.
collation_connection
=
default_charset_info
;
...
...
sql/set_var.cc
View file @
e15ea029
...
@@ -103,15 +103,14 @@ sys_var_long_ptr sys_binlog_cache_size("binlog_cache_size",
...
@@ -103,15 +103,14 @@ sys_var_long_ptr sys_binlog_cache_size("binlog_cache_size",
&
binlog_cache_size
);
&
binlog_cache_size
);
sys_var_thd_ulong
sys_bulk_insert_buff_size
(
"bulk_insert_buffer_size"
,
sys_var_thd_ulong
sys_bulk_insert_buff_size
(
"bulk_insert_buffer_size"
,
&
SV
::
bulk_insert_buff_size
);
&
SV
::
bulk_insert_buff_size
);
sys_var_str
sys_charset
(
"character_set_server"
,
sys_var_character_set_server
sys_character_set_server
(
"character_set_server"
);
sys_check_charset
,
sys_var_str
sys_charset_system
(
"character_set_system"
,
sys_update_charset
,
sys_set_default_charset
);
sys_var_str
sys_charset_system
(
"character_set_system"
,
sys_check_charset
,
sys_check_charset
,
sys_update_charset
,
sys_update_charset
,
sys_set_default_charset
);
sys_set_default_charset
);
sys_var_character_set_database
sys_character_set_database
(
"character_set_database"
);
sys_var_character_set_client
sys_character_set_client
(
"character_set_client"
);
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_character_set_results
sys_character_set_results
(
"character_set_results"
);
sys_var_collation_connection
sys_collation_connection
(
"collation_connection"
);
sys_var_collation_connection
sys_collation_connection
(
"collation_connection"
);
sys_var_bool_ptr
sys_concurrent_insert
(
"concurrent_insert"
,
sys_var_bool_ptr
sys_concurrent_insert
(
"concurrent_insert"
,
...
@@ -362,7 +361,10 @@ sys_var *sys_variables[]=
...
@@ -362,7 +361,10 @@ sys_var *sys_variables[]=
&
sys_binlog_cache_size
,
&
sys_binlog_cache_size
,
&
sys_buffer_results
,
&
sys_buffer_results
,
&
sys_bulk_insert_buff_size
,
&
sys_bulk_insert_buff_size
,
&
sys_character_set_server
,
&
sys_character_set_database
,
&
sys_character_set_client
,
&
sys_character_set_client
,
&
sys_character_set_connection
,
&
sys_character_set_results
,
&
sys_character_set_results
,
&
sys_collation_connection
,
&
sys_collation_connection
,
&
sys_concurrent_insert
,
&
sys_concurrent_insert
,
...
@@ -481,9 +483,11 @@ struct show_var_st init_vars[]= {
...
@@ -481,9 +483,11 @@ struct show_var_st init_vars[]= {
#endif
#endif
{
sys_binlog_cache_size
.
name
,(
char
*
)
&
sys_binlog_cache_size
,
SHOW_SYS
},
{
sys_binlog_cache_size
.
name
,(
char
*
)
&
sys_binlog_cache_size
,
SHOW_SYS
},
{
sys_bulk_insert_buff_size
.
name
,(
char
*
)
&
sys_bulk_insert_buff_size
,
SHOW_SYS
},
{
sys_bulk_insert_buff_size
.
name
,(
char
*
)
&
sys_bulk_insert_buff_size
,
SHOW_SYS
},
{
sys_char
set
.
name
,
(
char
*
)
&
sys_charset
,
SHOW_SYS
},
{
sys_char
acter_set_server
.
name
,
(
char
*
)
&
sys_character_set_server
,
SHOW_SYS
},
{
sys_charset_system
.
name
,
(
char
*
)
&
sys_charset_system
,
SHOW_SYS
},
{
sys_charset_system
.
name
,
(
char
*
)
&
sys_charset_system
,
SHOW_SYS
},
{
sys_character_set_database
.
name
,
(
char
*
)
&
sys_character_set_database
,
SHOW_SYS
},
{
sys_character_set_client
.
name
,(
char
*
)
&
sys_character_set_client
,
SHOW_SYS
},
{
sys_character_set_client
.
name
,(
char
*
)
&
sys_character_set_client
,
SHOW_SYS
},
{
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_character_set_results
.
name
,(
char
*
)
&
sys_character_set_results
,
SHOW_SYS
},
{
sys_collation_connection
.
name
,(
char
*
)
&
sys_collation_connection
,
SHOW_SYS
},
{
sys_collation_connection
.
name
,(
char
*
)
&
sys_collation_connection
,
SHOW_SYS
},
{
sys_concurrent_insert
.
name
,(
char
*
)
&
sys_concurrent_insert
,
SHOW_SYS
},
{
sys_concurrent_insert
.
name
,(
char
*
)
&
sys_concurrent_insert
,
SHOW_SYS
},
...
@@ -1276,9 +1280,15 @@ bool sys_var_character_set::check(THD *thd, set_var *var)
...
@@ -1276,9 +1280,15 @@ bool sys_var_character_set::check(THD *thd, set_var *var)
String
str
(
buff
,
sizeof
(
buff
),
system_charset_info
),
*
res
;
String
str
(
buff
,
sizeof
(
buff
),
system_charset_info
),
*
res
;
if
(
!
(
res
=
var
->
value
->
val_str
(
&
str
)))
if
(
!
(
res
=
var
->
value
->
val_str
(
&
str
)))
res
=
&
empty_string
;
{
if
(
!
nullable
)
if
(
!
(
tmp
=
get_charset_by_csname
(
res
->
c_ptr
(),
MY_CS_PRIMARY
,
MYF
(
0
)))
&&
{
my_error
(
ER_UNKNOWN_CHARACTER_SET
,
MYF
(
0
),
"NULL"
);
return
1
;
}
tmp
=
NULL
;
}
else
if
(
!
(
tmp
=
get_charset_by_csname
(
res
->
c_ptr
(),
MY_CS_PRIMARY
,
MYF
(
0
)))
&&
!
(
tmp
=
get_old_charset_by_name
(
res
->
c_ptr
())))
!
(
tmp
=
get_old_charset_by_name
(
res
->
c_ptr
())))
{
{
my_error
(
ER_UNKNOWN_CHARACTER_SET
,
MYF
(
0
),
res
->
c_ptr
());
my_error
(
ER_UNKNOWN_CHARACTER_SET
,
MYF
(
0
),
res
->
c_ptr
());
...
@@ -1288,23 +1298,44 @@ bool sys_var_character_set::check(THD *thd, set_var *var)
...
@@ -1288,23 +1298,44 @@ bool sys_var_character_set::check(THD *thd, set_var *var)
return
0
;
return
0
;
}
}
bool
sys_var_character_set
_client
::
update
(
THD
*
thd
,
set_var
*
var
)
bool
sys_var_character_set
::
update
(
THD
*
thd
,
set_var
*
var
)
{
{
if
(
var
->
type
==
OPT_GLOBAL
)
ci_ptr
(
thd
,
var
->
type
)[
0
]
=
var
->
save_result
.
charset
;
global_system_variables
.
character_set_client
=
var
->
save_result
.
charset
;
else
thd
->
variables
.
character_set_client
=
var
->
save_result
.
charset
;
return
0
;
return
0
;
}
}
byte
*
sys_var_character_set
_client
::
value_ptr
(
THD
*
thd
,
enum_var_type
type
)
byte
*
sys_var_character_set
::
value_ptr
(
THD
*
thd
,
enum_var_type
type
)
{
{
CHARSET_INFO
*
cs
=
((
type
==
OPT_GLOBAL
)
?
CHARSET_INFO
*
cs
=
ci_ptr
(
thd
,
type
)[
0
];
global_system_variables
.
character_set_client
:
thd
->
variables
.
character_set_client
);
return
cs
?
(
byte
*
)
cs
->
csname
:
(
byte
*
)
"NULL"
;
return
cs
?
(
byte
*
)
cs
->
csname
:
(
byte
*
)
"NULL"
;
}
}
CHARSET_INFO
**
sys_var_character_set_connection
::
ci_ptr
(
THD
*
thd
,
enum_var_type
type
)
{
if
(
type
==
OPT_GLOBAL
)
return
&
global_system_variables
.
collation_connection
;
else
return
&
thd
->
variables
.
collation_connection
;
}
void
sys_var_character_set_connection
::
set_default
(
THD
*
thd
,
enum_var_type
type
)
{
if
(
type
==
OPT_GLOBAL
)
global_system_variables
.
collation_connection
=
default_charset_info
;
else
thd
->
variables
.
collation_connection
=
global_system_variables
.
collation_connection
;
}
CHARSET_INFO
**
sys_var_character_set_client
::
ci_ptr
(
THD
*
thd
,
enum_var_type
type
)
{
if
(
type
==
OPT_GLOBAL
)
return
&
global_system_variables
.
character_set_client
;
else
return
&
thd
->
variables
.
character_set_client
;
}
void
sys_var_character_set_client
::
set_default
(
THD
*
thd
,
enum_var_type
type
)
void
sys_var_character_set_client
::
set_default
(
THD
*
thd
,
enum_var_type
type
)
{
{
if
(
type
==
OPT_GLOBAL
)
if
(
type
==
OPT_GLOBAL
)
...
@@ -1313,58 +1344,81 @@ void sys_var_character_set_client::set_default(THD *thd, enum_var_type type)
...
@@ -1313,58 +1344,81 @@ void sys_var_character_set_client::set_default(THD *thd, enum_var_type type)
thd
->
variables
.
character_set_client
=
global_system_variables
.
character_set_client
;
thd
->
variables
.
character_set_client
=
global_system_variables
.
character_set_client
;
}
}
CHARSET_INFO
**
sys_var_character_set_results
::
ci_ptr
(
THD
*
thd
,
enum_var_type
type
)
bool
sys_var_collation_connection
::
update
(
THD
*
thd
,
set_var
*
var
)
{
{
if
(
var
->
type
==
OPT_GLOBAL
)
if
(
type
==
OPT_GLOBAL
)
global_system_variables
.
collation_connection
=
var
->
save_result
.
charset
;
return
&
global_system_variables
.
character_set_results
;
else
else
thd
->
variables
.
collation_connection
=
var
->
save_result
.
charset
;
return
&
thd
->
variables
.
character_set_results
;
return
0
;
}
}
byte
*
sys_var_collation_connection
::
value_ptr
(
THD
*
thd
,
enum_var_type
type
)
void
sys_var_character_set_results
::
set_default
(
THD
*
thd
,
enum_var_type
type
)
{
{
CHARSET_INFO
*
cs
=
((
type
==
OPT_GLOBAL
)
?
if
(
type
==
OPT_GLOBAL
)
global_system_variables
.
collation_connection
:
global_system_variables
.
character_set_results
=
NULL
;
thd
->
variables
.
collation_connection
);
else
return
cs
?
(
byte
*
)
cs
->
name
:
(
byte
*
)
"NULL"
;
thd
->
variables
.
character_set_results
=
global_system_variables
.
character_set_results
;
}
}
void
sys_var_collation_connection
::
set_default
(
THD
*
thd
,
enum_var_type
type
)
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
;
else
return
&
thd
->
variables
.
character_set_server
;
}
void
sys_var_character_set_server
::
set_default
(
THD
*
thd
,
enum_var_type
type
)
{
{
if
(
type
==
OPT_GLOBAL
)
if
(
type
==
OPT_GLOBAL
)
global_system_variables
.
c
ollation_connection
=
default_charset_info
;
global_system_variables
.
c
haracter_set_server
=
default_charset_info
;
else
else
thd
->
variables
.
collation_connection
=
global_system_variables
.
collation_connection
;
thd
->
variables
.
character_set_server
=
global_system_variables
.
character_set_server
;
}
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
;
else
return
&
thd
->
variables
.
character_set_database
;
}
}
bool
sys_var_character_set_results
::
update
(
THD
*
thd
,
set_var
*
var
)
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
;
else
thd
->
variables
.
character_set_database
=
thd
->
db_charset
;
}
bool
sys_var_collation_connection
::
update
(
THD
*
thd
,
set_var
*
var
)
{
{
if
(
var
->
type
==
OPT_GLOBAL
)
if
(
var
->
type
==
OPT_GLOBAL
)
global_system_variables
.
c
haracter_set_results
=
var
->
save_result
.
charset
;
global_system_variables
.
c
ollation_connection
=
var
->
save_result
.
charset
;
else
else
thd
->
variables
.
c
haracter_set_results
=
var
->
save_result
.
charset
;
thd
->
variables
.
c
ollation_connection
=
var
->
save_result
.
charset
;
return
0
;
return
0
;
}
}
byte
*
sys_var_c
haracter_set_results
::
value_ptr
(
THD
*
thd
,
enum_var_type
type
)
byte
*
sys_var_c
ollation_connection
::
value_ptr
(
THD
*
thd
,
enum_var_type
type
)
{
{
CHARSET_INFO
*
cs
=
((
type
==
OPT_GLOBAL
)
?
CHARSET_INFO
*
cs
=
((
type
==
OPT_GLOBAL
)
?
global_system_variables
.
c
haracter_set_results
:
global_system_variables
.
c
ollation_connection
:
thd
->
variables
.
c
haracter_set_results
);
thd
->
variables
.
c
ollation_connection
);
return
cs
?
(
byte
*
)
cs
->
cs
name
:
(
byte
*
)
"NULL"
;
return
cs
?
(
byte
*
)
cs
->
name
:
(
byte
*
)
"NULL"
;
}
}
void
sys_var_c
haracter_set_results
::
set_default
(
THD
*
thd
,
enum_var_type
type
)
void
sys_var_c
ollation_connection
::
set_default
(
THD
*
thd
,
enum_var_type
type
)
{
{
if
(
type
==
OPT_GLOBAL
)
if
(
type
==
OPT_GLOBAL
)
global_system_variables
.
c
haracter_set_results
=
NULL
;
global_system_variables
.
c
ollation_connection
=
default_charset_info
;
else
else
thd
->
variables
.
c
haracter_set_results
=
global_system_variables
.
character_set_results
;
thd
->
variables
.
c
ollation_connection
=
global_system_variables
.
collation_connection
;
}
}
/*****************************************************************************
/*****************************************************************************
Functions to handle SET NAMES and SET CHARACTER SET
Functions to handle SET NAMES and SET CHARACTER SET
*****************************************************************************/
*****************************************************************************/
...
...
sql/set_var.h
View file @
e15ea029
...
@@ -433,7 +433,9 @@ SHOW_TYPE type() { return SHOW_CHAR; }
...
@@ -433,7 +433,9 @@ SHOW_TYPE type() { return SHOW_CHAR; }
class
sys_var_character_set
:
public
sys_var_thd
class
sys_var_character_set
:
public
sys_var_thd
{
{
public:
public:
sys_var_character_set
(
const
char
*
name_arg
)
:
sys_var_thd
(
name_arg
)
{}
bool
nullable
;
sys_var_character_set
(
const
char
*
name_arg
)
:
sys_var_thd
(
name_arg
)
{
nullable
=
0
;
}
bool
check
(
THD
*
thd
,
set_var
*
var
);
bool
check
(
THD
*
thd
,
set_var
*
var
);
SHOW_TYPE
type
()
{
return
SHOW_CHAR
;
}
SHOW_TYPE
type
()
{
return
SHOW_CHAR
;
}
bool
check_update_type
(
Item_result
type
)
bool
check_update_type
(
Item_result
type
)
...
@@ -441,7 +443,10 @@ SHOW_TYPE type() { return SHOW_CHAR; }
...
@@ -441,7 +443,10 @@ SHOW_TYPE type() { return SHOW_CHAR; }
return
type
!=
STRING_RESULT
;
/* Only accept strings */
return
type
!=
STRING_RESULT
;
/* Only accept strings */
}
}
bool
check_default
(
enum_var_type
type
)
{
return
0
;
}
bool
check_default
(
enum_var_type
type
)
{
return
0
;
}
bool
update
(
THD
*
thd
,
set_var
*
var
);
byte
*
value_ptr
(
THD
*
thd
,
enum_var_type
type
);
virtual
void
set_default
(
THD
*
thd
,
enum_var_type
type
)
=
0
;
virtual
void
set_default
(
THD
*
thd
,
enum_var_type
type
)
=
0
;
virtual
CHARSET_INFO
**
ci_ptr
(
THD
*
thd
,
enum_var_type
type
)
=
0
;
};
};
class
sys_var_character_set_client
:
public
sys_var_character_set
class
sys_var_character_set_client
:
public
sys_var_character_set
...
@@ -449,19 +454,45 @@ class sys_var_character_set_client :public sys_var_character_set
...
@@ -449,19 +454,45 @@ class sys_var_character_set_client :public sys_var_character_set
public:
public:
sys_var_character_set_client
(
const
char
*
name_arg
)
:
sys_var_character_set_client
(
const
char
*
name_arg
)
:
sys_var_character_set
(
name_arg
)
{}
sys_var_character_set
(
name_arg
)
{}
bool
update
(
THD
*
thd
,
set_var
*
var
);
void
set_default
(
THD
*
thd
,
enum_var_type
type
);
void
set_default
(
THD
*
thd
,
enum_var_type
type
);
byte
*
value
_ptr
(
THD
*
thd
,
enum_var_type
type
);
CHARSET_INFO
**
ci
_ptr
(
THD
*
thd
,
enum_var_type
type
);
};
};
class
sys_var_character_set_results
:
public
sys_var_character_set
class
sys_var_character_set_results
:
public
sys_var_character_set
{
{
public:
public:
sys_var_character_set_results
(
const
char
*
name_arg
)
:
sys_var_character_set_results
(
const
char
*
name_arg
)
:
sys_var_character_set
(
name_arg
)
{
nullable
=
1
;
}
void
set_default
(
THD
*
thd
,
enum_var_type
type
);
CHARSET_INFO
**
ci_ptr
(
THD
*
thd
,
enum_var_type
type
);
};
class
sys_var_character_set_server
:
public
sys_var_character_set
{
public:
sys_var_character_set_server
(
const
char
*
name_arg
)
:
sys_var_character_set
(
name_arg
)
{}
sys_var_character_set
(
name_arg
)
{}
bool
update
(
THD
*
thd
,
set_var
*
var
);
void
set_default
(
THD
*
thd
,
enum_var_type
type
);
void
set_default
(
THD
*
thd
,
enum_var_type
type
);
byte
*
value_ptr
(
THD
*
thd
,
enum_var_type
type
);
CHARSET_INFO
**
ci_ptr
(
THD
*
thd
,
enum_var_type
type
);
};
class
sys_var_character_set_database
:
public
sys_var_character_set
{
public:
sys_var_character_set_database
(
const
char
*
name_arg
)
:
sys_var_character_set
(
name_arg
)
{}
void
set_default
(
THD
*
thd
,
enum_var_type
type
);
CHARSET_INFO
**
ci_ptr
(
THD
*
thd
,
enum_var_type
type
);
};
class
sys_var_character_set_connection
:
public
sys_var_character_set
{
public:
sys_var_character_set_connection
(
const
char
*
name_arg
)
:
sys_var_character_set
(
name_arg
)
{}
void
set_default
(
THD
*
thd
,
enum_var_type
type
);
CHARSET_INFO
**
ci_ptr
(
THD
*
thd
,
enum_var_type
type
);
};
};
class
sys_var_collation_connection
:
public
sys_var_collation
class
sys_var_collation_connection
:
public
sys_var_collation
...
@@ -606,6 +637,5 @@ sys_var *find_sys_var(const char *str, uint length=0);
...
@@ -606,6 +637,5 @@ sys_var *find_sys_var(const char *str, uint length=0);
int
sql_set_variables
(
THD
*
thd
,
List
<
set_var_base
>
*
var_list
);
int
sql_set_variables
(
THD
*
thd
,
List
<
set_var_base
>
*
var_list
);
void
fix_delay_key_write
(
THD
*
thd
,
enum_var_type
type
);
void
fix_delay_key_write
(
THD
*
thd
,
enum_var_type
type
);
extern
sys_var_str
sys_charset
;
extern
sys_var_str
sys_charset_system
;
extern
sys_var_str
sys_charset_system
;
CHARSET_INFO
*
get_old_charset_by_name
(
const
char
*
old_name
);
CHARSET_INFO
*
get_old_charset_by_name
(
const
char
*
old_name
);
sql/sql_base.cc
View file @
e15ea029
...
@@ -2311,7 +2311,7 @@ int mysql_create_index(THD *thd, TABLE_LIST *table_list, List<Key> &keys)
...
@@ -2311,7 +2311,7 @@ int mysql_create_index(THD *thd, TABLE_LIST *table_list, List<Key> &keys)
DBUG_ENTER
(
"mysql_create_index"
);
DBUG_ENTER
(
"mysql_create_index"
);
bzero
((
char
*
)
&
create_info
,
sizeof
(
create_info
));
bzero
((
char
*
)
&
create_info
,
sizeof
(
create_info
));
create_info
.
db_type
=
DB_TYPE_DEFAULT
;
create_info
.
db_type
=
DB_TYPE_DEFAULT
;
create_info
.
table_charset
=
thd
->
db_charset
;
create_info
.
table_charset
=
thd
->
variables
.
character_set_database
;
DBUG_RETURN
(
mysql_alter_table
(
thd
,
table_list
->
db
,
table_list
->
real_name
,
DBUG_RETURN
(
mysql_alter_table
(
thd
,
table_list
->
db
,
table_list
->
real_name
,
&
create_info
,
table_list
,
&
create_info
,
table_list
,
fields
,
keys
,
drop
,
alter
,
0
,
(
ORDER
*
)
0
,
FALSE
,
fields
,
keys
,
drop
,
alter
,
0
,
(
ORDER
*
)
0
,
FALSE
,
...
@@ -2328,7 +2328,7 @@ int mysql_drop_index(THD *thd, TABLE_LIST *table_list, List<Alter_drop> &drop)
...
@@ -2328,7 +2328,7 @@ int mysql_drop_index(THD *thd, TABLE_LIST *table_list, List<Alter_drop> &drop)
DBUG_ENTER
(
"mysql_drop_index"
);
DBUG_ENTER
(
"mysql_drop_index"
);
bzero
((
char
*
)
&
create_info
,
sizeof
(
create_info
));
bzero
((
char
*
)
&
create_info
,
sizeof
(
create_info
));
create_info
.
db_type
=
DB_TYPE_DEFAULT
;
create_info
.
db_type
=
DB_TYPE_DEFAULT
;
create_info
.
table_charset
=
thd
->
db_charset
;
create_info
.
table_charset
=
thd
->
variables
.
character_set_database
;
DBUG_RETURN
(
mysql_alter_table
(
thd
,
table_list
->
db
,
table_list
->
real_name
,
DBUG_RETURN
(
mysql_alter_table
(
thd
,
table_list
->
db
,
table_list
->
real_name
,
&
create_info
,
table_list
,
&
create_info
,
table_list
,
fields
,
keys
,
drop
,
alter
,
0
,
(
ORDER
*
)
0
,
FALSE
,
fields
,
keys
,
drop
,
alter
,
0
,
(
ORDER
*
)
0
,
FALSE
,
...
...
sql/sql_class.cc
View file @
e15ea029
...
@@ -109,7 +109,7 @@ THD::THD():user_time(0), is_fatal_error(0),
...
@@ -109,7 +109,7 @@ THD::THD():user_time(0), is_fatal_error(0),
file_id
=
0
;
file_id
=
0
;
cond_count
=
0
;
cond_count
=
0
;
warn_id
=
0
;
warn_id
=
0
;
db_charset
=
default_charset_info
;
db_charset
=
global_system_variables
.
character_set_database
;
mysys_var
=
0
;
mysys_var
=
0
;
#ifndef DBUG_OFF
#ifndef DBUG_OFF
dbug_sentry
=
THD_SENTRY_MAGIC
;
dbug_sentry
=
THD_SENTRY_MAGIC
;
...
...
sql/sql_class.h
View file @
e15ea029
...
@@ -386,6 +386,8 @@ struct system_variables
...
@@ -386,6 +386,8 @@ struct system_variables
my_bool
low_priority_updates
;
my_bool
low_priority_updates
;
my_bool
new_mode
;
my_bool
new_mode
;
CHARSET_INFO
*
character_set_server
;
CHARSET_INFO
*
character_set_database
;
CHARSET_INFO
*
character_set_client
;
CHARSET_INFO
*
character_set_client
;
CHARSET_INFO
*
character_set_results
;
CHARSET_INFO
*
character_set_results
;
CHARSET_INFO
*
collation_connection
;
CHARSET_INFO
*
collation_connection
;
...
...
sql/sql_db.cc
View file @
e15ea029
...
@@ -51,7 +51,7 @@ static long mysql_rm_known_files(THD *thd, MY_DIR *dirp,
...
@@ -51,7 +51,7 @@ static long mysql_rm_known_files(THD *thd, MY_DIR *dirp,
1 Could not create file or write to it. Error sent through my_error()
1 Could not create file or write to it. Error sent through my_error()
*/
*/
static
bool
write_db_opt
(
const
char
*
path
,
HA_CREATE_INFO
*
create
)
static
bool
write_db_opt
(
THD
*
thd
,
const
char
*
path
,
HA_CREATE_INFO
*
create
)
{
{
register
File
file
;
register
File
file
;
char
buf
[
256
];
// Should be enough for one option
char
buf
[
256
];
// Should be enough for one option
...
@@ -61,8 +61,9 @@ static bool write_db_opt(const char *path, HA_CREATE_INFO *create)
...
@@ -61,8 +61,9 @@ static bool write_db_opt(const char *path, HA_CREATE_INFO *create)
{
{
ulong
length
;
ulong
length
;
CHARSET_INFO
*
cs
=
(
create
&&
create
->
table_charset
)
?
CHARSET_INFO
*
cs
=
(
create
&&
create
->
table_charset
)
?
create
->
table_charset
:
default_charset_info
;
create
->
table_charset
:
length
=
my_sprintf
(
buf
,(
buf
,
"default-character-set=%s
\n
"
,
cs
->
name
));
thd
->
variables
.
character_set_database
;
length
=
my_sprintf
(
buf
,(
buf
,
"default-character-set=%s
\n
default-collation=%s
\n
"
,
cs
->
csname
,
cs
->
name
));
/* Error is written by my_write */
/* Error is written by my_write */
if
(
!
my_write
(
file
,(
byte
*
)
buf
,
length
,
MYF
(
MY_NABP
+
MY_WME
)))
if
(
!
my_write
(
file
,(
byte
*
)
buf
,
length
,
MYF
(
MY_NABP
+
MY_WME
)))
...
@@ -89,7 +90,7 @@ static bool write_db_opt(const char *path, HA_CREATE_INFO *create)
...
@@ -89,7 +90,7 @@ static bool write_db_opt(const char *path, HA_CREATE_INFO *create)
*/
*/
static
bool
load_db_opt
(
const
char
*
path
,
HA_CREATE_INFO
*
create
)
static
bool
load_db_opt
(
THD
*
thd
,
const
char
*
path
,
HA_CREATE_INFO
*
create
)
{
{
File
file
;
File
file
;
char
buf
[
256
];
char
buf
[
256
];
...
@@ -98,7 +99,7 @@ static bool load_db_opt(const char *path, HA_CREATE_INFO *create)
...
@@ -98,7 +99,7 @@ static bool load_db_opt(const char *path, HA_CREATE_INFO *create)
uint
nbytes
;
uint
nbytes
;
bzero
((
char
*
)
create
,
sizeof
(
*
create
));
bzero
((
char
*
)
create
,
sizeof
(
*
create
));
create
->
table_charset
=
default_charset_info
;
create
->
table_charset
=
global_system_variables
.
character_set_database
;
if
((
file
=
my_open
(
path
,
O_RDONLY
|
O_SHARE
,
MYF
(
0
)))
>=
0
)
if
((
file
=
my_open
(
path
,
O_RDONLY
|
O_SHARE
,
MYF
(
0
)))
>=
0
)
{
{
IO_CACHE
cache
;
IO_CACHE
cache
;
...
@@ -115,12 +116,18 @@ static bool load_db_opt(const char *path, HA_CREATE_INFO *create)
...
@@ -115,12 +116,18 @@ static bool load_db_opt(const char *path, HA_CREATE_INFO *create)
{
{
if
(
!
strncmp
(
buf
,
"default-character-set"
,
(
pos
-
buf
)))
if
(
!
strncmp
(
buf
,
"default-character-set"
,
(
pos
-
buf
)))
{
{
if
(
strcmp
(
pos
+
1
,
"DEFAULT"
))
if
(
!
(
create
->
table_charset
=
get_charset_by_csname
(
pos
+
1
,
MY_CS_PRIMARY
,
MYF
(
0
))))
{
{
if
(
!
(
create
->
table_charset
=
get_charset_by_name
(
pos
+
1
,
MYF
(
0
))))
sql_print_error
(
ER
(
ER_UNKNOWN_CHARACTER_SET
),
pos
+
1
);
{
}
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
))))
{
sql_print_error
(
ER
(
ER_UNKNOWN_CHARACTER_SET
),
pos
+
1
);
}
}
}
}
}
}
...
@@ -197,7 +204,7 @@ int mysql_create_db(THD *thd, char *db, HA_CREATE_INFO *create_info,
...
@@ -197,7 +204,7 @@ int mysql_create_db(THD *thd, char *db, HA_CREATE_INFO *create_info,
unpack_dirname
(
path
,
path
);
unpack_dirname
(
path
,
path
);
strcat
(
path
,
MY_DB_OPT_FILE
);
strcat
(
path
,
MY_DB_OPT_FILE
);
if
(
write_db_opt
(
path
,
create_info
))
if
(
write_db_opt
(
thd
,
path
,
create_info
))
{
{
/*
/*
Could not create options file.
Could not create options file.
...
@@ -270,7 +277,7 @@ int mysql_alter_db(THD *thd, const char *db, HA_CREATE_INFO *create_info)
...
@@ -270,7 +277,7 @@ int mysql_alter_db(THD *thd, const char *db, HA_CREATE_INFO *create_info)
/* Check directory */
/* Check directory */
(
void
)
sprintf
(
path
,
"%s/%s/%s"
,
mysql_data_home
,
db
,
MY_DB_OPT_FILE
);
(
void
)
sprintf
(
path
,
"%s/%s/%s"
,
mysql_data_home
,
db
,
MY_DB_OPT_FILE
);
fn_format
(
path
,
path
,
""
,
""
,
MYF
(
MY_UNPACK_FILENAME
));
fn_format
(
path
,
path
,
""
,
""
,
MYF
(
MY_UNPACK_FILENAME
));
if
((
error
=
write_db_opt
(
path
,
create_info
)))
if
((
error
=
write_db_opt
(
thd
,
path
,
create_info
)))
goto
exit
;
goto
exit
;
/*
/*
...
@@ -280,7 +287,9 @@ int mysql_alter_db(THD *thd, const char *db, HA_CREATE_INFO *create_info)
...
@@ -280,7 +287,9 @@ int mysql_alter_db(THD *thd, const char *db, HA_CREATE_INFO *create_info)
if
(
thd
->
db
&&
!
strcmp
(
thd
->
db
,
db
))
if
(
thd
->
db
&&
!
strcmp
(
thd
->
db
,
db
))
{
{
thd
->
db_charset
=
(
create_info
&&
create_info
->
table_charset
)
?
thd
->
db_charset
=
(
create_info
&&
create_info
->
table_charset
)
?
create_info
->
table_charset
:
default_charset_info
;
create_info
->
table_charset
:
global_system_variables
.
character_set_database
;
thd
->
variables
.
character_set_database
=
thd
->
db_charset
;
}
}
mysql_update_log
.
write
(
thd
,
thd
->
query
,
thd
->
query_length
);
mysql_update_log
.
write
(
thd
,
thd
->
query
,
thd
->
query_length
);
...
@@ -615,8 +624,11 @@ bool mysql_change_db(THD *thd, const char *name)
...
@@ -615,8 +624,11 @@ bool mysql_change_db(THD *thd, const char *name)
thd
->
db_access
=
db_access
;
thd
->
db_access
=
db_access
;
strmov
(
path
+
unpack_dirname
(
path
,
path
),
MY_DB_OPT_FILE
);
strmov
(
path
+
unpack_dirname
(
path
,
path
),
MY_DB_OPT_FILE
);
load_db_opt
(
path
,
&
create
);
load_db_opt
(
thd
,
path
,
&
create
);
thd
->
db_charset
=
create
.
table_charset
?
create
.
table_charset
:
default_charset_info
;
thd
->
db_charset
=
create
.
table_charset
?
create
.
table_charset
:
global_system_variables
.
character_set_database
;
thd
->
variables
.
character_set_database
=
thd
->
db_charset
;
DBUG_RETURN
(
0
);
DBUG_RETURN
(
0
);
}
}
...
@@ -674,7 +686,7 @@ int mysqld_show_create_db(THD *thd, char *dbname,
...
@@ -674,7 +686,7 @@ int mysqld_show_create_db(THD *thd, char *dbname,
if
(
found_libchar
)
if
(
found_libchar
)
path
[
length
-
1
]
=
FN_LIBCHAR
;
path
[
length
-
1
]
=
FN_LIBCHAR
;
strmov
(
path
+
length
,
MY_DB_OPT_FILE
);
strmov
(
path
+
length
,
MY_DB_OPT_FILE
);
load_db_opt
(
path
,
&
create
);
load_db_opt
(
thd
,
path
,
&
create
);
List
<
Item
>
field_list
;
List
<
Item
>
field_list
;
field_list
.
push_back
(
new
Item_empty_string
(
"Database"
,
NAME_LEN
));
field_list
.
push_back
(
new
Item_empty_string
(
"Database"
,
NAME_LEN
));
...
...
sql/sql_help.cc
View file @
e15ea029
...
@@ -557,7 +557,7 @@ int send_variant_2_list(MEM_ROOT *mem_root, Protocol *protocol,
...
@@ -557,7 +557,7 @@ int send_variant_2_list(MEM_ROOT *mem_root, Protocol *protocol,
List_iterator
<
String
>
it
(
*
names
);
List_iterator
<
String
>
it
(
*
names
);
String
*
cur_name
;
String
*
cur_name
;
while
(
*
pos
++=
it
++
);
while
(
(
*
pos
++=
it
++
)
);
qsort
(
pointers
,
names
->
elements
,
sizeof
(
String
*
),
string_ptr_cmp
);
qsort
(
pointers
,
names
->
elements
,
sizeof
(
String
*
),
string_ptr_cmp
);
...
@@ -689,7 +689,7 @@ int mysqld_help(THD *thd, const char *mask)
...
@@ -689,7 +689,7 @@ int mysqld_help(THD *thd, const char *mask)
goto
end
;
goto
end
;
}
}
for
(
in
t
i
=
0
;
i
<
sizeof
(
tables
)
/
sizeof
(
TABLE_LIST
);
i
++
)
for
(
size_
t
i
=
0
;
i
<
sizeof
(
tables
)
/
sizeof
(
TABLE_LIST
);
i
++
)
tables
[
i
].
table
->
file
->
init_table_handle_for_HANDLER
();
tables
[
i
].
table
->
file
->
init_table_handle_for_HANDLER
();
if
(
!
(
select_topics_by_name
=
if
(
!
(
select_topics_by_name
=
...
...
sql/sql_load.cc
View file @
e15ea029
...
@@ -215,7 +215,7 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
...
@@ -215,7 +215,7 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
info
.
handle_duplicates
=
handle_duplicates
;
info
.
handle_duplicates
=
handle_duplicates
;
info
.
escape_char
=
escaped
->
length
()
?
(
*
escaped
)[
0
]
:
INT_MAX
;
info
.
escape_char
=
escaped
->
length
()
?
(
*
escaped
)[
0
]
:
INT_MAX
;
READ_INFO
read_info
(
file
,
tot_length
,
thd
->
db_charset
,
READ_INFO
read_info
(
file
,
tot_length
,
thd
->
variables
.
character_set_database
,
*
field_term
,
*
ex
->
line_start
,
*
ex
->
line_term
,
*
enclosed
,
*
field_term
,
*
ex
->
line_start
,
*
ex
->
line_term
,
*
enclosed
,
info
.
escape_char
,
read_file_from_client
,
is_fifo
);
info
.
escape_char
,
read_file_from_client
,
is_fifo
);
if
(
read_info
.
error
)
if
(
read_info
.
error
)
...
...
sql/sql_table.cc
View file @
e15ea029
...
@@ -481,7 +481,8 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name,
...
@@ -481,7 +481,8 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name,
{
{
if
(
!
sql_field
->
charset
)
if
(
!
sql_field
->
charset
)
sql_field
->
charset
=
create_info
->
table_charset
?
sql_field
->
charset
=
create_info
->
table_charset
?
create_info
->
table_charset
:
thd
->
db_charset
;
create_info
->
table_charset
:
thd
->
variables
.
character_set_database
;
switch
(
sql_field
->
sql_type
)
{
switch
(
sql_field
->
sql_type
)
{
case
FIELD_TYPE_BLOB
:
case
FIELD_TYPE_BLOB
:
...
...
sql/sql_yacc.yy
View file @
e15ea029
...
@@ -848,7 +848,7 @@ create:
...
@@ -848,7 +848,7 @@ create:
bzero((char*) &lex->create_info,sizeof(lex->create_info));
bzero((char*) &lex->create_info,sizeof(lex->create_info));
lex->create_info.options=$2 | $4;
lex->create_info.options=$2 | $4;
lex->create_info.db_type= (enum db_type) lex->thd->variables.table_type;
lex->create_info.db_type= (enum db_type) lex->thd->variables.table_type;
lex->create_info.table_charset= thd->
db_charset
;
lex->create_info.table_charset= thd->
variables.character_set_database
;
lex->name=0;
lex->name=0;
}
}
create2
create2
...
@@ -1536,7 +1536,7 @@ alter:
...
@@ -1536,7 +1536,7 @@ alter:
lex->select_lex.db=lex->name=0;
lex->select_lex.db=lex->name=0;
bzero((char*) &lex->create_info,sizeof(lex->create_info));
bzero((char*) &lex->create_info,sizeof(lex->create_info));
lex->create_info.db_type= DB_TYPE_DEFAULT;
lex->create_info.db_type= DB_TYPE_DEFAULT;
lex->create_info.table_charset= thd->
db_charset
;
lex->create_info.table_charset= thd->
variables.character_set_database
;
lex->create_info.row_type= ROW_TYPE_NOT_USED;
lex->create_info.row_type= ROW_TYPE_NOT_USED;
lex->alter_keys_onoff=LEAVE_AS_IS;
lex->alter_keys_onoff=LEAVE_AS_IS;
lex->simple_alter=1;
lex->simple_alter=1;
...
@@ -4439,7 +4439,7 @@ option_value:
...
@@ -4439,7 +4439,7 @@ option_value:
THD *thd= YYTHD;
THD *thd= YYTHD;
LEX *lex= Lex;
LEX *lex= Lex;
$2= $2 ? $2: global_system_variables.character_set_client;
$2= $2 ? $2: global_system_variables.character_set_client;
lex->var_list.push_back(new set_var_collation_client($2,thd->
db_charset
,$2));
lex->var_list.push_back(new set_var_collation_client($2,thd->
variables.character_set_database
,$2));
}
}
| NAMES_SYM charset_name_or_default opt_collate
| NAMES_SYM charset_name_or_default opt_collate
{
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment