@@ -3198,10 +3198,10 @@ static void get_sequence_structure(const char *seq, const char *db)
31983198 ignore_flag - what we must particularly ignore - see IGNORE_ defines above
31993199
32003200 RETURN
3201- number of fields in table, 0 if error
3201+ number of fields to dump, -1 if error
32023202*/
32033203
3204- static uint get_table_structure (const char *table, const char *db, char *table_type,
3204+ static int get_table_structure (const char *table, const char *db, char *table_type,
32053205 char *ignore_flag, my_bool *versioned)
32063206{
32073207 my_bool init=0 , delayed, write_data, complete_insert;
@@ -3228,7 +3228,7 @@ static uint get_table_structure(const char *table, const char *db, char *table_t
32283228 *ignore_flag= check_if_ignore_table (table, table_type);
32293229
32303230 if (!opt_copy_s3_tables && *ignore_flag == IGNORE_S3_TABLE )
3231- DBUG_RETURN (0 );
3231+ DBUG_RETURN (- 1 );
32323232
32333233 delayed= opt_delayed;
32343234 if (delayed && (*ignore_flag & IGNORE_INSERT_DELAYED ))
@@ -3328,7 +3328,7 @@ static uint get_table_structure(const char *table, const char *db, char *table_t
33283328 {
33293329 my_free (order_by);
33303330 order_by= 0 ;
3331- DBUG_RETURN (0 );
3331+ DBUG_RETURN (- 1 );
33323332 }
33333333
33343334 if (multi_file_output)
@@ -3337,7 +3337,7 @@ static uint get_table_structure(const char *table, const char *db, char *table_t
33373337 {
33383338 my_free (order_by);
33393339 order_by= 0 ;
3340- DBUG_RETURN (0 );
3340+ DBUG_RETURN (- 1 );
33413341 }
33423342 write_header (sql_file, db);
33433343 }
@@ -3408,7 +3408,7 @@ static uint get_table_structure(const char *table, const char *db, char *table_t
34083408
34093409 if (multi_file_output)
34103410 my_fclose (sql_file, MYF (MY_WME ));
3411- DBUG_RETURN (0 );
3411+ DBUG_RETURN (- 1 );
34123412 }
34133413 else
34143414 my_free (scv_buff);
@@ -3469,7 +3469,7 @@ static uint get_table_structure(const char *table, const char *db, char *table_t
34693469 my_fclose (sql_file, MYF (MY_WME ));
34703470
34713471 seen_views= 1 ;
3472- DBUG_RETURN (0 );
3472+ DBUG_RETURN (- 1 );
34733473 }
34743474
34753475 row= mysql_fetch_row (result);
@@ -3519,7 +3519,7 @@ static uint get_table_structure(const char *table, const char *db, char *table_t
35193519 {
35203520 if (multi_file_output)
35213521 my_fclose (sql_file, MYF (MY_WME ));
3522- DBUG_RETURN (0 );
3522+ DBUG_RETURN (- 1 );
35233523 }
35243524
35253525 while ((row= mysql_fetch_row (result)))
@@ -3662,7 +3662,7 @@ static uint get_table_structure(const char *table, const char *db, char *table_t
36623662 quote_for_equal (table, temp_buff2));
36633663
36643664 if (mysql_query_with_error_report (mysql, &result, query_buff))
3665- DBUG_RETURN (0 );
3665+ DBUG_RETURN (- 1 );
36663666
36673667 /* Make an sql-file, if path was given iow. option -T was given */
36683668 if (!opt_no_create_info)
@@ -3672,7 +3672,7 @@ static uint get_table_structure(const char *table, const char *db, char *table_t
36723672 if (!(sql_file= open_sql_file_for_table (db, table, O_WRONLY )))
36733673 {
36743674 mysql_free_result (result);
3675- DBUG_RETURN (0 );
3675+ DBUG_RETURN (- 1 );
36763676 }
36773677 write_header (sql_file, db);
36783678 }
@@ -3782,7 +3782,7 @@ static uint get_table_structure(const char *table, const char *db, char *table_t
37823782 my_progname_short, result_table, mysql_error (mysql));
37833783 if (multi_file_output)
37843784 my_fclose (sql_file, MYF (MY_WME ));
3785- DBUG_RETURN (0 );
3785+ DBUG_RETURN (- 1 );
37863786 }
37873787
37883788 /* Find first which key is primary key */
@@ -4297,8 +4297,8 @@ static void dump_table(const char *table, const char *db, const uchar *hash_key,
42974297 char table_type[NAME_LEN ];
42984298 char *result_table, table_buff2[NAME_LEN *2 +3 ], *opt_quoted_table;
42994299 int error= 0 ;
4300- ulong rownr, row_break;
4301- uint num_fields;
4300+ ulong rownr, row_break;
4301+ int num_fields;
43024302 size_t total_length, init_length;
43034303 my_bool versioned= 0 ;
43044304 MYSQL_RES *res= NULL ;
@@ -4311,6 +4311,10 @@ static void dump_table(const char *table, const char *db, const uchar *hash_key,
43114311 --no-data flag below. Otherwise, the create table info won't be printed.
43124312 */
43134313 num_fields= get_table_structure (table, db, table_type, &ignore_flag, &versioned);
4314+
4315+ if (num_fields < 0 )
4316+ DBUG_VOID_RETURN ;
4317+
43144318 /*
43154319 The "table" could be a view. If so, we don't do anything here.
43164320 */
@@ -4518,7 +4522,7 @@ static void dump_table(const char *table, const char *db, const uchar *hash_key,
45184522 }
45194523
45204524 verbose_msg (" -- Retrieving rows...\n " );
4521- if (num_fields && mysql_num_fields (res) != num_fields)
4525+ if (num_fields && mysql_num_fields (res) != (uint) num_fields)
45224526 {
45234527 fprintf (stderr," %s: Error in field count for table: %s ! Aborting.\n " ,
45244528 my_progname_short, result_table);
@@ -4579,7 +4583,7 @@ static void dump_table(const char *table, const char *db, const uchar *hash_key,
45794583 else if (extended_insert)
45804584 dynstr_set_checked (&extended_row," (" );
45814585
4582- for (i= 0 ; i < num_fields; i++)
4586+ for (i= 0 ; i < (uint) num_fields; i++)
45834587 {
45844588 int is_blob;
45854589 ulong length= lengths[i];
@@ -5758,12 +5762,12 @@ static void dump_first_mysql_tables(char *database)
57585762 char ignore_flag;
57595763 DBUG_ENTER (" dump_first_mysql_tables" );
57605764
5761- if (! get_table_structure (( char *) " general_log" ,
5762- database, table_type, &ignore_flag, NULL ) )
5765+ if (get_table_structure (" general_log" ,
5766+ database, table_type, &ignore_flag, NULL ) <= 0 )
57635767 verbose_msg (" -- Warning: get_table_structure() failed with some internal "
57645768 " error for 'general_log' table\n " );
5765- if (! get_table_structure (( char *) " slow_log" ,
5766- database, table_type, &ignore_flag, NULL ) )
5769+ if (get_table_structure (" slow_log" ,
5770+ database, table_type, &ignore_flag, NULL ) <= 0 )
57675771 verbose_msg (" -- Warning: get_table_structure() failed with some internal "
57685772 " error for 'slow_log' table\n " );
57695773 /* general and slow query logs exist now */
@@ -6025,8 +6029,8 @@ static int dump_all_tables_in_db(char *database)
60256029 {
60266030 char table_type[NAME_LEN ];
60276031 char ignore_flag;
6028- if (! get_table_structure (( char *) " transaction_registry" ,
6029- database, table_type, &ignore_flag, NULL ) )
6032+ if (get_table_structure (" transaction_registry" ,
6033+ database, table_type, &ignore_flag, NULL ) <= 0 )
60306034 verbose_msg (" -- Warning: get_table_structure() failed with some internal "
60316035 " error for 'transaction_registry' table\n " );
60326036 }
0 commit comments