diff -ur mysql-5.1.30/client/client_priv.h mysql-5.1.30-andrew/client/client_priv.h --- mysql-5.1.30/client/client_priv.h 2008-11-14 16:34:15.000000000 +0000 +++ mysql-5.1.30-andrew/client/client_priv.h 2009-01-17 13:00:07.000000000 +0000 @@ -80,5 +80,5 @@ OPT_FIX_TABLE_NAMES, OPT_FIX_DB_NAMES, OPT_SSL_VERIFY_SERVER_CERT, OPT_DEBUG_INFO, OPT_DEBUG_CHECK, OPT_COLUMN_TYPES, OPT_ERROR_LOG_FILE, OPT_WRITE_BINLOG, OPT_DUMP_DATE, - OPT_MAX_CLIENT_OPTION + OPT_MAX_CLIENT_OPTION, OPT_SHOW_PROGRESS_SIZE }; diff -ur mysql-5.1.30/client/mysqldump.c mysql-5.1.30-andrew/client/mysqldump.c --- mysql-5.1.30/client/mysqldump.c 2008-11-14 16:34:16.000000000 +0000 +++ mysql-5.1.30-andrew/client/mysqldump.c 2009-01-20 13:21:20.000000000 +0000 @@ -102,6 +102,7 @@ opt_alltspcs=0, opt_notspcs= 0; static my_bool insert_pat_inited= 0, debug_info_flag= 0, debug_check_flag= 0; static ulong opt_max_allowed_packet, opt_net_buffer_length; +static ulong total_rows= 0, show_progress_size= 0; static MYSQL mysql_connection,*mysql=0; static DYNAMIC_STRING insert_pat; static char *opt_password=0,*current_user=0, @@ -418,6 +419,9 @@ will give bullet-proof binlog position only if server >=4.1.3. That's the old "FLUSH TABLES WITH READ LOCK does not block commit" fixed bug. */ + {"show-progress-size", OPT_SHOW_PROGRESS_SIZE, "Number of rows before each output progress report (requires --verbose).", + (uchar**) &show_progress_size, (uchar**) &show_progress_size, 0, GET_ULONG, REQUIRED_ARG, + 10000, 0, 0, 0, 0, 0}, {"single-transaction", OPT_TRANSACTION, "Creates a consistent snapshot by dumping all tables in a single " "transaction. Works ONLY for tables stored in storage engines which " @@ -476,6 +480,7 @@ static void print_value(FILE *file, MYSQL_RES *result, MYSQL_ROW row, const char *prefix,const char *name, int string_value); +static const char* fetch_named_row(MYSQL_RES *result, MYSQL_ROW row, const char* name); static int dump_selected_tables(char *db, char **table_names, int tables); static int dump_all_tables_in_db(char *db); static int init_dumping_views(char *); @@ -3251,6 +3256,10 @@ uint i; ulong *lengths= mysql_fetch_lengths(res); rownr++; + if ((rownr % show_progress_size) == 0) + { + verbose_msg("-- %d of ~%d rows dumped for table %s\r", rownr, total_rows, opt_quoted_table); + } if (!extended_insert && !opt_xml) { fputs(insert_pat.str,md_result_file); @@ -4507,6 +4516,29 @@ return; /* This shouldn't happen */ } /* print_value */ +/** + * Fetches a row from a result based on a field name + * Returns const char* of the data in that row or NULL if not found + */ + +static const char* fetch_named_row(MYSQL_RES *result, MYSQL_ROW row, const char *name) +{ + MYSQL_FIELD *field; + mysql_field_seek(result, 0); + for ( ; (field= mysql_fetch_field(result)) ; row++) + { + if (!strcmp(field->name,name)) + { + if (row[0] && row[0][0] && strcmp(row[0],"0")) /* Skip default */ + { + mysql_field_seek(result, 0); + return row[0]; + } + } + } + mysql_field_seek(result, 0); + return NULL; +} /* SYNOPSIS @@ -4536,6 +4568,7 @@ { char result= IGNORE_NONE; char buff[FN_REFLEN+80], show_name_buff[FN_REFLEN]; + const char *number_of_rows= NULL; MYSQL_RES *res= NULL; MYSQL_ROW row; DBUG_ENTER("check_if_ignore_table"); @@ -4561,6 +4594,13 @@ mysql_free_result(res); DBUG_RETURN(result); /* assume table is ok */ } + else + { + if ((number_of_rows= fetch_named_row(res, row, "Rows")) != NULL) + { + total_rows= strtoul(number_of_rows, NULL, 10); + } + } if (!(row[1])) strmake(table_type, "VIEW", NAME_LEN-1); else