summaryrefslogtreecommitdiff
path: root/sql/sql_db.cc
diff options
context:
space:
mode:
authorRobert Bindar <robert@mariadb.org>2019-05-14 17:19:43 +0300
committerRobert Bindar <robert@mariadb.org>2019-05-21 09:33:30 +0300
commit042f5165e31aec6f15216bd4e8a6450477e1a1b9 (patch)
tree6b247f7820a6cb334d848737b432ceb2ba7d7ea4 /sql/sql_db.cc
parente9c6d5a1e862c8fe26adf6fcd9b40386edd8404a (diff)
downloadmariadb-git-042f5165e31aec6f15216bd4e8a6450477e1a1b9.tar.gz
MDEV-307 review minor edits, add yacc_ora support
Diffstat (limited to 'sql/sql_db.cc')
-rw-r--r--sql/sql_db.cc18
1 files changed, 11 insertions, 7 deletions
diff --git a/sql/sql_db.cc b/sql/sql_db.cc
index 3b74e3735c9..67cf89aef70 100644
--- a/sql/sql_db.cc
+++ b/sql/sql_db.cc
@@ -252,7 +252,7 @@ static my_bool get_dbopt(THD *thd, const char *dbname,
create->default_table_charset= opt->charset;
if (opt->comment.length)
{
- create->schema_comment= thd->make_clex_string(const_cast<char*>(opt->comment.str),
+ create->schema_comment= thd->make_clex_string(opt->comment.str,
opt->comment.length);
}
error= 0;
@@ -344,7 +344,8 @@ static void del_dbopt(const char *path)
Create database options file:
DESCRIPTION
- Currently database default charset, default collation and comment are stored there.
+ Currently database default charset, default collation
+ and comment are stored there.
RETURN VALUES
0 ok
@@ -361,16 +362,19 @@ static bool write_db_opt(THD *thd, const char *path,
if (create->schema_comment)
{
if (validate_comment_length(thd, create->schema_comment,
- DATABASE_COMMENT_MAXLEN, ER_TOO_LONG_DATABASE_COMMENT,
+ DATABASE_COMMENT_MAXLEN,
+ ER_TOO_LONG_DATABASE_COMMENT,
thd->lex->name.str))
return error;
}
- /* Use existing values of schema_comment and charset for ALTER DATABASE queries */
- Schema_specification_st tmp;
- bzero((char*) &tmp,sizeof(tmp));
- if (thd->lex->sql_command == SQLCOM_ALTER_DB)
+ if (thd->lex->sql_command == SQLCOM_ALTER_DB &&
+ (!create->schema_comment || !create->default_table_charset))
{
+ /* Use existing values of schema_comment and charset for
+ ALTER DATABASE queries */
+ Schema_specification_st tmp;
+ tmp.init();
load_db_opt(thd, path, &tmp);
if (!create->schema_comment)