diff options
author | Michael Widenius <monty@askmonty.org> | 2012-06-27 17:22:23 +0300 |
---|---|---|
committer | Michael Widenius <monty@askmonty.org> | 2012-06-27 17:22:23 +0300 |
commit | aa67a198e8a29f2fdae84846cc1d8e74c2d47a83 (patch) | |
tree | 47719240f2509a3fa373f54852b54d552ac6e844 /client | |
parent | 9ebda8764d2e94096924c0a0181f5773d836114a (diff) | |
parent | 072097174c8b91299fe74a3cd7c5248e6e3cfc57 (diff) | |
download | mariadb-git-aa67a198e8a29f2fdae84846cc1d8e74c2d47a83.tar.gz |
automatic merge with 5.5
Diffstat (limited to 'client')
-rw-r--r-- | client/mysql.cc | 2 | ||||
-rw-r--r-- | client/mysqldump.c | 60 | ||||
-rw-r--r-- | client/mysqltest.cc | 11 |
3 files changed, 59 insertions, 14 deletions
diff --git a/client/mysql.cc b/client/mysql.cc index e74495dcf8d..d39e765a99a 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -2916,7 +2916,7 @@ com_help(String *buffer __attribute__((unused)), } put_info("\nGeneral information about MariaDB can be found at\n" - "http://askmonty.org/wiki/index.php/Manual:Contents\n", INFO_INFO); + "http://mariadb.org\n", INFO_INFO); put_info("List of all MySQL commands:", INFO_INFO); if (!named_cmds) put_info("Note that all text commands must be first on line and end with ';'",INFO_INFO); diff --git a/client/mysqldump.c b/client/mysqldump.c index 94327aee0c0..f91c480bc80 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -86,6 +86,15 @@ /* Chars needed to store LONGLONG, excluding trailing '\0'. */ #define LONGLONG_LEN 20 +/* general_log or slow_log tables under mysql database */ +static inline my_bool general_log_or_slow_log_tables(const char *db, + const char *table) +{ + return (strcmp(db, "mysql") == 0) && + ((strcmp(table, "general_log") == 0) || + (strcmp(table, "slow_log") == 0)); +} + static void add_load_option(DYNAMIC_STRING *str, const char *option, const char *option_value); static ulong find_set(TYPELIB *lib, const char *x, uint length, @@ -2503,6 +2512,7 @@ static uint get_table_structure(char *table, char *db, char *table_type, "TABLE_SCHEMA = '%s' AND TABLE_NAME = '%s'"; FILE *sql_file= md_result_file; int len; + my_bool is_log_table; MYSQL_RES *result; MYSQL_ROW row; DBUG_ENTER("get_table_structure"); @@ -2587,9 +2597,12 @@ static uint get_table_structure(char *table, char *db, char *table_type, /* Even if the "table" is a view, we do a DROP TABLE here. The view-specific code below fills in the DROP VIEW. + We will skip the DROP TABLE for general_log and slow_log, since + those stmts will fail, in case we apply dump by enabling logging. */ - fprintf(sql_file, "DROP TABLE IF EXISTS %s;\n", - opt_quoted_table); + if (!general_log_or_slow_log_tables(db, table)) + fprintf(sql_file, "DROP TABLE IF EXISTS %s;\n", + opt_quoted_table); check_io(sql_file); } @@ -2701,12 +2714,25 @@ static uint get_table_structure(char *table, char *db, char *table_type, row= mysql_fetch_row(result); - fprintf(sql_file, (opt_compatible_mode & 3) ? "%s;\n" : - "/*!40101 SET @saved_cs_client = @@character_set_client */;\n" - "/*!40101 SET character_set_client = utf8 */;\n" - "%s;\n" - "/*!40101 SET character_set_client = @saved_cs_client */;\n", - row[1]); + is_log_table= general_log_or_slow_log_tables(db, table); + if (is_log_table) + row[1]+= 13; /* strlen("CREATE TABLE ")= 13 */ + if (opt_compatible_mode & 3) + { + fprintf(sql_file, + is_log_table ? "CREATE TABLE IF NOT EXISTS %s;\n" : "%s;\n", + row[1]); + } + else + { + fprintf(sql_file, + "/*!40101 SET @saved_cs_client = @@character_set_client */;\n" + "/*!40101 SET character_set_client = utf8 */;\n" + "%s%s;\n" + "/*!40101 SET character_set_client = @saved_cs_client */;\n", + is_log_table ? "CREATE TABLE IF NOT EXISTS " : "", + row[1]); + } check_io(sql_file); mysql_free_result(result); @@ -4315,6 +4341,22 @@ static int dump_all_tables_in_db(char *database) if (opt_xml) print_xml_tag(md_result_file, "", "\n", "database", "name=", database, NullS); + if (strcmp(database, "mysql") == 0) + { + char table_type[NAME_LEN]; + char ignore_flag; + uint num_fields; + num_fields= get_table_structure((char *) "general_log", + database, table_type, &ignore_flag); + if (num_fields == 0) + verbose_msg("-- Warning: get_table_structure() failed with some internal " + "error for 'general_log' table\n"); + num_fields= get_table_structure((char *) "slow_log", + database, table_type, &ignore_flag); + if (num_fields == 0) + verbose_msg("-- Warning: get_table_structure() failed with some internal " + "error for 'slow_log' table\n"); + } if (lock_tables) { DYNAMIC_STRING query; @@ -4775,7 +4817,7 @@ static int do_show_slave_status(MYSQL *mysql_con) if (row[1]) fprintf(md_result_file, "MASTER_HOST='%s', ", row[1]); if (row[3]) - fprintf(md_result_file, "MASTER_PORT='%s', ", row[3]); + fprintf(md_result_file, "MASTER_PORT=%s, ", row[3]); } fprintf(md_result_file, "MASTER_LOG_FILE='%s', MASTER_LOG_POS=%s;\n", row[9], row[21]); diff --git a/client/mysqltest.cc b/client/mysqltest.cc index b93c9426deb..01613223d64 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -9012,8 +9012,12 @@ int main(int argc, char **argv) command->abort_on_error= (command->expected_errors.count == 0 && abort_on_error); - /* delimiter needs to be executed so we can continue to parse */ - ok_to_do= cur_block->ok || command->type == Q_DELIMITER; + /* + some commmands need to be executed or at least parsed unconditionally, + because they change the grammar. + */ + ok_to_do= cur_block->ok || command->type == Q_DELIMITER + || command->type == Q_PERL; /* Some commands need to be "done" the first time if they may get re-iterated over in a true context. This can only happen if there's @@ -9024,8 +9028,7 @@ int main(int argc, char **argv) if (command->type == Q_SOURCE || command->type == Q_ERROR || command->type == Q_WRITE_FILE || - command->type == Q_APPEND_FILE || - command->type == Q_PERL) + command->type == Q_APPEND_FILE) { for (struct st_block *stb= cur_block-1; stb >= block_stack; stb--) { |