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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
1d20c09c
Commit
1d20c09c
authored
Sep 15, 2003
by
bar@bar.mysql.r18.ru
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
New SQL variables "collation_server" and "collation_database"
parent
8d05911d
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
126 additions
and
30 deletions
+126
-30
sql/mysqld.cc
sql/mysqld.cc
+6
-6
sql/set_var.cc
sql/set_var.cc
+85
-9
sql/set_var.h
sql/set_var.h
+17
-0
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
+5
-2
sql/sql_db.cc
sql/sql_db.cc
+6
-6
sql/sql_load.cc
sql/sql_load.cc
+1
-1
sql/sql_yacc.yy
sql/sql_yacc.yy
+3
-3
No files found.
sql/mysqld.cc
View file @
1d20c09c
...
...
@@ -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
;
...
...
sql/set_var.cc
View file @
1d20c09c
...
...
@@ -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
.
c
haracter_set
_server
;
return
&
global_system_variables
.
c
ollation
_server
;
else
return
&
thd
->
variables
.
c
haracter_set
_server
;
return
&
thd
->
variables
.
c
ollation
_server
;
}
void
sys_var_character_set_server
::
set_default
(
THD
*
thd
,
enum_var_type
type
)
{
if
(
type
==
OPT_GLOBAL
)
global_system_variables
.
c
haracter_set
_server
=
default_charset_info
;
global_system_variables
.
c
ollation
_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
.
c
haracter_set
_database
;
return
&
global_system_variables
.
c
ollation
_database
;
else
return
&
thd
->
variables
.
c
haracter_set
_database
;
return
&
thd
->
variables
.
c
ollation
_database
;
}
void
sys_var_character_set_database
::
set_default
(
THD
*
thd
,
enum_var_type
type
)
{
if
(
type
==
OPT_GLOBAL
)
global_system_variables
.
c
haracter_set
_database
=
default_charset_info
;
global_system_variables
.
c
ollation
_database
=
default_charset_info
;
else
{
thd
->
variables
.
c
haracter_set
_database
=
thd
->
db_charset
;
thd
->
variables
.
c
ollation
_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
)
{
...
...
sql/set_var.h
View file @
1d20c09c
...
...
@@ -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
{
...
...
sql/sql_base.cc
View file @
1d20c09c
...
...
@@ -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
.
c
haracter_set
_database
;
create_info
.
table_charset
=
thd
->
variables
.
c
ollation
_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
.
c
haracter_set
_database
;
create_info
.
table_charset
=
thd
->
variables
.
c
ollation
_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
,
...
...
sql/sql_class.cc
View file @
1d20c09c
...
...
@@ -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
.
c
haracter_set
_database
;
db_charset
=
global_system_variables
.
c
ollation
_database
;
mysys_var
=
0
;
#ifndef DBUG_OFF
dbug_sentry
=
THD_SENTRY_MAGIC
;
...
...
sql/sql_class.h
View file @
1d20c09c
...
...
@@ -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
;
};
...
...
sql/sql_db.cc
View file @
1d20c09c
...
...
@@ -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
.
c
haracter_set
_database
;
thd
->
variables
.
c
ollation
_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 */
...
...
@@ -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
.
c
haracter_set
_database
;
create
->
table_charset
=
global_system_variables
.
c
ollation
_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
.
c
haracter_set
_database
;
thd
->
variables
.
c
haracter_set
_database
=
thd
->
db_charset
;
global_system_variables
.
c
ollation
_database
;
thd
->
variables
.
c
ollation
_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
.
c
haracter_set
_database
;
thd
->
variables
.
c
haracter_set
_database
=
thd
->
db_charset
;
global_system_variables
.
c
ollation
_database
;
thd
->
variables
.
c
ollation
_database
=
thd
->
db_charset
;
DBUG_RETURN
(
0
);
}
...
...
sql/sql_load.cc
View file @
1d20c09c
...
...
@@ -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
.
c
haracter_set
_database
,
READ_INFO
read_info
(
file
,
tot_length
,
thd
->
variables
.
c
ollation
_database
,
*
field_term
,
*
ex
->
line_start
,
*
ex
->
line_term
,
*
enclosed
,
info
.
escape_char
,
read_file_from_client
,
is_fifo
);
if
(
read_info
.
error
)
...
...
sql/sql_yacc.yy
View file @
1d20c09c
...
...
@@ -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.c
haracter_set
_database;
lex->create_info.table_charset= thd->variables.c
ollation
_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.c
haracter_set
_database;
lex->create_info.table_charset= thd->variables.c
ollation
_database;
lex->create_info.row_type= ROW_TYPE_NOT_USED;
lex->alter_keys_onoff=LEAVE_AS_IS;
lex->simple_alter=1;
...
...
@@ -4723,7 +4723,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.c
haracter_set
_database,$2));
lex->var_list.push_back(new set_var_collation_client($2,thd->variables.c
ollation
_database,$2));
}
| 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