--- mysql-5.1.33/client/mysqldump.c 2009-03-13 22:48:44.000000000 +0100 +++ ../mysql-5.1.33/client/mysqldump.c 2009-06-02 17:40:51.000000000 +0200 @@ -85,7 +85,7 @@ static void field_escape(DYNAMIC_STRING* in, const char *from); static my_bool verbose= 0, opt_no_create_info= 0, opt_no_data= 0, - quick= 1, extended_insert= 1, + quick= 1, extended_insert= 1, simple_views = 0, lock_tables=1,ignore_errors=0,flush_logs=0,flush_privileges=0, opt_drop=1,opt_keywords=0,opt_lock=1,opt_compress=0, opt_delayed=0,create_options=1,opt_quoted=0,opt_databases=0, @@ -413,6 +413,10 @@ "Base name of shared memory.", (uchar**) &shared_memory_base_name, (uchar**) &shared_memory_base_name, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, #endif + {"simple-views", 's', + "Dump views as views directly. Will break views on views", + (uchar**) &simple_views, (uchar**) &simple_views, 0, GET_BOOL, NO_ARG, + 0, 0, 0, 0, 0, 0}, /* Note that the combination --single-transaction --master-data will give bullet-proof binlog position only if server >=4.1.3. That's the @@ -2313,9 +2317,8 @@ opt_quoted_table); check_io(sql_file); } - field= mysql_fetch_field_direct(result, 0); - if (strcmp(field->name, "View") == 0) + if (strcmp(field->name, "View") == 0 && !simple_views) { char *scv_buff= NULL; @@ -2419,6 +2422,14 @@ seen_views= 1; DBUG_RETURN(0); } + else if (strcmp(field->name, "View") == 0) + { + mysql_free_result(result); + if (path) + my_fclose(sql_file, MYF(MY_WME)); + seen_views=1; + DBUG_RETURN(0); + } row= mysql_fetch_row(result);