update MySQLCell::as_XXX error return values

This commit is contained in:
XieHan
2022-04-22 19:27:49 +08:00
parent 2b8e8a7733
commit dc6fd172a2
+4 -3
View File
@@ -16,6 +16,7 @@
Authors: Li Yingxin (liyingxin@sogou-inc.com)
*/
#include <math.h>
#include <string>
#include <utility>
#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);