mirror of
https://github.com/sogou/workflow.git
synced 2026-10-29 03:27:04 +08:00
update MySQLCell::as_XXX error return values
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user