Commit cec45b6a authored by unknown's avatar unknown

do not add DROP TABLE and LOCK TABLES to the dump in --xml mode

parent 184ebe59
...@@ -426,7 +426,8 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), ...@@ -426,7 +426,8 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
case 'V': print_version(); exit(0); case 'V': print_version(); exit(0);
case 'X': case 'X':
opt_xml = 1; opt_xml = 1;
opt_disable_keys=0; extended_insert= opt_drop= opt_lock=
opt_disable_keys= opt_autocommit= opt_create_db= 0;
break; break;
case 'I': case 'I':
case '?': case '?':
...@@ -1153,7 +1154,7 @@ static void dumpTable(uint numFields, char *table) ...@@ -1153,7 +1154,7 @@ static void dumpTable(uint numFields, char *table)
safe_exit(EX_CONSCHECK); safe_exit(EX_CONSCHECK);
return; return;
} }
if (extended_insert && !opt_xml) if (extended_insert)
{ {
ulong length = lengths[i]; ulong length = lengths[i];
if (i == 0) if (i == 0)
...@@ -1238,7 +1239,7 @@ static void dumpTable(uint numFields, char *table) ...@@ -1238,7 +1239,7 @@ static void dumpTable(uint numFields, char *table)
if (opt_xml) if (opt_xml)
fprintf(md_result_file, "\t</row>\n"); fprintf(md_result_file, "\t</row>\n");
if (extended_insert && !opt_xml) if (extended_insert)
{ {
ulong row_length; ulong row_length;
dynstr_append(&extended_row,")"); dynstr_append(&extended_row,")");
...@@ -1251,15 +1252,12 @@ static void dumpTable(uint numFields, char *table) ...@@ -1251,15 +1252,12 @@ static void dumpTable(uint numFields, char *table)
} }
else else
{ {
if (row_break && !opt_xml) if (row_break)
fputs(";\n", md_result_file); fputs(";\n", md_result_file);
row_break=1; /* This is first row */ row_break=1; /* This is first row */
if (!opt_xml) fputs(insert_pat,md_result_file);
{ fputs(extended_row.str,md_result_file);
fputs(insert_pat,md_result_file);
fputs(extended_row.str,md_result_file);
}
total_length = row_length+init_length; total_length = row_length+init_length;
} }
} }
...@@ -1394,9 +1392,9 @@ static int init_dumping(char *database) ...@@ -1394,9 +1392,9 @@ static int init_dumping(char *database)
char qbuf[128]; char qbuf[128];
MYSQL_ROW row; MYSQL_ROW row;
MYSQL_RES *dbinfo; MYSQL_RES *dbinfo;
sprintf(qbuf,"SHOW CREATE DATABASE WITH IF NOT EXISTS %s",database); sprintf(qbuf,"SHOW CREATE DATABASE WITH IF NOT EXISTS %s",database);
if (mysql_query(sock, qbuf) || !(dbinfo = mysql_store_result(sock))) if (mysql_query(sock, qbuf) || !(dbinfo = mysql_store_result(sock)))
{ {
/* Old server version, dump generic CREATE DATABASE */ /* Old server version, dump generic CREATE DATABASE */
...@@ -1420,7 +1418,7 @@ static int init_dumping(char *database) ...@@ -1420,7 +1418,7 @@ static int init_dumping(char *database)
(opt_quoted ? "`" : "")); (opt_quoted ? "`" : ""));
} }
} }
if (extended_insert && !opt_xml) if (extended_insert)
if (init_dynamic_string(&extended_row, "", 1024, 1024)) if (init_dynamic_string(&extended_row, "", 1024, 1024))
exit(EX_EOM); exit(EX_EOM);
return 0; return 0;
...@@ -1683,15 +1681,15 @@ MASTER_LOG_POS=%s ;\n",row[0],row[1]); ...@@ -1683,15 +1681,15 @@ MASTER_LOG_POS=%s ;\n",row[0],row[1]);
if (mysql_query(sock, "COMMIT")) if (mysql_query(sock, "COMMIT"))
{ {
my_printf_error(0, "Error: Couldn't execute 'COMMIT': %s", my_printf_error(0, "Error: Couldn't execute 'COMMIT': %s",
MYF(0), mysql_error(sock)); MYF(0), mysql_error(sock));
} }
} }
dbDisconnect(current_host); dbDisconnect(current_host);
write_footer(md_result_file); write_footer(md_result_file);
if (md_result_file != stdout) if (md_result_file != stdout)
my_fclose(md_result_file, MYF(0)); my_fclose(md_result_file, MYF(0));
my_free(opt_password, MYF(MY_ALLOW_ZERO_PTR)); my_free(opt_password, MYF(MY_ALLOW_ZERO_PTR));
if (extended_insert & !opt_xml) if (extended_insert)
dynstr_free(&extended_row); dynstr_free(&extended_row);
my_end(0); my_end(0);
return(first_error); return(first_error);
......
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