summaryrefslogtreecommitdiff
path: root/sql/sql_partition.cc
diff options
context:
space:
mode:
authorOleksandr Byelkin <sanja@mariadb.com>2015-04-08 10:13:36 +0200
committerOleksandr Byelkin <sanja@mariadb.com>2015-04-09 14:21:02 +0200
commit697194461ad2031420bc1aaf8a03432dbf2acd66 (patch)
treea05b8dd781ed7b3b2aa55222947e34b41825b4d1 /sql/sql_partition.cc
parentabba4184e68f2ae652f1be19b04f32efb2cb354a (diff)
downloadmariadb-git-697194461ad2031420bc1aaf8a03432dbf2acd66.tar.gz
MDEV-7856: EXPLAIN FORMAT=JSON should show partitions
Diffstat (limited to 'sql/sql_partition.cc')
-rw-r--r--sql/sql_partition.cc11
1 files changed, 10 insertions, 1 deletions
diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc
index 555ee2a3f40..a930e983dd6 100644
--- a/sql/sql_partition.cc
+++ b/sql/sql_partition.cc
@@ -68,6 +68,7 @@
// mysql_*_alter_copy_data
#include "opt_range.h" // store_key_image_to_rec
#include "sql_alter.h" // Alter_table_ctx
+#include "sql_select.h"
#include <algorithm>
using std::max;
@@ -7290,8 +7291,10 @@ void mem_alloc_error(size_t size)
/**
Return comma-separated list of used partitions in the provided given string.
+ @param mem_root Where to allocate following list
@param part_info Partitioning info
@param[out] parts The resulting list of string to fill
+ @param[out] used_partitions_list result list to fill
Generate a list of used partitions (from bits in part_info->read_partitions
bitmap), and store it into the provided String object.
@@ -7302,7 +7305,10 @@ void mem_alloc_error(size_t size)
that was written or locked.
*/
-void make_used_partitions_str(partition_info *part_info, String *parts_str)
+void make_used_partitions_str(MEM_ROOT *alloc,
+ partition_info *part_info,
+ String *parts_str,
+ String_list &used_partitions_list)
{
parts_str->length(0);
partition_element *pe;
@@ -7321,6 +7327,7 @@ void make_used_partitions_str(partition_info *part_info, String *parts_str)
{
if (parts_str->length())
parts_str->append(',');
+ uint index= parts_str->length();
parts_str->append(head_pe->partition_name,
strlen(head_pe->partition_name),
system_charset_info);
@@ -7328,6 +7335,7 @@ void make_used_partitions_str(partition_info *part_info, String *parts_str)
parts_str->append(pe->partition_name,
strlen(pe->partition_name),
system_charset_info);
+ used_partitions_list.append_str(alloc, parts_str->ptr() + index);
}
partition_id++;
}
@@ -7341,6 +7349,7 @@ void make_used_partitions_str(partition_info *part_info, String *parts_str)
{
if (parts_str->length())
parts_str->append(',');
+ used_partitions_list.append_str(alloc, pe->partition_name);
parts_str->append(pe->partition_name, strlen(pe->partition_name),
system_charset_info);
}