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
e94fc374
Commit
e94fc374
authored
Dec 06, 2004
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Syntax extention: 'ALTER DATABASE' without db name (after review)
parent
77a9eede
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
41 additions
and
9 deletions
+41
-9
mysql-test/r/ctype_create.result
mysql-test/r/ctype_create.result
+9
-0
mysql-test/t/ctype_create.test
mysql-test/t/ctype_create.test
+12
-0
sql/sql_parse.cc
sql/sql_parse.cc
+12
-6
sql/sql_yacc.yy
sql/sql_yacc.yy
+8
-3
No files found.
mysql-test/r/ctype_create.result
View file @
e94fc374
...
...
@@ -63,3 +63,12 @@ ERROR HY000: Conflicting declarations: 'CHARACTER SET latin1' and 'CHARACTER SET
create database d1 default character set latin1 collate latin2_bin;
ERROR 42000: COLLATION 'latin2_bin' is not valid for CHARACTER SET 'latin1'
DROP DATABASE mysqltest1;
CREATE DATABASE mysqltest2 DEFAULT CHARACTER SET latin7;
use mysqltest2;
ALTER DATABASE DEFAULT CHARACTER SET latin2;
show create database mysqltest2;
Database Create Database
mysqltest2 CREATE DATABASE `mysqltest2` /*!40100 DEFAULT CHARACTER SET latin2 */
drop database mysqltest2;
ALTER DATABASE DEFAULT CHARACTER SET latin2;
ERROR 3D000: No database selected
mysql-test/t/ctype_create.test
View file @
e94fc374
...
...
@@ -86,3 +86,15 @@ create database d1 default character set latin1 collate latin2_bin;
#
#
DROP
DATABASE
mysqltest1
;
#
# Synatx: 'ALTER DATABASE' without db_name
#
CREATE
DATABASE
mysqltest2
DEFAULT
CHARACTER
SET
latin7
;
use
mysqltest2
;
ALTER
DATABASE
DEFAULT
CHARACTER
SET
latin2
;
show
create
database
mysqltest2
;
drop
database
mysqltest2
;
--
error
1046
ALTER
DATABASE
DEFAULT
CHARACTER
SET
latin2
;
sql/sql_parse.cc
View file @
e94fc374
...
...
@@ -3184,9 +3184,15 @@ purposes internal to the MySQL server", MYF(0));
}
case
SQLCOM_ALTER_DB
:
{
if
(
!
strip_sp
(
lex
->
name
)
||
check_db_name
(
lex
->
name
))
char
*
db
=
lex
->
name
?
lex
->
name
:
thd
->
db
;
if
(
!
db
)
{
net_printf
(
thd
,
ER_WRONG_DB_NAME
,
lex
->
name
);
send_error
(
thd
,
ER_NO_DB_ERROR
);
goto
error
;
}
if
(
!
strip_sp
(
db
)
||
check_db_name
(
db
))
{
net_printf
(
thd
,
ER_WRONG_DB_NAME
,
db
);
break
;
}
/*
...
...
@@ -3198,21 +3204,21 @@ purposes internal to the MySQL server", MYF(0));
*/
#ifdef HAVE_REPLICATION
if
(
thd
->
slave_thread
&&
(
!
db_ok
(
lex
->
name
,
replicate_do_db
,
replicate_ignore_db
)
||
!
db_ok_with_wild_table
(
lex
->
name
)))
(
!
db_ok
(
db
,
replicate_do_db
,
replicate_ignore_db
)
||
!
db_ok_with_wild_table
(
db
)))
{
my_error
(
ER_SLAVE_IGNORED_TABLE
,
MYF
(
0
));
break
;
}
#endif
if
(
check_access
(
thd
,
ALTER_ACL
,
lex
->
name
,
0
,
1
,
0
))
if
(
check_access
(
thd
,
ALTER_ACL
,
db
,
0
,
1
,
0
))
break
;
if
(
thd
->
locked_tables
||
thd
->
active_transaction
())
{
send_error
(
thd
,
ER_LOCK_OR_ACTIVE_TRANSACTION
);
goto
error
;
}
res
=
mysql_alter_db
(
thd
,
lex
->
name
,
&
lex
->
create_info
);
res
=
mysql_alter_db
(
thd
,
db
,
&
lex
->
create_info
);
break
;
}
case
SQLCOM_SHOW_CREATE_DB
:
...
...
sql/sql_yacc.yy
View file @
e94fc374
...
...
@@ -609,7 +609,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
%type <simple_string>
remember_name remember_end opt_ident opt_db text_or_password
opt_constraint constraint
opt_constraint constraint
ident_or_empty
%type <string>
text_string opt_gconcat_separator
...
...
@@ -1870,7 +1870,7 @@ alter:
}
alter_list
{}
| ALTER DATABASE ident
| ALTER DATABASE ident
_or_empty
{
Lex->create_info.default_table_charset= NULL;
Lex->create_info.used_fields= 0;
...
...
@@ -1879,10 +1879,15 @@ alter:
{
LEX *lex=Lex;
lex->sql_command=SQLCOM_ALTER_DB;
lex->name=
$3.str
;
lex->name=
$3
;
};
ident_or_empty:
/* empty */ { $$= 0; }
| ident { $$= $1.str; };
alter_list:
| DISCARD TABLESPACE { Lex->alter_info.tablespace_op= DISCARD_TABLESPACE; }
| IMPORT TABLESPACE { Lex->alter_info.tablespace_op= IMPORT_TABLESPACE; }
...
...
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