summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <mikael@c-870ae253.1238-1-64736c10.cust.bredbandsbolaget.se>2006-05-27 17:36:45 -0400
committerunknown <mikael@c-870ae253.1238-1-64736c10.cust.bredbandsbolaget.se>2006-05-27 17:36:45 -0400
commita3170bf6b3dbabcc0c8063b24c2d20ba66ec2125 (patch)
tree6221d81e5f70b214e0363956b96d586ab54cc34e /sql
parent19b401247e15d54c18c472e00127f43d5a092898 (diff)
downloadmariadb-git-a3170bf6b3dbabcc0c8063b24c2d20ba66ec2125.tar.gz
BUG#19695: Showed partition options when table options were not shown
mysql-test/r/ndb_partition_key.result: Manicural changes removed a space from a double-space mysql-test/r/partition.result: Manicural changes removed a space from a double-space Added new test case mysql-test/r/partition_02myisam.result: Manicural changes removed a space from a double-space mysql-test/r/partition_range.result: Manicural changes removed a space from a double-space mysql-test/t/partition.test: New test case sql/sql_partition.cc: Removed unnecessary extra spaces Added show_partition_options set in the same way as when to show table options in SHOW CREATE TABLE sql/sql_partition.h: Removed unnecessary extra spaces Added show_partition_options set in the same way as when to show table options in SHOW CREATE TABLE sql/sql_show.cc: Removed unnecessary extra spaces Added show_partition_options set in the same way as when to show table options in SHOW CREATE TABLE sql/sql_table.cc: Removed unnecessary extra spaces Added show_partition_options set in the same way as when to show table options in SHOW CREATE TABLE
Diffstat (limited to 'sql')
-rw-r--r--sql/sql_partition.cc18
-rw-r--r--sql/sql_partition.h2
-rw-r--r--sql/sql_show.cc5
-rw-r--r--sql/sql_table.cc4
4 files changed, 17 insertions, 12 deletions
diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc
index 71b8e9b1d95..f4aa1736c40 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;
}
/*
@@ -1755,6 +1756,7 @@ end:
use_sql_alloc Allocate buffer from sql_alloc if true
otherwise use my_malloc
write_all Write everything, also default values
+ show_partition_options Should we display partition options
RETURN VALUES
NULL error
@@ -1783,7 +1785,8 @@ end:
char *generate_partition_syntax(partition_info *part_info,
uint *buf_length,
bool use_sql_alloc,
- bool write_all)
+ bool write_all,
+ bool show_partition_options)
{
uint i,j, tot_no_parts, no_subparts, no_parts;
partition_element *part_elem;
@@ -1882,9 +1885,8 @@ 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())
+ if (!part_info->is_sub_partitioned() && show_partition_options)
err+= add_partition_options(fptr, part_elem);
if (part_info->is_sub_partitioned() &&
(write_all || (!part_info->use_default_subpartitions)))
@@ -1898,8 +1900,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 fd2c474236f..deb58c5ca28 100644
--- a/sql/sql_partition.h
+++ b/sql/sql_partition.h
@@ -70,7 +70,7 @@ 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,
- bool write_all);
+ bool write_all, 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 5e4324d0003..951d11afa50 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -932,6 +932,7 @@ 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 |
@@ -1149,6 +1150,7 @@ 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
@@ -1288,7 +1290,8 @@ store_create_info(THD *thd, TABLE_LIST *table_list, String *packet,
if (table->part_info &&
((part_syntax= generate_partition_syntax(table->part_info,
&part_syntax_len,
- FALSE,FALSE))))
+ 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 f890f504952..1d720ce150a 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -1231,7 +1231,7 @@ bool mysql_write_frm(ALTER_PARTITION_PARAM_TYPE *lpt, uint flags)
{
if (!(part_syntax_buf= generate_partition_syntax(part_info,
&syntax_len,
- TRUE, FALSE)))
+ TRUE, FALSE, TRUE)))
{
DBUG_RETURN(TRUE);
}
@@ -3149,7 +3149,7 @@ bool mysql_create_table_internal(THD *thd,
*/
if (!(part_syntax_buf= generate_partition_syntax(part_info,
&syntax_len,
- TRUE, FALSE)))
+ TRUE, FALSE, TRUE)))
goto err;
part_info->part_info_string= part_syntax_buf;
part_info->part_info_len= syntax_len;