diff options
author | unknown <tnurnberg@mysql.com> | 2006-05-31 13:36:28 +0200 |
---|---|---|
committer | unknown <tnurnberg@mysql.com> | 2006-05-31 13:36:28 +0200 |
commit | c69ba2559bd1b866895186d7e41d0a1e17e25714 (patch) | |
tree | fa70a8b7e428338d25cc0677bf0be4d778caed8a /client | |
parent | 967c9739be6404941d9c0c03d7569e424fa27eab (diff) | |
download | mariadb-git-c69ba2559bd1b866895186d7e41d0a1e17e25714.tar.gz |
Bug#18462: mysqldump does not dump view structures correctly
(The above problem only occurs with -T -- create a separate file for
each table / view.) This ChangeSet results in correct output of view-
information while omitting the information for the view's stand-in
table. The rationale is that with -T, the user is likely interested
in transferring part of a database, not the db in its entirety (that
would be difficult as replay order is obscure, the files being named
for the table/view they contain rather than getting a sequence number).
client/mysqldump.c:
Added missing fclose(). Before, a view's stand-in table would get
dumped in get_table_structure(), and the file would remain open.
get_view_structure() would re-open the same file and write to it,
resulting in garbage. The way we handle it now, the table-struct
gets closed, then the opening of the view-struct (same name)
overwrites it. (The SQL for the view drop-if-exists the table,
anyway.) If this were not desired and we wanted SQL for the views
that contains the create for the stand-in table, we'd hand a mode
to open_sql_file_for_table(), which would feature O_APPEND in
get_view_structure(), but not in get_table_structure().
mysql-test/r/mysqldump.result:
prove mysqldump -T (each item gets its own file) dumps views correctly
mysql-test/t/mysqldump.test:
prove mysqldump -T (each item gets its own file) dumps views correctly
Diffstat (limited to 'client')
-rw-r--r-- | client/mysqldump.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/client/mysqldump.c b/client/mysqldump.c index ee6d7b9d12b..bc41ebb486f 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -1554,6 +1554,9 @@ static uint get_table_structure(char *table, char *db, char *table_type, } mysql_free_result(result); + if (path) + my_fclose(sql_file, MYF(MY_WME)); + was_views= 1; DBUG_RETURN(0); } |