Commit 7043c9d4 authored by pekka@mysql.com's avatar pekka@mysql.com

ndb - wl-1442 minor

parent 40b269f7
......@@ -2364,7 +2364,8 @@ Dbtc::handle_special_hash(Uint32 dstHash[4], Uint32* src, Uint32 srcLen,
*/
Uint32 dstLen = xmul * (srcBytes - lb);
ndbrequire(dstLen <= ((dstSize - dstPos) << 2));
uint n = NdbSqlUtil::strnxfrm_bug7284(cs, dstPtr, dstLen, srcPtr + lb, len);
int n = NdbSqlUtil::strnxfrm_bug7284(cs, dstPtr, dstLen, srcPtr + lb, len);
ndbrequire(n != -1);
while ((n & 3) != 0) {
dstPtr[n++] = 0;
}
......
......@@ -1978,7 +1978,7 @@ Val::cmpchars(Par par, const unsigned char* buf1, unsigned len1, const unsigned
unsigned len = maxxmulsize * col.m_bytelength;
int n1 = NdbSqlUtil::strnxfrm_bug7284(cs, x1, chs->m_xmul * len, buf1, len1);
int n2 = NdbSqlUtil::strnxfrm_bug7284(cs, x2, chs->m_xmul * len, buf2, len2);
assert(n1 == n2);
assert(n1 != -1 && n1 == n2);
k = memcmp(x1, x2, n1);
} else {
k = (*cs->coll->strnncollsp)(cs, buf1, len1, buf2, len2, false);
......
......@@ -3420,6 +3420,9 @@ int ndbcluster_rollback(THD *thd, void *ndb_transaction)
Define NDB column based on Field.
Returns 0 or mysql error code.
Not member of ha_ndbcluster because NDBCOL cannot be declared.
MySQL text types with character set "binary" are mapped to true
NDB binary types without a character set. This may change.
*/
static int create_ndb_column(NDBCOL &col,
......@@ -3509,7 +3512,7 @@ static int create_ndb_column(NDBCOL &col,
col.setType(NDBCOL::Bit);
col.setLength(1);
}
else if (field->flags & BINARY_FLAG)
else if ((field->flags & BINARY_FLAG) && cs == &my_charset_bin)
{
col.setType(NDBCOL::Binary);
col.setLength(field->pack_length());
......@@ -3527,7 +3530,7 @@ static int create_ndb_column(NDBCOL &col,
Field_varstring* f= (Field_varstring*)field;
if (f->length_bytes == 1)
{
if (field->flags & BINARY_FLAG)
if ((field->flags & BINARY_FLAG) && cs == &my_charset_bin)
col.setType(NDBCOL::Varbinary);
else {
col.setType(NDBCOL::Varchar);
......@@ -3536,7 +3539,7 @@ static int create_ndb_column(NDBCOL &col,
}
else if (f->length_bytes == 2)
{
if (field->flags & BINARY_FLAG)
if ((field->flags & BINARY_FLAG) && cs == &my_charset_bin)
col.setType(NDBCOL::Longvarbinary);
else {
col.setType(NDBCOL::Longvarchar);
......@@ -3553,7 +3556,7 @@ static int create_ndb_column(NDBCOL &col,
// Blob types (all come in as MYSQL_TYPE_BLOB)
mysql_type_tiny_blob:
case MYSQL_TYPE_TINY_BLOB:
if (field->flags & BINARY_FLAG)
if ((field->flags & BINARY_FLAG) && cs == &my_charset_bin)
col.setType(NDBCOL::Blob);
else {
col.setType(NDBCOL::Text);
......@@ -3566,7 +3569,7 @@ static int create_ndb_column(NDBCOL &col,
break;
//mysql_type_blob:
case MYSQL_TYPE_BLOB:
if (field->flags & BINARY_FLAG)
if ((field->flags & BINARY_FLAG) && cs == &my_charset_bin)
col.setType(NDBCOL::Blob);
else {
col.setType(NDBCOL::Text);
......@@ -3588,7 +3591,7 @@ static int create_ndb_column(NDBCOL &col,
break;
mysql_type_medium_blob:
case MYSQL_TYPE_MEDIUM_BLOB:
if (field->flags & BINARY_FLAG)
if ((field->flags & BINARY_FLAG) && cs == &my_charset_bin)
col.setType(NDBCOL::Blob);
else {
col.setType(NDBCOL::Text);
......@@ -3600,7 +3603,7 @@ static int create_ndb_column(NDBCOL &col,
break;
mysql_type_long_blob:
case MYSQL_TYPE_LONG_BLOB:
if (field->flags & BINARY_FLAG)
if ((field->flags & BINARY_FLAG) && cs == &my_charset_bin)
col.setType(NDBCOL::Blob);
else {
col.setType(NDBCOL::Text);
......
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