diff options
author | unknown <mikael@c-0409e253.1238-1-64736c10.cust.bredbandsbolaget.se> | 2006-06-12 14:50:46 -0400 |
---|---|---|
committer | unknown <mikael@c-0409e253.1238-1-64736c10.cust.bredbandsbolaget.se> | 2006-06-12 14:50:46 -0400 |
commit | c5d38c170b3df9bfb186d15b6e03ed6586aed6c3 (patch) | |
tree | c8837863a1445b586a3548755f9226781372636b /sql | |
parent | ad193962a774ffaed736adc3a551dd8e10fe3db1 (diff) | |
parent | 3247d60da6b706de3fc5501a7548910ed0e6356c (diff) | |
download | mariadb-git-c5d38c170b3df9bfb186d15b6e03ed6586aed6c3.tar.gz |
Merge c-0409e253.1238-1-64736c10.cust.bredbandsbolaget.se:/home/pappa/bug19695
into c-0409e253.1238-1-64736c10.cust.bredbandsbolaget.se:/home/pappa/bug19305
sql/sql_partition.cc:
Auto merged
Diffstat (limited to 'sql')
-rw-r--r-- | sql/sql_partition.cc | 19 | ||||
-rw-r--r-- | sql/sql_partition.h | 3 | ||||
-rw-r--r-- | sql/sql_show.cc | 5 | ||||
-rw-r--r-- | sql/sql_table.cc | 4 |
4 files changed, 19 insertions, 12 deletions
diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc index a2efae0fbae..2175fb5c3ea 100644 --- a/sql/sql_partition.cc +++ b/sql/sql_partition.cc @@ -1675,6 +1675,7 @@ static int add_partition_options(File fptr, partition_element *p_elem) { int err= 0; + err+= add_space(fptr); if (p_elem->tablespace_name) err+= add_keyword_string(fptr,"TABLESPACE", FALSE, p_elem->tablespace_name); @@ -1702,7 +1703,7 @@ static int add_partition_values(File fptr, partition_info *part_info, if (part_info->part_type == RANGE_PARTITION) { - err+= add_string(fptr, "VALUES LESS THAN "); + err+= add_string(fptr, " VALUES LESS THAN "); if (p_elem->range_value != LONGLONG_MAX) { err+= add_begin_parenthesis(fptr); @@ -1716,7 +1717,7 @@ static int add_partition_values(File fptr, partition_info *part_info, { uint i; List_iterator<longlong> list_val_it(p_elem->list_val_list); - err+= add_string(fptr, "VALUES IN "); + err+= add_string(fptr, " VALUES IN "); uint no_items= p_elem->list_val_list.elements; err+= add_begin_parenthesis(fptr); if (p_elem->has_null_value) @@ -1740,7 +1741,7 @@ static int add_partition_values(File fptr, partition_info *part_info, err+= add_end_parenthesis(fptr); } end: - return err + add_space(fptr); + return err; } /* @@ -1754,6 +1755,7 @@ end: buf_length A pointer to the returned buffer length use_sql_alloc Allocate buffer from sql_alloc if true otherwise use my_malloc + show_partition_options Should we display partition options RETURN VALUES NULL error @@ -1781,7 +1783,8 @@ end: char *generate_partition_syntax(partition_info *part_info, uint *buf_length, - bool use_sql_alloc) + bool use_sql_alloc, + bool show_partition_options) { uint i,j, tot_no_parts, no_subparts, no_parts; partition_element *part_elem; @@ -1882,12 +1885,12 @@ char *generate_partition_syntax(partition_info *part_info, first= FALSE; err+= add_partition(fptr); err+= add_name_string(fptr, part_elem->partition_name); - err+= add_space(fptr); err+= add_partition_values(fptr, part_info, part_elem); if (!part_info->is_sub_partitioned() || part_info->use_default_subpartitions) { - err+= add_partition_options(fptr, part_elem); + if (show_partition_options) + err+= add_partition_options(fptr, part_elem); } else { @@ -1900,8 +1903,8 @@ char *generate_partition_syntax(partition_info *part_info, part_elem= sub_it++; err+= add_subpartition(fptr); err+= add_name_string(fptr, part_elem->partition_name); - err+= add_space(fptr); - err+= add_partition_options(fptr, part_elem); + if (show_partition_options) + err+= add_partition_options(fptr, part_elem); if (j != (no_subparts-1)) { err+= add_comma(fptr); diff --git a/sql/sql_partition.h b/sql/sql_partition.h index 87f9a751ca3..7b07fd2eb53 100644 --- a/sql/sql_partition.h +++ b/sql/sql_partition.h @@ -69,7 +69,8 @@ bool check_partition_info(partition_info *part_info,handlerton **eng_type, bool fix_partition_func(THD *thd, const char *name, TABLE *table, bool create_table_ind); char *generate_partition_syntax(partition_info *part_info, - uint *buf_length, bool use_sql_alloc); + uint *buf_length, bool use_sql_alloc, + bool show_partition_options); bool partition_key_modified(TABLE *table, List<Item> &fields); void get_partition_set(const TABLE *table, byte *buf, const uint index, const key_range *key_spec, diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 83f64e2c9c9..f500e3bf481 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -970,6 +970,7 @@ int store_create_info(THD *thd, TABLE_LIST *table_list, String *packet, handler *file= table->file; TABLE_SHARE *share= table->s; HA_CREATE_INFO create_info; + bool show_table_options= FALSE; bool foreign_db_mode= (thd->variables.sql_mode & (MODE_POSTGRESQL | MODE_ORACLE | MODE_MSSQL | @@ -1195,6 +1196,7 @@ int store_create_info(THD *thd, TABLE_LIST *table_list, String *packet, packet->append(STRING_WITH_LEN("\n)")); if (!(thd->variables.sql_mode & MODE_NO_TABLE_OPTIONS) && !foreign_db_mode) { + show_table_options= TRUE; /* Get possible table space definitions and append them to the CREATE TABLE statement @@ -1335,7 +1337,8 @@ int store_create_info(THD *thd, TABLE_LIST *table_list, String *packet, (!table->part_info->is_auto_partitioned) && ((part_syntax= generate_partition_syntax(table->part_info, &part_syntax_len, - FALSE)))) + FALSE, + show_table_options)))) { packet->append(part_syntax, part_syntax_len); my_free(part_syntax, MYF(0)); diff --git a/sql/sql_table.cc b/sql/sql_table.cc index e9c89b4983d..a49b7a2cc42 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -1233,7 +1233,7 @@ bool mysql_write_frm(ALTER_PARTITION_PARAM_TYPE *lpt, uint flags) { if (!(part_syntax_buf= generate_partition_syntax(part_info, &syntax_len, - TRUE))) + TRUE, TRUE))) { DBUG_RETURN(TRUE); } @@ -3155,7 +3155,7 @@ bool mysql_create_table_internal(THD *thd, */ if (!(part_syntax_buf= generate_partition_syntax(part_info, &syntax_len, - TRUE))) + TRUE, TRUE))) goto err; part_info->part_info_string= part_syntax_buf; part_info->part_info_len= syntax_len; |