summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
Diffstat (limited to 'client')
-rw-r--r--client/mysqldump.c25
1 files changed, 20 insertions, 5 deletions
diff --git a/client/mysqldump.c b/client/mysqldump.c
index 0f30ebddacc..b77549df781 100644
--- a/client/mysqldump.c
+++ b/client/mysqldump.c
@@ -3726,11 +3726,12 @@ static int dump_all_tables_in_db(char *database)
{
DYNAMIC_STRING query;
init_dynamic_string_checked(&query, "LOCK TABLES ", 256, 1024);
- for (numrows= 0 ; (table= getTableName(1)) ; numrows++)
+ for (numrows= 0 ; (table= getTableName(1)) ; )
{
char *end= strmov(afterdot, table);
if (include_table(hash_key,end - hash_key))
{
+ numrows++;
dynstr_append_checked(&query, quote_name(table, table_buff, 1));
dynstr_append_checked(&query, " READ /*!32311 LOCAL */,");
}
@@ -3804,6 +3805,11 @@ static my_bool dump_all_views_in_db(char *database)
char *table;
uint numrows;
char table_buff[NAME_LEN*2+3];
+ char hash_key[2*NAME_LEN+2]; /* "db.tablename" */
+ char *afterdot;
+
+ afterdot= strmov(hash_key, database);
+ *afterdot++= '.';
if (init_dumping(database, init_dumping_views))
return 1;
@@ -3813,10 +3819,15 @@ static my_bool dump_all_views_in_db(char *database)
{
DYNAMIC_STRING query;
init_dynamic_string_checked(&query, "LOCK TABLES ", 256, 1024);
- for (numrows= 0 ; (table= getTableName(1)); numrows++)
+ for (numrows= 0 ; (table= getTableName(1)); )
{
- dynstr_append_checked(&query, quote_name(table, table_buff, 1));
- dynstr_append_checked(&query, " READ /*!32311 LOCAL */,");
+ char *end= strmov(afterdot, table);
+ if (include_table(hash_key,end - hash_key))
+ {
+ numrows++;
+ dynstr_append_checked(&query, quote_name(table, table_buff, 1));
+ dynstr_append_checked(&query, " READ /*!32311 LOCAL */,");
+ }
}
if (numrows && mysql_real_query(mysql, query.str, query.length-1))
DB_error(mysql, "when using LOCK TABLES");
@@ -3830,7 +3841,11 @@ static my_bool dump_all_views_in_db(char *database)
/* We shall continue here, if --force was given */
}
while ((table= getTableName(0)))
- get_view_structure(table, database);
+ {
+ char *end= strmov(afterdot, table);
+ if (include_table(hash_key, end - hash_key))
+ get_view_structure(table, database);
+ }
if (opt_xml)
{
fputs("</database>\n", md_result_file);