Commit bd2da82b authored by unknown's avatar unknown
Browse files

Merge


client/mysqldump.c:
  merged changes for bug #9175
parents 382df7a1 d1b9ce83
Loading
Loading
Loading
Loading
+21 −8
Original line number Diff line number Diff line
@@ -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,10 +2243,20 @@ static void get_actual_table_name(const char *old_table_name,
  }

  tableRes= mysql_store_result( sock );
  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;
}


static int dump_selected_tables(char *db, char **table_names, int tables)
@@ -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);

    	dumpTable(numrows, new_table_name);
     }
    my_free(order_by, MYF(MY_ALLOW_ZERO_PTR));
    order_by= 0;
  }