Commit 2b8cedb1 authored by joerg@debian.(none)'s avatar joerg@debian.(none)

Merge jbruehe@bk-internal.mysql.com:/home/bk/mysql-5.1-new

into debian.(none):/M51/mysql-5.1
parents 437b5e5f 82233340
...@@ -737,17 +737,23 @@ typedef uint32 (*partition_iter_func)(st_partition_iter* part_iter); ...@@ -737,17 +737,23 @@ typedef uint32 (*partition_iter_func)(st_partition_iter* part_iter);
typedef struct st_partition_iter typedef struct st_partition_iter
{ {
partition_iter_func get_next; partition_iter_func get_next;
struct st_part_num_range
{
uint32 start;
uint32 end;
};
union { struct st_field_value_range
struct { {
uint32 start_part_num; longlong start;
uint32 end_part_num; longlong end;
}; };
struct {
longlong start_val; union
longlong end_val; {
}; struct st_part_num_range part_nums;
bool null_returned; struct st_field_value_range field_vals;
}; };
partition_info *part_info; partition_info *part_info;
} PARTITION_ITERATOR; } PARTITION_ITERATOR;
...@@ -1004,8 +1010,8 @@ uint32 get_next_partition_id_range(struct st_partition_iter* part_iter); ...@@ -1004,8 +1010,8 @@ uint32 get_next_partition_id_range(struct st_partition_iter* part_iter);
inline void init_single_partition_iterator(uint32 part_id, inline void init_single_partition_iterator(uint32 part_id,
PARTITION_ITERATOR *part_iter) PARTITION_ITERATOR *part_iter)
{ {
part_iter->start_part_num= part_id; part_iter->part_nums.start= part_id;
part_iter->end_part_num= part_id+1; part_iter->part_nums.end= part_id+1;
part_iter->get_next= get_next_partition_id_range; part_iter->get_next= get_next_partition_id_range;
} }
...@@ -1013,8 +1019,8 @@ inline ...@@ -1013,8 +1019,8 @@ inline
void init_all_partitions_iterator(partition_info *part_info, void init_all_partitions_iterator(partition_info *part_info,
PARTITION_ITERATOR *part_iter) PARTITION_ITERATOR *part_iter)
{ {
part_iter->start_part_num= 0; part_iter->part_nums.start= 0;
part_iter->end_part_num= part_info->no_parts; part_iter->part_nums.end= part_info->no_parts;
part_iter->get_next= get_next_partition_id_range; part_iter->get_next= get_next_partition_id_range;
} }
......
...@@ -5751,7 +5751,7 @@ int get_part_iter_for_interval_via_mapping(partition_info *part_info, ...@@ -5751,7 +5751,7 @@ int get_part_iter_for_interval_via_mapping(partition_info *part_info,
/* Find minimum */ /* Find minimum */
if (flags & NO_MIN_RANGE) if (flags & NO_MIN_RANGE)
part_iter->start_part_num= 0; part_iter->part_nums.start= 0;
else else
{ {
/* /*
...@@ -5763,21 +5763,21 @@ int get_part_iter_for_interval_via_mapping(partition_info *part_info, ...@@ -5763,21 +5763,21 @@ int get_part_iter_for_interval_via_mapping(partition_info *part_info,
store_key_image_to_rec(field, min_value, field_len); store_key_image_to_rec(field, min_value, field_len);
bool include_endp= part_info->range_analysis_include_bounds || bool include_endp= part_info->range_analysis_include_bounds ||
!test(flags & NEAR_MIN); !test(flags & NEAR_MIN);
part_iter->start_part_num= get_endpoint(part_info, 1, include_endp); part_iter->part_nums.start= get_endpoint(part_info, 1, include_endp);
if (part_iter->start_part_num == max_endpoint_val) if (part_iter->part_nums.start == max_endpoint_val)
return 0; /* No partitions */ return 0; /* No partitions */
} }
/* Find maximum, do the same as above but for right interval bound */ /* Find maximum, do the same as above but for right interval bound */
if (flags & NO_MAX_RANGE) if (flags & NO_MAX_RANGE)
part_iter->end_part_num= max_endpoint_val; part_iter->part_nums.end= max_endpoint_val;
else else
{ {
store_key_image_to_rec(field, max_value, field_len); store_key_image_to_rec(field, max_value, field_len);
bool include_endp= part_info->range_analysis_include_bounds || bool include_endp= part_info->range_analysis_include_bounds ||
!test(flags & NEAR_MAX); !test(flags & NEAR_MAX);
part_iter->end_part_num= get_endpoint(part_info, 0, include_endp); part_iter->part_nums.end= get_endpoint(part_info, 0, include_endp);
if (part_iter->start_part_num == part_iter->end_part_num) if (part_iter->part_nums.start== part_iter->part_nums.end)
return 0; /* No partitions */ return 0; /* No partitions */
} }
return 1; /* Ok, iterator initialized */ return 1; /* Ok, iterator initialized */
...@@ -5907,8 +5907,8 @@ int get_part_iter_for_interval_via_walking(partition_info *part_info, ...@@ -5907,8 +5907,8 @@ int get_part_iter_for_interval_via_walking(partition_info *part_info,
if (n_values > total_parts || n_values > MAX_RANGE_TO_WALK) if (n_values > total_parts || n_values > MAX_RANGE_TO_WALK)
return -1; return -1;
part_iter->start_val= a; part_iter->field_vals.start= a;
part_iter->end_val= b; part_iter->field_vals.end= b;
part_iter->part_info= part_info; part_iter->part_info= part_info;
part_iter->get_next= get_next_func; part_iter->get_next= get_next_func;
return 1; return 1;
...@@ -5933,10 +5933,10 @@ int get_part_iter_for_interval_via_walking(partition_info *part_info, ...@@ -5933,10 +5933,10 @@ int get_part_iter_for_interval_via_walking(partition_info *part_info,
uint32 get_next_partition_id_range(PARTITION_ITERATOR* part_iter) uint32 get_next_partition_id_range(PARTITION_ITERATOR* part_iter)
{ {
if (part_iter->start_part_num == part_iter->end_part_num) if (part_iter->part_nums.start== part_iter->part_nums.end)
return NOT_A_PARTITION_ID; return NOT_A_PARTITION_ID;
else else
return part_iter->start_part_num++; return part_iter->part_nums.start++;
} }
...@@ -5959,11 +5959,11 @@ uint32 get_next_partition_id_range(PARTITION_ITERATOR* part_iter) ...@@ -5959,11 +5959,11 @@ uint32 get_next_partition_id_range(PARTITION_ITERATOR* part_iter)
uint32 get_next_partition_id_list(PARTITION_ITERATOR *part_iter) uint32 get_next_partition_id_list(PARTITION_ITERATOR *part_iter)
{ {
if (part_iter->start_part_num == part_iter->end_part_num) if (part_iter->part_nums.start == part_iter->part_nums.end)
return NOT_A_PARTITION_ID; return NOT_A_PARTITION_ID;
else else
return part_iter->part_info->list_array[part_iter-> return part_iter->part_info->list_array[part_iter->
start_part_num++].partition_id; part_nums.start++].partition_id;
} }
...@@ -5988,10 +5988,10 @@ static uint32 get_next_partition_via_walking(PARTITION_ITERATOR *part_iter) ...@@ -5988,10 +5988,10 @@ static uint32 get_next_partition_via_walking(PARTITION_ITERATOR *part_iter)
{ {
uint32 part_id; uint32 part_id;
Field *field= part_iter->part_info->part_field_array[0]; Field *field= part_iter->part_info->part_field_array[0];
while (part_iter->start_val != part_iter->end_val) while (part_iter->field_vals.start != part_iter->field_vals.end)
{ {
field->store(part_iter->start_val, FALSE); field->store(part_iter->field_vals.start, FALSE);
part_iter->start_val++; part_iter->field_vals.start++;
longlong dummy; longlong dummy;
if (!part_iter->part_info->get_partition_id(part_iter->part_info, if (!part_iter->part_info->get_partition_id(part_iter->part_info,
&part_id, &dummy)) &part_id, &dummy))
...@@ -6007,10 +6007,10 @@ static uint32 get_next_subpartition_via_walking(PARTITION_ITERATOR *part_iter) ...@@ -6007,10 +6007,10 @@ static uint32 get_next_subpartition_via_walking(PARTITION_ITERATOR *part_iter)
{ {
uint32 part_id; uint32 part_id;
Field *field= part_iter->part_info->subpart_field_array[0]; Field *field= part_iter->part_info->subpart_field_array[0];
if (part_iter->start_val == part_iter->end_val) if (part_iter->field_vals.start == part_iter->field_vals.end)
return NOT_A_PARTITION_ID; return NOT_A_PARTITION_ID;
field->store(part_iter->start_val, FALSE); field->store(part_iter->field_vals.start, FALSE);
part_iter->start_val++; part_iter->field_vals.start++;
return part_iter->part_info->get_subpartition_id(part_iter->part_info); return part_iter->part_info->get_subpartition_id(part_iter->part_info);
} }
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment