summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorVamsikrishna Bhagi <vamsikrishna.bhagi@oracle.com>2012-11-19 21:41:35 +0530
committerVamsikrishna Bhagi <vamsikrishna.bhagi@oracle.com>2012-11-19 21:41:35 +0530
commit2217a9e38b7c458584bb41c88bd99547329a89c2 (patch)
tree3a528c9c14bdfe62aac33ccdc187f20268972996 /client
parent64dcbd6a498e176d80e9315cc8ec965f6bcb9e5a (diff)
downloadmariadb-git-2217a9e38b7c458584bb41c88bd99547329a89c2.tar.gz
Bug#14463669 FAILURE TO CORRECTLY PARSE ROUTINES IN
MYSQLDUMP OUTPUT Problem: mysqldump when used with option --routines, dumps all the routines of the specified database into output. The statements in this output are written in such a way that they are version safe using C style version commenting (of the format /*!<version num> <sql statement>*/). If a semicolon is present right before closing of the comment in dump output, it results in a syntax error while importing. Solution: Version comments for dumped routines are specifically to protect the ones older than 5.0. When the import is done on 5.0 or later versions, entire create statement gets executed as all the check conditions at the beginning of the comments are cleared. Since the trade off is between the performance of newer versions which are more in use and protection of very old versions which are no longer supported, it is proposed that these comments be removed altogether to maintain stability of the versions supported. client/mysqldump.c: Bug#14463669 FAILURE TO CORRECTLY PARSE ROUTINES IN MYSQLDUMP OUTPUT Output of mysqldump is derived by getting the queries from show create and appending version comments to them. query_str is the variable used to store the final string. Since it is no longer required, its declaration and manipulations made on it are deleted. At the step where output is printed, query_str is replaced with the original query string derived from 'show create'.
Diffstat (limited to 'client')
-rw-r--r--client/mysqldump.c17
1 files changed, 2 insertions, 15 deletions
diff --git a/client/mysqldump.c b/client/mysqldump.c
index 765e547004e..65551051953 100644
--- a/client/mysqldump.c
+++ b/client/mysqldump.c
@@ -2240,7 +2240,6 @@ static uint dump_routines_for_db(char *db)
const char *routine_type[]= {"FUNCTION", "PROCEDURE"};
char db_name_buff[NAME_LEN*2+3], name_buff[NAME_LEN*2+3];
char *routine_name;
- char *query_str;
int i;
FILE *sql_file= md_result_file;
MYSQL_RES *routine_res, *routine_list_res;
@@ -2334,17 +2333,6 @@ static uint dump_routines_for_db(char *db)
fprintf(sql_file, "/*!50003 DROP %s IF EXISTS %s */;\n",
routine_type[i], routine_name);
- query_str= cover_definer_clause(row[2], strlen(row[2]),
- C_STRING_WITH_LEN("50020"),
- C_STRING_WITH_LEN("50003"),
- C_STRING_WITH_LEN(" FUNCTION"));
-
- if (!query_str)
- query_str= cover_definer_clause(row[2], strlen(row[2]),
- C_STRING_WITH_LEN("50020"),
- C_STRING_WITH_LEN("50003"),
- C_STRING_WITH_LEN(" PROCEDURE"));
-
if (mysql_num_fields(routine_res) >= 6)
{
if (switch_db_collation(sql_file, db_name_buff, ";",
@@ -2382,9 +2370,9 @@ static uint dump_routines_for_db(char *db)
fprintf(sql_file,
"DELIMITER ;;\n"
- "/*!50003 %s */;;\n"
+ "%s ;;\n"
"DELIMITER ;\n",
- (const char *) (query_str != NULL ? query_str : row[2]));
+ (const char *) row[2]);
restore_sql_mode(sql_file, ";");
@@ -2399,7 +2387,6 @@ static uint dump_routines_for_db(char *db)
}
}
- my_free(query_str);
}
} /* end of routine printing */
mysql_free_result(routine_res);