Commit dd126ba1 authored by unknown's avatar unknown

Part of fix for bug #6081 "Call to deprecated mysql_create_db() function

crashes server"

(in 4.0 we fix only connection stalling in case of error, crash itself is
fixed in 4.1, the test case for this code is also there).


sql/sql_parse.cc:
  Handling of COM_CREATE_DB, COM_DROP_DB:
  We should call send_error() if mysql_create_db or mysql_drop_db
  return error (like we do it for SQL versions of these commands).
parent f18efec5
...@@ -1142,7 +1142,9 @@ bool dispatch_command(enum enum_server_command command, THD *thd, ...@@ -1142,7 +1142,9 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
if (check_access(thd,CREATE_ACL,db,0,1)) if (check_access(thd,CREATE_ACL,db,0,1))
break; break;
mysql_log.write(thd,command,packet); mysql_log.write(thd,command,packet);
mysql_create_db(thd,(lower_case_table_names == 2 ? alias : db),0,0); if (mysql_create_db(thd, (lower_case_table_names == 2 ? alias : db),
0, 0) < 0)
send_error(&thd->net, thd->killed ? ER_SERVER_SHUTDOWN : 0);
break; break;
} }
case COM_DROP_DB: // QQ: To be removed case COM_DROP_DB: // QQ: To be removed
...@@ -1163,7 +1165,9 @@ bool dispatch_command(enum enum_server_command command, THD *thd, ...@@ -1163,7 +1165,9 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
break; break;
} }
mysql_log.write(thd,command,db); mysql_log.write(thd,command,db);
mysql_rm_db(thd, (lower_case_table_names == 2 ? alias : db), 0, 0); if (mysql_rm_db(thd, (lower_case_table_names == 2 ? alias : db),
0, 0) < 0)
send_error(&thd->net, thd->killed ? ER_SERVER_SHUTDOWN : 0);
break; break;
} }
case COM_BINLOG_DUMP: case COM_BINLOG_DUMP:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment