Commit cebfa22c authored by bar@bar.mysql.r18.ru's avatar bar@bar.mysql.r18.ru

CREATE DATABASE now tries to execute SHOW CREATE DATABASE first

parent a90b923b
...@@ -1247,8 +1247,28 @@ static int init_dumping(char *database) ...@@ -1247,8 +1247,28 @@ static int init_dumping(char *database)
{ {
fprintf(md_result_file,"\n--\n-- Current Database: %s\n--\n", database); fprintf(md_result_file,"\n--\n-- Current Database: %s\n--\n", database);
if (!opt_create_db) if (!opt_create_db)
{
char qbuf[128];
MYSQL_ROW row;
MYSQL_RES *dbinfo;
sprintf(qbuf,"SHOW CREATE DATABASE %s",database);
if (mysql_query(sock, qbuf) || !(dbinfo = mysql_store_result(sock)))
{
/* Old server version, dump generic CREATE DATABASE */
fprintf(md_result_file,"\nCREATE DATABASE /*!32312 IF NOT EXISTS*/ %s;\n", fprintf(md_result_file,"\nCREATE DATABASE /*!32312 IF NOT EXISTS*/ %s;\n",
database); database);
}
else
{
row = mysql_fetch_row(dbinfo);
if (row[1])
{
fprintf(md_result_file,"\n%s;\n",row[1]);
}
}
}
fprintf(md_result_file,"\nUSE %s;\n", database); fprintf(md_result_file,"\nUSE %s;\n", database);
} }
} }
......
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