summaryrefslogtreecommitdiff
path: root/sql/item.h
diff options
context:
space:
mode:
Diffstat (limited to 'sql/item.h')
-rw-r--r--sql/item.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/sql/item.h b/sql/item.h
index 320591d4d99..7a7e080db02 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -1331,6 +1331,14 @@ public:
longlong val_int()
{
DBUG_ASSERT(fixed == 1);
+ if (value <= (double) LONGLONG_MIN)
+ {
+ return LONGLONG_MIN;
+ }
+ else if (value >= (double) (ulonglong) LONGLONG_MAX)
+ {
+ return LONGLONG_MAX;
+ }
return (longlong) (value+(value > 0 ? 0.5 : -0.5));
}
String *val_str(String*);