diff -uN client.orig/client_priv.h client/client_priv.h --- client.orig/client_priv.h 2013-02-05 15:35:02.000000000 -0500 +++ client/client_priv.h 2013-02-13 03:19:35.732031599 -0500 @@ -51,5 +51,5 @@ OPT_TRIGGERS, OPT_IGNORE_TABLE,OPT_INSERT_IGNORE,OPT_SHOW_WARNINGS,OPT_DROP_DATABASE, OPT_TZ_UTC, OPT_AUTO_CLOSE, OPT_SSL_VERIFY_SERVER_CERT, - OPT_DEBUG_INFO, OPT_ERROR_LOG_FILE, OPT_DUMP_DATE,OPT_KEYS_REMOVE + OPT_DEBUG_INFO, OPT_ERROR_LOG_FILE, OPT_DUMP_DATE,OPT_KEYS_REMOVE, OPT_SQL_APPEND, OPT_SQL_PREPEND }; diff -uN client.orig/mysqldump.c client/mysqldump.c --- client.orig/mysqldump.c 2013-02-05 15:35:55.000000000 -0500 +++ client/mysqldump.c 2013-02-13 03:29:22.598079435 -0500 @@ -110,7 +110,7 @@ *where=0, *order_by=0, *opt_compatible_mode_str= 0, *err_ptr= 0, - *log_error_file= NULL; + *log_error_file= NULL, *opt_sql_append=NULL,*opt_sql_prepend=NULL; static char **defaults_argv= 0; static char compatible_mode_normal_str[255]; /* Server supports character_set_results session variable? */ @@ -435,6 +435,14 @@ {"socket", 'S', "Socket file to use for connection.", (gptr*) &opt_mysql_unix_port, (gptr*) &opt_mysql_unix_port, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"sql-append", OPT_SQL_APPEND, + "Append SQL command at the end of dump.", + (gptr*) &opt_sql_append, (gptr*) &opt_sql_append, 0, + GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"sql-prepend", OPT_SQL_PREPEND, + "Append SQL command at the begin of dump.", + (gptr*) &opt_sql_prepend, (gptr*) &opt_sql_prepend, 0, + GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, #include {"tab",'T', "Creates tab separated textfile for each table to given path. (creates .sql and .txt files). NOTE: This only works if mysqldump is run on the same machine as the mysqld daemon.", @@ -617,11 +625,23 @@ compatible_mode_normal_str); check_io(sql_file); } + if(opt_sql_prepend) + { + fprintf(sql_file, "--\n-- sql-prepend instruction\n--\n"); + fprintf(sql_file,"%s\n",opt_sql_prepend); + check_io(sql_file); + } } /* write_header */ static void write_footer(FILE *sql_file) { + if(opt_sql_append) + { + fprintf(sql_file, "--\n-- sql-append instruction\n--\n"); + fprintf(sql_file,"%s\n",opt_sql_append); + check_io(sql_file); + } if (opt_xml) { fputs("\n", sql_file);