diff options
author | unknown <reggie@linux.site> | 2006-02-21 17:40:07 -0600 |
---|---|---|
committer | unknown <reggie@linux.site> | 2006-02-21 17:40:07 -0600 |
commit | b2cf86f1bd9b8ed516f827957b82835fbc7e981a (patch) | |
tree | d3ab41f9891c1a0c463ffa4ed097ae32504d37b2 /sql | |
parent | cf5cb1e9606fb698e2ec686afd489c73ad750419 (diff) | |
download | mariadb-git-b2cf86f1bd9b8ed516f827957b82835fbc7e981a.tar.gz |
BUG #15408 - Partitions: subpartition names are not unique
libmysqld/Makefile.am:
changed name to partition_info.cc
mysql-test/r/partition_mgm_err.result:
added drop table for previous test
mysql-test/t/partition_mgm_err.test:
added drop table for previous test
sql/Makefile.am:
reformatted a bit
changed name of partition_info.cpp to partition_info.cc
sql/partition_element.h:
updated copyright date
sql/partition_info.cc:
minor corrections as a result of review
sql/partition_info.h:
updated copyright date
sql/sql_partition.cc:
updated file comment and fixed some spacing
sql/sql_partition.h:
updated copyright date
win/cmakefiles/sql:
changed name to partition_info.cc
Diffstat (limited to 'sql')
-rw-r--r-- | sql/Makefile.am | 6 | ||||
-rw-r--r-- | sql/partition_element.h | 2 | ||||
-rw-r--r-- | sql/partition_info.cc (renamed from sql/partition_info.cpp) | 54 | ||||
-rw-r--r-- | sql/partition_info.h | 2 | ||||
-rw-r--r-- | sql/sql_partition.cc | 8 | ||||
-rw-r--r-- | sql/sql_partition.h | 2 |
6 files changed, 33 insertions, 41 deletions
diff --git a/sql/Makefile.am b/sql/Makefile.am index ceddf6cf2a2..b0824110792 100644 --- a/sql/Makefile.am +++ b/sql/Makefile.am @@ -65,8 +65,8 @@ noinst_HEADERS = item.h item_func.h item_sum.h item_cmpfunc.h \ sp_head.h sp_pcontext.h sp_rcontext.h sp.h sp_cache.h \ parse_file.h sql_view.h sql_trigger.h \ sql_array.h sql_cursor.h event.h event_priv.h \ - sql_plugin.h authors.h sql_partition.h partition_info.h \ - partition_element.h + sql_plugin.h authors.h sql_partition.h \ + partition_info.h partition_element.h mysqld_SOURCES = sql_lex.cc sql_handler.cc sql_partition.cc \ item.cc item_sum.cc item_buff.cc item_func.cc \ item_cmpfunc.cc item_strfunc.cc item_timefunc.cc \ @@ -102,7 +102,7 @@ mysqld_SOURCES = sql_lex.cc sql_handler.cc sql_partition.cc \ sp_cache.cc parse_file.cc sql_trigger.cc \ event_executor.cc event.cc event_timed.cc \ sql_plugin.cc sql_binlog.cc \ - handlerton.cc sql_tablespace.cc partition_info.cpp + handlerton.cc sql_tablespace.cc partition_info.cc EXTRA_mysqld_SOURCES = ha_innodb.cc ha_berkeley.cc ha_archive.cc \ ha_innodb.h ha_berkeley.h ha_archive.h \ ha_blackhole.cc ha_federated.cc ha_ndbcluster.cc \ diff --git a/sql/partition_element.h b/sql/partition_element.h index 06007076405..bdc0f870e74 100644 --- a/sql/partition_element.h +++ b/sql/partition_element.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2000,2004 MySQL AB & MySQL Finland AB & TCX DataKonsult AB +/* Copyright (C) 2000,200666666 MySQL AB & MySQL Finland AB & TCX DataKonsult AB This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sql/partition_info.cpp b/sql/partition_info.cc index 18c80d01b1b..5d30dba5fbd 100644 --- a/sql/partition_info.cpp +++ b/sql/partition_info.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2005 MySQL AB +/* Copyright (C) 2006 MySQL AB This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -14,23 +14,6 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* - This file was introduced as a container for general functionality related - to partitioning introduced in MySQL version 5.1. It contains functionality - used by all handlers that support partitioning, which in the first version - is the partitioning handler itself and the NDB handler. - - The first version was written by Mikael Ronstrom. - - This version supports RANGE partitioning, LIST partitioning, HASH - partitioning and composite partitioning (hereafter called subpartitioning) - where each RANGE/LIST partitioning is HASH partitioned. The hash function - can either be supplied by the user or by only a list of fields (also - called KEY partitioning, where the MySQL server will use an internal - hash function. - There are quite a few defaults that can be used as well. -*/ - /* Some general useful functions */ #include "mysql_priv.h" @@ -164,6 +147,7 @@ end: DBUG_RETURN(result); } + /* Set up all the default subpartitions not set-up by the user in the SQL statement. Also perform a number of checks that the default partitioning @@ -235,6 +219,7 @@ end: DBUG_RETURN(result); } + /* Support routine for check_partition_info @@ -272,6 +257,7 @@ bool partition_info::set_up_defaults_for_partitioning(handler *file, DBUG_RETURN(FALSE); } + /* A support function to check if a partition element's name is unique @@ -283,6 +269,7 @@ bool partition_info::set_up_defaults_for_partitioning(handler *file, TRUE Has unique name FALSE Doesn't */ + bool partition_info::has_unique_name(partition_element *element) { DBUG_ENTER("partition_info::has_unique_name"); @@ -297,14 +284,16 @@ bool partition_info::has_unique_name(partition_element *element) name_to_check)) && el != element) DBUG_RETURN(FALSE); - if (el->subpartitions.is_empty()) continue; - List_iterator<partition_element> subparts_it(el->subpartitions); - partition_element *sub_el; - while (sub_el= (subparts_it++)) + if (!el->subpartitions.is_empty()) { - if (!(my_strcasecmp(system_charset_info, sub_el->partition_name, - name_to_check)) && sub_el != element) - DBUG_RETURN(FALSE); + partition_element *sub_el; + List_iterator<partition_element> subparts_it(el->subpartitions); + while (sub_el= (subparts_it++)) + { + if (!(my_strcasecmp(system_charset_info, sub_el->partition_name, + name_to_check)) && sub_el != element) + DBUG_RETURN(FALSE); + } } } DBUG_RETURN(TRUE); @@ -326,6 +315,7 @@ bool partition_info::has_unique_name(partition_element *element) Checks that the list of names in the partitions doesn't contain any duplicated names. */ + char *partition_info::has_unique_names() { DBUG_ENTER("partition_info::has_unique_names"); @@ -338,13 +328,15 @@ char *partition_info::has_unique_names() if (! has_unique_name(el)) DBUG_RETURN(el->partition_name); - if (el->subpartitions.is_empty()) continue; - List_iterator<partition_element> subparts_it(el->subpartitions); - partition_element *subel; - while (subel= (subparts_it++)) + if (!el->subpartitions.is_empty()) { - if (! has_unique_name(subel)) - DBUG_RETURN(subel->partition_name); + List_iterator<partition_element> subparts_it(el->subpartitions); + partition_element *subel; + while (subel= (subparts_it++)) + { + if (! has_unique_name(subel)) + DBUG_RETURN(subel->partition_name); + } } } DBUG_RETURN(NULL); diff --git a/sql/partition_info.h b/sql/partition_info.h index 94bafbac7a9..13a33415648 100644 --- a/sql/partition_info.h +++ b/sql/partition_info.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2000,2004 MySQL AB & MySQL Finland AB & TCX DataKonsult AB +/* Copyright (C) 2000,2006 MySQL AB & MySQL Finland AB & TCX DataKonsult AB This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc index 1d68deff9b4..7f4518c2b85 100644 --- a/sql/sql_partition.cc +++ b/sql/sql_partition.cc @@ -15,10 +15,10 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* - This file was introduced as a container for general functionality related + This file is a container for general functionality related to partitioning introduced in MySQL version 5.1. It contains functionality - used by all handlers that support partitioning, which in the first version - is the partitioning handler itself and the NDB handler. + used by all handlers that support partitioning, such as + the partitioning handler itself and the NDB handler. The first version was written by Mikael Ronstrom. @@ -26,7 +26,7 @@ partitioning and composite partitioning (hereafter called subpartitioning) where each RANGE/LIST partitioning is HASH partitioned. The hash function can either be supplied by the user or by only a list of fields (also - called KEY partitioning, where the MySQL server will use an internal + called KEY partitioning), where the MySQL server will use an internal hash function. There are quite a few defaults that can be used as well. */ diff --git a/sql/sql_partition.h b/sql/sql_partition.h index 785af742a3a..3cb7d9c2d0f 100644 --- a/sql/sql_partition.h +++ b/sql/sql_partition.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2005 MySQL AB +/* Copyright (C) 2006 MySQL AB This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by |