diff --git a/src/protocol/MySQLResult.inl b/src/protocol/MySQLResult.inl index 2a66ffa7..24a01f10 100644 --- a/src/protocol/MySQLResult.inl +++ b/src/protocol/MySQLResult.inl @@ -16,6 +16,7 @@ Authors: Li Yingxin (liyingxin@sogou-inc.com) */ +#include #include #include #include "mysql_byteorder.h" @@ -189,7 +190,7 @@ inline bool MySQLCell::is_float() const inline float MySQLCell::as_float() const { if (!this->is_float()) - return 0; + return NAN; char num[MYSQL_FLOAT_STR_LENGTH + 1]; memcpy(num, this->data, this->len); @@ -205,7 +206,7 @@ inline bool MySQLCell::is_double() const inline double MySQLCell::as_double() const { if (!this->is_double()) - return 0; + return NAN; char num[MYSQL_DOUBLE_STR_LENGTH + 1]; memcpy(num, this->data, this->len); @@ -221,7 +222,7 @@ inline bool MySQLCell::is_ulonglong() const inline unsigned long long MySQLCell::as_ulonglong() const { if (!this->is_ulonglong()) - return 0; + return (unsigned long long)-1; char num[MYSQL_LONG_STR_LENGTH + 1]; memcpy(num, this->data, this->len);