| 5348 | */ |
| 5349 | |
| 5350 | bool binlog_create_table(THD *thd, TABLE *table, bool replace) |
| 5351 | { |
| 5352 | Table_specification_st create_info; |
| 5353 | bool result; |
| 5354 | ulonglong save_option_bits; |
| 5355 | |
| 5356 | /* Don't log temporary tables in row or mixed format */ |
| 5357 | if (table->s->tmp_table && !thd->binlog_create_tmp_table()) |
| 5358 | return 0; |
| 5359 | if (!thd->binlog_table_should_be_logged(&table->s->db)) |
| 5360 | return 0; |
| 5361 | |
| 5362 | /* |
| 5363 | We have to use ROW format to ensure that future row inserts will be |
| 5364 | logged. For temporary tables this means the table will not be binlogged |
| 5365 | anymore. |
| 5366 | */ |
| 5367 | thd->set_current_stmt_binlog_format_row(); |
| 5368 | table->file->prepare_for_row_logging(); |
| 5369 | |
| 5370 | create_info.lex_start(); |
| 5371 | save_option_bits= thd->variables.option_bits; |
| 5372 | if (replace) |
| 5373 | create_info.set(DDL_options_st::OPT_OR_REPLACE); |
| 5374 | /* Ensure we write ENGINE=xxx and CHARSET=... to binary log */ |
| 5375 | create_info.used_fields|= (HA_CREATE_USED_ENGINE | |
| 5376 | HA_CREATE_USED_DEFAULT_CHARSET); |
| 5377 | /* Ensure we write all engine options to binary log */ |
| 5378 | create_info.used_fields|= HA_CREATE_PRINT_ALL_OPTIONS; |
| 5379 | result= binlog_show_create_table(thd, table, &create_info) != 0; |
| 5380 | thd->variables.option_bits= save_option_bits; |
| 5381 | return result; |
| 5382 | } |
| 5383 | |
| 5384 | |
| 5385 | /** |
no test coverage detected