summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--client/mysqldump.c29
1 files changed, 21 insertions, 8 deletions
diff --git a/client/mysqldump.c b/client/mysqldump.c
index 867aa86c1fc..2017f923c2f 100644
--- a/client/mysqldump.c
+++ b/client/mysqldump.c
@@ -2218,13 +2218,14 @@ static my_bool dump_all_views_in_db(char *database)
different case (e.g. T1 vs t1)
RETURN
- void
+ int - 0 if a tablename was retrieved. 1 if not
*/
-static void get_actual_table_name(const char *old_table_name,
+static int get_actual_table_name(const char *old_table_name,
char *new_table_name,
int buf_size)
{
+ int retval;
MYSQL_RES *tableRes;
MYSQL_ROW row;
char query[50 + 2*NAME_LEN];
@@ -2242,9 +2243,19 @@ static void get_actual_table_name(const char *old_table_name,
}
tableRes= mysql_store_result( sock );
- row= mysql_fetch_row( tableRes );
- strmake(new_table_name, row[0], buf_size-1);
- mysql_free_result(tableRes);
+ retval = 1;
+ if (tableRes != NULL)
+ {
+ my_ulonglong numRows = mysql_num_rows(tableRes);
+ if (numRows > 0)
+ {
+ row= mysql_fetch_row( tableRes );
+ strmake(new_table_name, row[0], buf_size-1);
+ retval = 0;
+ }
+ mysql_free_result(tableRes);
+ }
+ return retval;
}
@@ -2284,11 +2295,13 @@ static int dump_selected_tables(char *db, char **table_names, int tables)
char new_table_name[NAME_LEN];
/* the table name passed on commandline may be wrong case */
- get_actual_table_name( table_names[i], new_table_name, sizeof(new_table_name) );
+ if (!get_actual_table_name( table_names[i], new_table_name, sizeof(new_table_name) ))
+ {
- numrows = getTableStructure(new_table_name, db);
+ numrows = getTableStructure(new_table_name, db);
- dumpTable(numrows, new_table_name);
+ dumpTable(numrows, new_table_name);
+ }
my_free(order_by, MYF(MY_ALLOW_ZERO_PTR));
order_by= 0;
}