ha_ndbcluster.cc:

  remove typecheck in ndb handler not needed
parent 9b3d0b85
...@@ -464,13 +464,12 @@ bool ha_ndbcluster::get_error_message(int error, ...@@ -464,13 +464,12 @@ bool ha_ndbcluster::get_error_message(int error,
} }
#ifndef DBUG_OFF
/* /*
Check if type is supported by NDB. Check if type is supported by NDB.
TODO Use this once in open(), not in every operation
*/ */
static inline bool ndb_supported_type(enum_field_types type) static bool ndb_supported_type(enum_field_types type)
{ {
switch (type) { switch (type) {
case MYSQL_TYPE_DECIMAL: case MYSQL_TYPE_DECIMAL:
...@@ -502,6 +501,7 @@ static inline bool ndb_supported_type(enum_field_types type) ...@@ -502,6 +501,7 @@ static inline bool ndb_supported_type(enum_field_types type)
} }
return FALSE; return FALSE;
} }
#endif /* !DBUG_OFF */
/* /*
...@@ -531,15 +531,10 @@ int ha_ndbcluster::set_ndb_key(NdbOperation *ndb_op, Field *field, ...@@ -531,15 +531,10 @@ int ha_ndbcluster::set_ndb_key(NdbOperation *ndb_op, Field *field,
pack_len)); pack_len));
DBUG_DUMP("key", (char*)field_ptr, pack_len); DBUG_DUMP("key", (char*)field_ptr, pack_len);
if (ndb_supported_type(field->type())) DBUG_ASSERT(ndb_supported_type(field->type()));
{ DBUG_ASSERT(! (field->flags & BLOB_FLAG));
if (! (field->flags & BLOB_FLAG)) // Common implementation for most field types
// Common implementation for most field types DBUG_RETURN(ndb_op->equal(fieldnr, (char*) field_ptr, pack_len) != 0);
DBUG_RETURN(ndb_op->equal(fieldnr, (char*) field_ptr, pack_len) != 0);
}
// Unhandled field types
DBUG_PRINT("error", ("Field type %d not supported", field->type()));
DBUG_RETURN(2);
} }
...@@ -558,7 +553,7 @@ int ha_ndbcluster::set_ndb_value(NdbOperation *ndb_op, Field *field, ...@@ -558,7 +553,7 @@ int ha_ndbcluster::set_ndb_value(NdbOperation *ndb_op, Field *field,
pack_len, field->is_null()?"Y":"N")); pack_len, field->is_null()?"Y":"N"));
DBUG_DUMP("value", (char*) field_ptr, pack_len); DBUG_DUMP("value", (char*) field_ptr, pack_len);
if (ndb_supported_type(field->type())) DBUG_ASSERT(ndb_supported_type(field->type()));
{ {
// ndb currently does not support size 0 // ndb currently does not support size 0
const byte *empty_field= ""; const byte *empty_field= "";
...@@ -607,9 +602,6 @@ int ha_ndbcluster::set_ndb_value(NdbOperation *ndb_op, Field *field, ...@@ -607,9 +602,6 @@ int ha_ndbcluster::set_ndb_value(NdbOperation *ndb_op, Field *field,
} }
DBUG_RETURN(1); DBUG_RETURN(1);
} }
// Unhandled field types
DBUG_PRINT("error", ("Field type %d not supported", field->type()));
DBUG_RETURN(2);
} }
...@@ -704,9 +696,8 @@ int ha_ndbcluster::get_ndb_value(NdbOperation *ndb_op, Field *field, ...@@ -704,9 +696,8 @@ int ha_ndbcluster::get_ndb_value(NdbOperation *ndb_op, Field *field,
if (field != NULL) if (field != NULL)
{ {
DBUG_ASSERT(buf); DBUG_ASSERT(buf);
if (ndb_supported_type(field->type())) DBUG_ASSERT(ndb_supported_type(field->type()));
{
DBUG_ASSERT(field->ptr != NULL); DBUG_ASSERT(field->ptr != NULL);
if (! (field->flags & BLOB_FLAG)) if (! (field->flags & BLOB_FLAG))
{ {
...@@ -730,10 +721,6 @@ int ha_ndbcluster::get_ndb_value(NdbOperation *ndb_op, Field *field, ...@@ -730,10 +721,6 @@ int ha_ndbcluster::get_ndb_value(NdbOperation *ndb_op, Field *field,
DBUG_RETURN(ndb_blob->setActiveHook(g_get_ndb_blobs_value, arg) != 0); DBUG_RETURN(ndb_blob->setActiveHook(g_get_ndb_blobs_value, arg) != 0);
} }
DBUG_RETURN(1); DBUG_RETURN(1);
}
// Unhandled field types
DBUG_PRINT("error", ("Field type %d not supported", field->type()));
DBUG_RETURN(2);
} }
// Used for hidden key only // Used for hidden key only
......
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