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
3ad618d4
Commit
3ad618d4
authored
Jun 27, 2002
by
bar@gw.udmsearch.izhnet.ru
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Now database default character is changed during ALTER DATABASE
if the current db is being altered
parent
0dce493b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
6 deletions
+16
-6
sql/sql_db.cc
sql/sql_db.cc
+16
-6
No files found.
sql/sql_db.cc
View file @
3ad618d4
...
...
@@ -36,7 +36,7 @@ static long mysql_rm_known_files(THD *thd, MY_DIR *dirp,
Currently databse default charset is only stored there.
*/
static
int
write_db_opt
(
THD
*
thd
,
char
*
db
,
HA_CREATE_INFO
*
create
,
char
*
fn
)
static
int
write_db_opt
(
THD
*
thd
,
const
char
*
db
,
HA_CREATE_INFO
*
create
,
char
*
fn
)
{
register
File
file
;
char
buf
[
256
];
// Should be enough
...
...
@@ -72,7 +72,7 @@ static int write_db_opt(THD *thd, char *db, HA_CREATE_INFO *create, char *fn)
/*
Load database options file:
*/
static
int
load_db_opt
(
THD
*
thd
,
char
*
fn
)
static
int
load_db_opt
(
THD
*
thd
,
c
onst
char
*
db
,
HA_CREATE_INFO
*
create
,
c
har
*
fn
)
{
register
File
file
;
char
buf
[
256
]
=
""
;
...
...
@@ -217,8 +217,6 @@ int mysql_alter_db(THD *thd, char *db, HA_CREATE_INFO *create_info, bool silent)
register
File
file
;
uint
create_options
=
create_info
?
create_info
->
options
:
0
;
printf
(
"alter database
\n
"
);
VOID
(
pthread_mutex_lock
(
&
LOCK_mysql_create_db
));
// do not alter database if another thread is holding read lock
...
...
@@ -236,6 +234,15 @@ int mysql_alter_db(THD *thd, char *db, HA_CREATE_INFO *create_info, bool silent)
if
((
error
=
write_db_opt
(
thd
,
db
,
create_info
,
path
)))
goto
exit
;
/*
Change options if current
database is being altered
*/
if
(
thd
->
db
&&
!
strcmp
(
thd
->
db
,
db
))
{
thd
->
db_charset
=
create_info
?
create_info
->
table_charset
:
NULL
;
}
if
(
!
silent
)
{
if
(
!
thd
->
query
)
...
...
@@ -499,6 +506,8 @@ bool mysql_change_db(THD *thd,const char *name)
char
*
dbname
=
my_strdup
((
char
*
)
name
,
MYF
(
MY_WME
));
char
path
[
FN_REFLEN
];
uint
db_access
;
HA_CREATE_INFO
create
;
DBUG_ENTER
(
"mysql_change_db"
);
if
(
!
dbname
||
!
(
db_length
=
strip_sp
(
dbname
)))
...
...
@@ -553,8 +562,9 @@ bool mysql_change_db(THD *thd,const char *name)
strcat
(
path
,
"/"
);
unpack_dirname
(
path
,
path
);
strcat
(
path
,
MY_DB_OPT_FILE
);
load_db_opt
(
thd
,
path
);
bzero
(
&
create
,
sizeof
(
create
));
load_db_opt
(
thd
,
name
,
&
create
,
path
);
thd
->
db_charset
=
create
.
table_charset
;
DBUG_RETURN
(
0
);
}
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