diff options
author | mikael@dator6.(none) <> | 2007-06-13 16:03:18 +0200 |
---|---|---|
committer | mikael@dator6.(none) <> | 2007-06-13 16:03:18 +0200 |
commit | 920a8ed5b377bdf4ee2e824cc2cea32dfb75d021 (patch) | |
tree | 653b319560f6cfefe911b91ef0a72ab1abbc4ec9 /sql/partition_info.cc | |
parent | ee116570dc44bdb95a95fc04b27dfb1171ec85d7 (diff) | |
parent | 0942b2d8aa37662f337f071362880cae5aea0bb7 (diff) | |
download | mariadb-git-920a8ed5b377bdf4ee2e824cc2cea32dfb75d021.tar.gz |
Merge dator6.(none):/home/mikael/mysql_clones/clean-mysql-5.1
into dator6.(none):/home/mikael/mysql_clones/bug18198
Diffstat (limited to 'sql/partition_info.cc')
-rw-r--r-- | sql/partition_info.cc | 44 |
1 files changed, 17 insertions, 27 deletions
diff --git a/sql/partition_info.cc b/sql/partition_info.cc index 23bc3c96e8f..308b96d84f8 100644 --- a/sql/partition_info.cc +++ b/sql/partition_info.cc @@ -905,7 +905,6 @@ bool partition_info::set_up_charset_field_preps() Field *field, **ptr; uchar **char_ptrs; unsigned i; - bool found; size_t size; uint tot_fields= 0; uint tot_part_fields= 0; @@ -918,7 +917,6 @@ bool partition_info::set_up_charset_field_preps() { ptr= part_field_array; /* Set up arrays and buffers for those fields */ - i= 0; while ((field= *(ptr++))) { if (field_is_partition_charset(field)) @@ -954,7 +952,7 @@ bool partition_info::set_up_charset_field_preps() } part_charset_field_array[i]= NULL; } - if (is_sub_partitioned() && list_of_subpart_fields && + if (is_sub_partitioned() && !list_of_subpart_fields && check_part_func_fields(subpart_field_array, FALSE)) { /* Set up arrays and buffers for those fields */ @@ -962,7 +960,10 @@ bool partition_info::set_up_charset_field_preps() while ((field= *(ptr++))) { if (field_is_partition_charset(field)) + { tot_subpart_fields++; + tot_fields++; + } } size= tot_subpart_fields * sizeof(char*); if (!(char_ptrs= (uchar**) sql_calloc(size))) @@ -975,10 +976,10 @@ bool partition_info::set_up_charset_field_preps() if (!(char_ptrs= (uchar**) sql_alloc(size))) goto error; subpart_charset_field_array= (Field**)char_ptrs; + ptr= subpart_field_array; i= 0; while ((field= *(ptr++))) { - unsigned j= 0; CHARSET_INFO *cs; uchar *field_buf; LINT_INIT(field_buf); @@ -987,28 +988,16 @@ bool partition_info::set_up_charset_field_preps() continue; cs= ((Field_str*)field)->charset(); size= field->pack_length(); - found= FALSE; - for (j= 0; j < tot_part_fields; j++) - { - if (field == part_charset_field_array[i]) - found= TRUE; - } - if (!found) - { - tot_fields++; - if (!(field_buf= (uchar*) sql_calloc(size))) - goto error; - } + if (!(field_buf= (uchar*) sql_calloc(size))) + goto error; + subpart_charset_field_array[i]= field; subpart_field_buffers[i++]= field_buf; } - if (!(char_ptrs= (uchar**) sql_calloc(size))) - goto error; - restore_subpart_field_ptrs= char_ptrs; + subpart_charset_field_array[i]= NULL; } if (tot_fields) { - uint j,k,l; - + uint k; size= tot_fields*sizeof(char**); if (!(char_ptrs= (uchar**)sql_calloc(size))) goto error; @@ -1026,11 +1015,12 @@ bool partition_info::set_up_charset_field_preps() full_part_field_buffers[i]= part_field_buffers[i]; } k= tot_part_fields; - l= 0; for (i= 0; i < tot_subpart_fields; i++) { + uint j; + bool found= FALSE; field= subpart_charset_field_array[i]; - found= FALSE; + for (j= 0; j < tot_part_fields; j++) { if (field == part_charset_field_array[i]) @@ -1038,12 +1028,12 @@ bool partition_info::set_up_charset_field_preps() } if (!found) { - full_part_charset_field_array[l]= subpart_charset_field_array[k]; - full_part_field_buffers[l]= subpart_field_buffers[k]; - k++; l++; + full_part_charset_field_array[k]= subpart_charset_field_array[i]; + full_part_field_buffers[k]= subpart_field_buffers[i]; + k++; } } - full_part_charset_field_array[tot_fields]= NULL; + full_part_charset_field_array[k]= NULL; } DBUG_RETURN(FALSE); error: |