MCPcopy Create free account
hub / github.com/MariaDB/server / generate_partition_syntax

Function generate_partition_syntax

sql/sql_partition.cc:2615–2772  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2613*/
2614
2615char *generate_partition_syntax(THD *thd, partition_info *part_info,
2616 uint *buf_length,
2617 bool show_partition_options,
2618 HA_CREATE_INFO *create_info,
2619 Alter_info *alter_info)
2620{
2621 uint i,j, tot_num_parts, num_subparts;
2622 partition_element *part_elem;
2623 int err= 0;
2624 List_iterator<partition_element> part_it(part_info->partitions);
2625 StringBuffer<1024> str;
2626 DBUG_ENTER("generate_partition_syntax");
2627
2628 err+= str.append(STRING_WITH_LEN(" PARTITION BY "));
2629 int err2= part_info->gen_part_type(thd, &str);
2630 if (err2 < 0)
2631 DBUG_RETURN(NULL);
2632 err+= err2;
2633 if (part_info->part_type == VERSIONING_PARTITION)
2634 {
2635 Vers_part_info *vers_info= part_info->vers_info;
2636 DBUG_ASSERT(vers_info);
2637 if (vers_info->interval.is_set())
2638 {
2639 err+= str.append(STRING_WITH_LEN("INTERVAL "));
2640 err+= append_interval(&str, vers_info->interval.type,
2641 vers_info->interval.step);
2642 err+= str.append(STRING_WITH_LEN(" STARTS "));
2643 if (create_info) // not SHOW CREATE
2644 {
2645 err+= str.append_ulonglong(vers_info->interval.start);
2646 }
2647 else
2648 {
2649 MYSQL_TIME ltime;
2650 char ctime[MAX_DATETIME_WIDTH + 1];
2651 thd->variables.time_zone->gmt_sec_to_TIME(&ltime, vers_info->interval.start);
2652 uint ctime_len= my_datetime_to_str(&ltime, ctime, 0);
2653 err+= str.append(STRING_WITH_LEN("TIMESTAMP'"));
2654 err+= str.append(ctime, ctime_len);
2655 err+= str.append('\'');
2656 }
2657 }
2658 else if (vers_info->limit)
2659 {
2660 err+= str.append(STRING_WITH_LEN("LIMIT "));
2661 err+= str.append_ulonglong(vers_info->limit);
2662 }
2663 if (vers_info->auto_hist)
2664 {
2665 DBUG_ASSERT(vers_info->interval.is_set() ||
2666 vers_info->limit);
2667 err+= str.append(STRING_WITH_LEN(" AUTO"));
2668 }
2669 }
2670 else if (part_info->part_expr)
2671 {
2672 err+= str.append('(');

Callers 2

show_create_table_exFunction · 0.85

Calls 15

append_intervalFunction · 0.85
my_datetime_to_strFunction · 0.85
add_part_field_listFunction · 0.85
add_key_with_algorithmFunction · 0.85
add_partition_valuesFunction · 0.85
add_server_part_optionsFunction · 0.85
append_create_optionsFunction · 0.85
gen_part_typeMethod · 0.80
gmt_sec_to_TIMEMethod · 0.80
print_for_table_defMethod · 0.80
is_sub_partitionedMethod · 0.80
strmakeMethod · 0.80

Tested by

no test coverage detected