| 9273 | } |
| 9274 | |
| 9275 | int THD::binlog_delete_row(TABLE* table, bool is_trans, |
| 9276 | uchar const *record, |
| 9277 | const uchar* extra_row_info) |
| 9278 | { |
| 9279 | DBUG_ASSERT(is_current_stmt_binlog_format_row() && mysql_bin_log.is_open()); |
| 9280 | int error= 0; |
| 9281 | |
| 9282 | /** |
| 9283 | Save a reference to the original read and write set bitmaps. |
| 9284 | We will need this to restore the bitmaps at the end. |
| 9285 | */ |
| 9286 | MY_BITMAP *old_read_set= table->read_set; |
| 9287 | MY_BITMAP *old_write_set= table->write_set; |
| 9288 | |
| 9289 | /** |
| 9290 | This will remove spurious fields required during execution but |
| 9291 | not needed for binlogging. This is done according to the: |
| 9292 | binlog-row-image option. |
| 9293 | */ |
| 9294 | binlog_prepare_row_images(table); |
| 9295 | |
| 9296 | /* |
| 9297 | Pack records into format for transfer. We are allocating more |
| 9298 | memory than needed, but that doesn't matter. |
| 9299 | */ |
| 9300 | Row_data_memory memory(table, max_row_length(table, record)); |
| 9301 | if (unlikely(!memory.has_memory())) |
| 9302 | return HA_ERR_OUT_OF_MEM; |
| 9303 | |
| 9304 | uchar *row_data= memory.slot(0); |
| 9305 | |
| 9306 | DBUG_DUMP("table->read_set", (uchar*) table->read_set->bitmap, (table->s->fields + 7) / 8); |
| 9307 | size_t const len= pack_row(table, table->read_set, row_data, record); |
| 9308 | |
| 9309 | Rows_log_event* const ev= |
| 9310 | binlog_prepare_pending_rows_event(table, server_id, len, is_trans, |
| 9311 | static_cast<Delete_rows_log_event*>(0), |
| 9312 | extra_row_info); |
| 9313 | |
| 9314 | if (unlikely(ev == 0)) |
| 9315 | return HA_ERR_OUT_OF_MEM; |
| 9316 | |
| 9317 | error= ev->add_row_data(row_data, len); |
| 9318 | |
| 9319 | /* restore read/write set for the rest of execution */ |
| 9320 | table->column_bitmaps_set_no_signal(old_read_set, |
| 9321 | old_write_set); |
| 9322 | |
| 9323 | return error; |
| 9324 | } |
| 9325 | |
| 9326 | void THD::binlog_prepare_row_images(TABLE *table) |
| 9327 | { |
nothing calls this directly
no outgoing calls
no test coverage detected