1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

bug#15682 - ndb

incorrect handling of varchar in position/rnd_pos

  Commit for 5.0.17 release clone


mysql-test/r/ndb_basic.result:
  bug#15682
mysql-test/t/ndb_basic.test:
  bug#15682
sql/ha_ndbcluster.cc:
  bug#15682
This commit is contained in:
unknown
2005-12-14 15:09:12 +01:00
parent dbc27a6227
commit f8f2d51aad
3 changed files with 46 additions and 2 deletions

View File

@ -2812,8 +2812,25 @@ void ha_ndbcluster::position(const byte *record)
}
*buff++= 0;
}
memcpy(buff, record + key_part->offset, key_part->length);
buff += key_part->length;
size_t len = key_part->length;
const byte * ptr = record + key_part->offset;
Field *field = key_part->field;
if ((field->type() == MYSQL_TYPE_VARCHAR) &&
((Field_varstring*)field)->length_bytes == 1)
{
/**
* Keys always use 2 bytes length
*/
buff[0] = ptr[0];
buff[1] = 0;
memcpy(buff+2, ptr + 1, len);
len += 2;
}
else
{
memcpy(buff, ptr, len);
}
buff += len;
}
}
else