Commit 4d83b7a5 authored by unknown's avatar unknown

fix char(0) to use ndb bit format

parent ed683a7a
......@@ -90,7 +90,7 @@ static int ndb_get_table_statistics(Ndb*, const char *,
Dummy buffer to read zero pack_length fields
which are mapped to 1 char
*/
static byte dummy_buf[1];
static uint32 dummy_buf;
/*
Error handling functions
......@@ -470,11 +470,15 @@ int ha_ndbcluster::set_ndb_value(NdbOperation *ndb_op, Field *field,
if (ndb_supported_type(field->type()))
{
// ndb currently does not support size 0
const byte *empty_field= "";
uint32 empty_field;
if (pack_len == 0)
{
pack_len= 1;
field_ptr= empty_field;
pack_len= sizeof(empty_field);
field_ptr= (byte *)&empty_field;
if (field->is_null())
empty_field= 0;
else
empty_field= 1;
}
if (! (field->flags & BLOB_FLAG))
{
......@@ -623,7 +627,7 @@ int ha_ndbcluster::get_ndb_value(NdbOperation *ndb_op, Field *field,
if (field->pack_length() != 0)
field_buf= buf + (field->ptr - table->record[0]);
else
field_buf= dummy_buf;
field_buf= (byte *)&dummy_buf;
m_value[fieldnr].rec= ndb_op->getValue(fieldnr,
field_buf);
DBUG_RETURN(m_value[fieldnr].rec == NULL);
......@@ -3329,19 +3333,22 @@ static int create_ndb_column(NDBCOL &col,
break;
// Char types
case MYSQL_TYPE_STRING:
if (field->flags & BINARY_FLAG)
col.setType(NDBCOL::Binary);
else {
col.setType(NDBCOL::Char);
col.setCharset(cs);
}
if (field->pack_length() == 0)
{
col.setType(NDBCOL::Bit);
col.setLength(1);
}
else if (field->flags & BINARY_FLAG)
{
col.setType(NDBCOL::Binary);
col.setLength(field->pack_length());
}
else
{
col.setType(NDBCOL::Char);
col.setCharset(cs);
col.setLength(field->pack_length());
}
break;
case MYSQL_TYPE_VAR_STRING:
if (field->flags & BINARY_FLAG)
......
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