summaryrefslogtreecommitdiff
path: root/sql/key.cc
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2013-11-28 12:10:44 +0100
committerSergei Golubchik <sergii@pisem.net>2013-11-28 12:10:44 +0100
commit1387e71531495b1224bfafd6867ae5fae9cf469c (patch)
tree6307410443d2eeee3817acf552e3ce583e9444d8 /sql/key.cc
parent44db9c41b389a2eacdd9591f825ed86e9bffd0e8 (diff)
downloadmariadb-git-1387e71531495b1224bfafd6867ae5fae9cf469c.tar.gz
MDEV-5281 Partitioning issue after upgrade from 10.0.3-1 to 10.0.5-1
merged from 5.6: Bug#14521864: MYSQL 5.1 TO 5.5 BUGS PARTITIONING Bug#16589511: MYSQL_UPGRADE FAILS TO WRITE OUT ENTIRE ALTER TABLE ... ALGORITHM= ... STATEMENT Bug#16274455: CAN NOT ACESS PARTITIONED TABLES WHEN DOWNGRADED FROM 5.6.11 TO 5.6.10 plus minor changes from 5.6, mainly comments
Diffstat (limited to 'sql/key.cc')
-rw-r--r--sql/key.cc32
1 files changed, 17 insertions, 15 deletions
diff --git a/sql/key.cc b/sql/key.cc
index edc3e6c0057..8ba3d48e8dc 100644
--- a/sql/key.cc
+++ b/sql/key.cc
@@ -21,6 +21,9 @@
#include "key.h" // key_rec_cmp
#include "field.h" // Field
+using std::min;
+using std::max;
+
/*
Search after a key that starts with 'field'
@@ -132,7 +135,7 @@ void key_copy(uchar *to_key, uchar *from_record, KEY *key_info,
Don't copy data for null values
The -1 below is to subtract the null byte which is already handled
*/
- length= MY_MIN(key_length, (uint) key_part->store_length-1);
+ length= min<uint>(key_length, key_part->store_length-1);
if (with_zerofill)
bzero((char*) to_key, length);
continue;
@@ -142,7 +145,7 @@ void key_copy(uchar *to_key, uchar *from_record, KEY *key_info,
key_part->key_part_flag & HA_VAR_LENGTH_PART)
{
key_length-= HA_KEY_BLOB_LENGTH;
- length= MY_MIN(key_length, key_part->length);
+ length= min<uint>(key_length, key_part->length);
uint bytes= key_part->field->get_key_image(to_key, length, Field::itRAW);
if (with_zerofill && bytes < length)
bzero((char*) to_key + bytes, length - bytes);
@@ -150,7 +153,7 @@ void key_copy(uchar *to_key, uchar *from_record, KEY *key_info,
}
else
{
- length= MY_MIN(key_length, key_part->length);
+ length= min<uint>(key_length, key_part->length);
Field *field= key_part->field;
CHARSET_INFO *cs= field->charset();
uint bytes= field->get_key_image(to_key, length, Field::itRAW);
@@ -202,7 +205,7 @@ void key_restore(uchar *to_record, uchar *from_key, KEY *key_info,
Don't copy data for null bytes
The -1 below is to subtract the null byte which is already handled
*/
- length= MY_MIN(key_length, (uint) key_part->store_length-1);
+ length= min<uint>(key_length, key_part->store_length-1);
continue;
}
}
@@ -244,7 +247,7 @@ void key_restore(uchar *to_record, uchar *from_key, KEY *key_info,
my_ptrdiff_t ptrdiff= to_record - field->table->record[0];
field->move_field_offset(ptrdiff);
key_length-= HA_KEY_BLOB_LENGTH;
- length= MY_MIN(key_length, key_part->length);
+ length= min<uint>(key_length, key_part->length);
old_map= dbug_tmp_use_all_columns(field->table, field->table->write_set);
field->set_key_image(from_key, length);
dbug_tmp_restore_column_map(field->table->write_set, old_map);
@@ -253,7 +256,7 @@ void key_restore(uchar *to_record, uchar *from_key, KEY *key_info,
}
else
{
- length= MY_MIN(key_length, key_part->length);
+ length= min<uint>(key_length, key_part->length);
/* skip the byte with 'uneven' bits, if used */
memcpy(to_record + key_part->offset, from_key + used_uneven_bits
, (size_t) length - used_uneven_bits);
@@ -311,7 +314,7 @@ bool key_cmp_if_same(TABLE *table,const uchar *key,uint idx,uint key_length)
return 1;
continue;
}
- length= MY_MIN((uint) (key_end-key), store_length);
+ length= min((uint) (key_end-key), store_length);
if (!(key_part->key_type & (FIELDFLAG_NUMBER+FIELDFLAG_BINARY+
FIELDFLAG_PACK)))
{
@@ -347,8 +350,8 @@ bool key_cmp_if_same(TABLE *table,const uchar *key,uint idx,uint key_length)
@param prefix_key The field is used as a prefix key.
*/
-static void field_unpack(String *to, Field *field, const uchar *rec,
- uint max_length, bool prefix_key)
+void field_unpack(String *to, Field *field, const uchar *rec, uint max_length,
+ bool prefix_key)
{
String tmp;
DBUG_ENTER("field_unpack");
@@ -389,7 +392,7 @@ static void field_unpack(String *to, Field *field, const uchar *rec,
tmp.length(charpos);
}
if (max_length < field->pack_length())
- tmp.length(MY_MIN(tmp.length(),max_length));
+ tmp.length(min(tmp.length(),max_length));
ErrConvString err(&tmp);
to->append(err.ptr());
}
@@ -410,18 +413,17 @@ static void field_unpack(String *to, Field *field, const uchar *rec,
@param
table Table to use
@param
- idx Key number
+ key Key
*/
-void key_unpack(String *to,TABLE *table, KEY *key)
+void key_unpack(String *to, TABLE *table, KEY *key)
{
- KEY_PART_INFO *key_part,*key_part_end;
my_bitmap_map *old_map= dbug_tmp_use_all_columns(table, table->read_set);
DBUG_ENTER("key_unpack");
to->length(0);
- for (key_part=key->key_part,key_part_end=key_part+
- key->user_defined_key_parts ;
+ KEY_PART_INFO *key_part_end= key->key_part + key->user_defined_key_parts;
+ for (KEY_PART_INFO *key_part= key->key_part;
key_part < key_part_end;
key_part++)
{