Commit 30292b46 authored by pekka@mysql.com's avatar pekka@mysql.com

ndb - wl#2972 fix null blobs

parent 43e6c85b
...@@ -30,6 +30,6 @@ ndb_autodiscover2 : Needs to be fixed w.r.t binlog ...@@ -30,6 +30,6 @@ ndb_autodiscover2 : Needs to be fixed w.r.t binlog
system_mysql_db : Needs fixing system_mysql_db : Needs fixing
system_mysql_db_fix : Needs fixing system_mysql_db_fix : Needs fixing
#ndb_alter_table_row : sometimes wrong error 1015!=1046 #ndb_alter_table_row : sometimes wrong error 1015!=1046
ndb_gis : garbled msgs from corrupt THD* + partitioning problem ndb_gis : garbled msgs from corrupt THD*
# vim: set filetype=conf: # vim: set filetype=conf:
...@@ -844,14 +844,29 @@ int get_ndb_blobs_value(TABLE* table, NdbValue* value_array, ...@@ -844,14 +844,29 @@ int get_ndb_blobs_value(TABLE* table, NdbValue* value_array,
buf, (uint) blob_len)); buf, (uint) blob_len));
if (ndb_blob->readData(buf, len) != 0) if (ndb_blob->readData(buf, len) != 0)
DBUG_RETURN(-1); DBUG_RETURN(-1);
DBUG_PRINT("info", ("blob field %d offset=%u len=%u [ptrdiff=%d]",
i, offset, len, (int)ptrdiff));
DBUG_ASSERT(len == blob_len); DBUG_ASSERT(len == blob_len);
// Ugly hack assumes only ptr needs to be changed // Ugly hack assumes only ptr needs to be changed
field_blob->ptr += ptrdiff; field_blob->ptr+= ptrdiff;
field_blob->set_ptr(len, buf); field_blob->set_ptr(len, buf);
field_blob->ptr -= ptrdiff; field_blob->ptr-= ptrdiff;
} }
offset+= blob_size; offset+= blob_size;
} }
else
{
if (loop == 1)
{
// have to set length even in this case
char *buf= buffer + offset;
uint32 len= 0;
field_blob->ptr+= ptrdiff;
field_blob->set_ptr(len, buf);
field_blob->ptr-= ptrdiff;
DBUG_PRINT("info", ("blob field %d isNull=%d", i, isNull));
}
}
} }
} }
if (loop == 0 && offset > buffer_size) if (loop == 0 && offset > buffer_size)
...@@ -2735,21 +2750,29 @@ void ndb_unpack_record(TABLE *table, NdbValue *value, ...@@ -2735,21 +2750,29 @@ void ndb_unpack_record(TABLE *table, NdbValue *value,
else else
{ {
NdbBlob *ndb_blob= (*value).blob; NdbBlob *ndb_blob= (*value).blob;
uint col_no = ndb_blob->getColumn()->getColumnNo();
int isNull; int isNull;
ndb_blob->getDefined(isNull); ndb_blob->getDefined(isNull);
if (isNull != 0)
{
uint col_no = ndb_blob->getColumn()->getColumnNo();
if (isNull == 1) if (isNull == 1)
{ {
DBUG_PRINT("info",("[%u] NULL", col_no)) DBUG_PRINT("info",("[%u] NULL", col_no))
field->set_null(row_offset); field->set_null(row_offset);
} }
else else if (isNull == -1)
{ {
DBUG_PRINT("info",("[%u] UNDEFINED", col_no)); DBUG_PRINT("info",("[%u] UNDEFINED", col_no));
bitmap_clear_bit(defined, col_no); bitmap_clear_bit(defined, col_no);
} }
else
{
#ifndef DBUG_OFF
// pointer vas set in get_ndb_blobs_value
Field_blob *field_blob= (Field_blob*)field;
char* ptr;
field_blob->get_ptr(&ptr, row_offset);
uint32 len= field_blob->get_length(row_offset);
DBUG_PRINT("info",("[%u] SET ptr=%p len=%u", col_no, ptr, len));
#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