Navigation Menu

Skip to content

Commit

Permalink
mysql57: follow value decode API change
Browse files Browse the repository at this point in the history
  • Loading branch information
kou committed Mar 17, 2015
1 parent 14f23d1 commit 7c39419
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
7 changes: 4 additions & 3 deletions ha_mroonga.cpp
Expand Up @@ -90,6 +90,7 @@
#include <mrn_smart_grn_obj.hpp>
#include <mrn_database_manager.hpp>
#include <mrn_grn.hpp>
#include <mrn_value_decoder.hpp>

#ifdef MRN_SUPPORT_FOREIGN_KEYS
# include <sql_table.h>
Expand Down Expand Up @@ -10933,7 +10934,7 @@ int ha_mroonga::storage_encode_key_enum(Field *field, const uchar *key,
memcpy(buf, &value, *size);
} else {
uint16 value;
shortget(value, key);
mrn::value_decoder::decode(&value, key);
*size = 2;
memcpy(buf, &value, *size);
}
Expand Down Expand Up @@ -11045,7 +11046,7 @@ int ha_mroonga::storage_encode_key(Field *field, const uchar *key,
{
float float_value;
double double_value;
float4get(float_value, ptr);
mrn::value_decoder::decode(&float_value, ptr);
double_value = float_value;
memcpy(buf, &double_value, 8);
*size = 8;
Expand All @@ -11054,7 +11055,7 @@ int ha_mroonga::storage_encode_key(Field *field, const uchar *key,
case MYSQL_TYPE_DOUBLE:
{
double val;
float8get(val, ptr);
mrn::value_decoder::decode(&val, ptr);
memcpy(buf, &val, 8);
*size = 8;
break;
Expand Down
10 changes: 10 additions & 0 deletions lib/mrn_value_decoder.hpp
Expand Up @@ -28,6 +28,16 @@

namespace mrn {
namespace value_decoder {
void decode(uint16 *dest, const uchar *source) {
#ifdef MRN_DEST_IS_POINTER
ushortget(dest, source);
#else
uint16 value;
ushortget(value, source);
*dest = value;
#endif
};

void decode(float *dest, const uchar *source) {
#ifdef MRN_DEST_IS_POINTER
float4get(dest, source);
Expand Down

0 comments on commit 7c39419

Please sign in to comment.