summaryrefslogtreecommitdiff
path: root/sql/partition_info.cc
diff options
context:
space:
mode:
authorantony@pcg5ppc.xiphis.org <>2008-03-14 11:13:54 -0700
committerantony@pcg5ppc.xiphis.org <>2008-03-14 11:13:54 -0700
commit91e44529bd6f84ac1bead5e3cb433cea3b7561e7 (patch)
tree8b48bb23a946e0bc0f25a78b76f73a06061f54c8 /sql/partition_info.cc
parentbdc74bbda7dc82475bc622dd2e38fede0c465183 (diff)
parenteac3a26efab4f3886ba68ed24cc1ddfc453dfa0e (diff)
downloadmariadb-git-91e44529bd6f84ac1bead5e3cb433cea3b7561e7.tar.gz
Merge pcg5ppc.xiphis.org:/Network/Servers/anubis.xiphis.org/home/antony/work/mysql-5.1
into pcg5ppc.xiphis.org:/Network/Servers/anubis.xiphis.org/home/antony/work/merge.20080307/mysql-5.1
Diffstat (limited to 'sql/partition_info.cc')
-rw-r--r--sql/partition_info.cc56
1 files changed, 56 insertions, 0 deletions
diff --git a/sql/partition_info.cc b/sql/partition_info.cc
index 1d21a10beaa..e7f4d6a62c1 100644
--- a/sql/partition_info.cc
+++ b/sql/partition_info.cc
@@ -1265,4 +1265,60 @@ error:
mem_alloc_error(size);
DBUG_RETURN(TRUE);
}
+
+
+/*
+ Check if path does not contain mysql data home directory
+ for partition elements with data directory and index directory
+
+ SYNOPSIS
+ check_partition_dirs()
+ part_info partition_info struct
+
+ RETURN VALUES
+ 0 ok
+ 1 error
+*/
+
+bool check_partition_dirs(partition_info *part_info)
+{
+ if (!part_info)
+ return 0;
+
+ partition_element *part_elem;
+ List_iterator<partition_element> part_it(part_info->partitions);
+ while ((part_elem= part_it++))
+ {
+ if (part_elem->subpartitions.elements)
+ {
+ List_iterator<partition_element> sub_it(part_elem->subpartitions);
+ partition_element *subpart_elem;
+ while ((subpart_elem= sub_it++))
+ {
+ if (test_if_data_home_dir(subpart_elem->data_file_name))
+ goto dd_err;
+ if (test_if_data_home_dir(subpart_elem->index_file_name))
+ goto id_err;
+ }
+ }
+ else
+ {
+ if (test_if_data_home_dir(part_elem->data_file_name))
+ goto dd_err;
+ if (test_if_data_home_dir(part_elem->index_file_name))
+ goto id_err;
+ }
+ }
+ return 0;
+
+dd_err:
+ my_error(ER_WRONG_ARGUMENTS,MYF(0),"DATA DIRECORY");
+ return 1;
+
+id_err:
+ my_error(ER_WRONG_ARGUMENTS,MYF(0),"INDEX DIRECORY");
+ return 1;
+}
+
+
#endif /* WITH_PARTITION_STORAGE_ENGINE */