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
7f21fb31
Commit
7f21fb31
authored
Feb 21, 2003
by
bar@bar.mysql.r18.ru
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
DATABASE character set is never blank anymore
parent
7d24a792
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
10 deletions
+10
-10
sql/sql_db.cc
sql/sql_db.cc
+7
-5
sql/sql_table.cc
sql/sql_table.cc
+1
-3
sql/sql_yacc.yy
sql/sql_yacc.yy
+2
-2
No files found.
sql/sql_db.cc
View file @
7f21fb31
...
...
@@ -60,9 +60,9 @@ static bool write_db_opt(const char *path, HA_CREATE_INFO *create)
if
((
file
=
my_create
(
path
,
CREATE_MODE
,
O_RDWR
|
O_TRUNC
,
MYF
(
MY_WME
)))
>=
0
)
{
ulong
length
;
length
=
my_sprintf
(
buf
,(
buf
,
"default-character-set=%s
\n
"
,
(
create
&&
create
->
table_charset
)
?
create
->
table_charset
->
name
:
"DEFAULT"
));
CHARSET_INFO
*
cs
=
(
create
&&
create
->
table_charset
)
?
create
->
table_charset
:
default_charset_info
;
length
=
my_sprintf
(
buf
,(
buf
,
"default-character-set=%s
\n
"
,
cs
->
name
));
/* Error is written by my_write */
if
(
!
my_write
(
file
,(
byte
*
)
buf
,
length
,
MYF
(
MY_NABP
+
MY_WME
)))
...
...
@@ -98,6 +98,7 @@ static bool load_db_opt(const char *path, HA_CREATE_INFO *create)
uint
nbytes
;
bzero
((
char
*
)
create
,
sizeof
(
*
create
));
create
->
table_charset
=
default_charset_info
;
if
((
file
=
my_open
(
path
,
O_RDONLY
|
O_SHARE
,
MYF
(
0
)))
>=
0
)
{
IO_CACHE
cache
;
...
...
@@ -278,7 +279,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
:
NULL
;
thd
->
db_charset
=
(
create_info
&&
create_info
->
table_charset
)
?
create_info
->
table_charset
:
default_charset_info
;
}
mysql_update_log
.
write
(
thd
,
thd
->
query
,
thd
->
query_length
);
...
...
@@ -599,7 +601,7 @@ bool mysql_change_db(THD *thd, const char *name)
strmov
(
path
+
unpack_dirname
(
path
,
path
),
MY_DB_OPT_FILE
);
load_db_opt
(
path
,
&
create
);
thd
->
db_charset
=
create
.
table_charset
;
thd
->
db_charset
=
create
.
table_charset
?
create
.
table_charset
:
default_charset_info
;
thd
->
variables
.
thd_charset
=
thd
->
db_charset
?
thd
->
db_charset
:
default_charset_info
;
DBUG_RETURN
(
0
);
}
...
...
sql/sql_table.cc
View file @
7f21fb31
...
...
@@ -461,9 +461,7 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name,
{
if
(
!
sql_field
->
charset
)
sql_field
->
charset
=
create_info
->
table_charset
?
create_info
->
table_charset
:
thd
->
db_charset
?
thd
->
db_charset
:
default_charset_info
;
create_info
->
table_charset
:
thd
->
db_charset
;
switch
(
sql_field
->
sql_type
)
{
case
FIELD_TYPE_BLOB
:
...
...
sql/sql_yacc.yy
View file @
7f21fb31
...
...
@@ -839,7 +839,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->db_charset?thd->db_charset:default_charset_info
;
lex->create_info.table_charset=
thd->db_charset
;
lex->name=0;
}
create2
...
...
@@ -1445,7 +1445,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->db_charset?thd->db_charset:default_charset_info
;
lex->create_info.table_charset=
thd->db_charset
;
lex->create_info.row_type= ROW_TYPE_NOT_USED;
lex->alter_keys_onoff=LEAVE_AS_IS;
lex->simple_alter=1;
...
...
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