| 461 | */ |
| 462 | |
| 463 | static bool create_full_part_field_array(THD *thd, TABLE *table, |
| 464 | partition_info *part_info) |
| 465 | { |
| 466 | bool result= FALSE; |
| 467 | Field **ptr; |
| 468 | my_bitmap_map *bitmap_buf; |
| 469 | DBUG_ENTER("create_full_part_field_array"); |
| 470 | |
| 471 | if (!part_info->is_sub_partitioned()) |
| 472 | { |
| 473 | part_info->full_part_field_array= part_info->part_field_array; |
| 474 | part_info->num_full_part_fields= part_info->num_part_fields; |
| 475 | } |
| 476 | else |
| 477 | { |
| 478 | Field *field, **field_array; |
| 479 | uint num_part_fields=0; |
| 480 | ptr= table->field; |
| 481 | while ((field= *(ptr++))) |
| 482 | { |
| 483 | if (field->flags & FIELD_IN_PART_FUNC_FLAG) |
| 484 | num_part_fields++; |
| 485 | } |
| 486 | field_array= thd->calloc<Field*>(num_part_fields + 1); |
| 487 | if (unlikely(!field_array)) |
| 488 | { |
| 489 | result= TRUE; |
| 490 | goto end; |
| 491 | } |
| 492 | num_part_fields= 0; |
| 493 | ptr= table->field; |
| 494 | while ((field= *(ptr++))) |
| 495 | { |
| 496 | if (field->flags & FIELD_IN_PART_FUNC_FLAG) |
| 497 | field_array[num_part_fields++]= field; |
| 498 | } |
| 499 | field_array[num_part_fields]=0; |
| 500 | part_info->full_part_field_array= field_array; |
| 501 | part_info->num_full_part_fields= num_part_fields; |
| 502 | } |
| 503 | |
| 504 | /* |
| 505 | Initialize the set of all fields used in partition and subpartition |
| 506 | expression. Required for testing of partition fields in write_set |
| 507 | when updating. We need to set all bits in read_set because the row |
| 508 | may need to be inserted in a different [sub]partition. |
| 509 | */ |
| 510 | if (!(bitmap_buf= (my_bitmap_map*) |
| 511 | thd->alloc(bitmap_buffer_size(table->s->fields)))) |
| 512 | { |
| 513 | result= TRUE; |
| 514 | goto end; |
| 515 | } |
| 516 | if (unlikely(my_bitmap_init(&part_info->full_part_field_set, bitmap_buf, |
| 517 | table->s->fields))) |
| 518 | { |
| 519 | result= TRUE; |
| 520 | goto end; |
no test coverage detected