Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
c15921ad
Commit
c15921ad
authored
Mar 30, 2006
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge abarkov@bk-internal.mysql.com:/home/bk/mysql-5.0
into mysql.com:/usr/home/bar/mysql-5.0 sql/field.cc: Auto merged
parents
b7f090e4
fa65771e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
2 deletions
+24
-2
mysql-test/r/cast.result
mysql-test/r/cast.result
+3
-0
sql/field.cc
sql/field.cc
+21
-2
No files found.
mysql-test/r/cast.result
View file @
c15921ad
...
...
@@ -344,6 +344,9 @@ SELECT f1 AS double_val, CAST(f1 AS SIGNED INT) AS cast_val FROM t1;
double_val cast_val
-1e+30 -9223372036854775808
1e+30 9223372036854775807
Warnings:
Warning 1292 Truncated incorrect INTEGER value: '-1e+30'
Warning 1292 Truncated incorrect INTEGER value: '1e+30'
DROP TABLE t1;
select cast('1.2' as decimal(3,2));
cast('1.2' as decimal(3,2))
...
...
sql/field.cc
View file @
c15921ad
...
...
@@ -4232,6 +4232,7 @@ double Field_double::val_real(void)
longlong
Field_double
::
val_int
(
void
)
{
double
j
;
longlong
res
;
#ifdef WORDS_BIGENDIAN
if
(
table
->
s
->
db_low_byte_first
)
{
...
...
@@ -4242,10 +4243,28 @@ longlong Field_double::val_int(void)
doubleget
(
j
,
ptr
);
/* Check whether we fit into longlong range */
if
(
j
<=
(
double
)
LONGLONG_MIN
)
return
(
longlong
)
LONGLONG_MIN
;
{
res
=
(
longlong
)
LONGLONG_MIN
;
goto
warn
;
}
if
(
j
>=
(
double
)
(
ulonglong
)
LONGLONG_MAX
)
return
(
longlong
)
LONGLONG_MAX
;
{
res
=
(
longlong
)
LONGLONG_MAX
;
goto
warn
;
}
return
(
longlong
)
rint
(
j
);
warn:
{
char
buf
[
DOUBLE_TO_STRING_CONVERSION_BUFFER_SIZE
];
String
tmp
(
buf
,
sizeof
(
buf
),
&
my_charset_latin1
),
*
str
;
str
=
val_str
(
&
tmp
,
0
);
push_warning_printf
(
current_thd
,
MYSQL_ERROR
::
WARN_LEVEL_WARN
,
ER_TRUNCATED_WRONG_VALUE
,
ER
(
ER_TRUNCATED_WRONG_VALUE
),
"INTEGER"
,
str
->
c_ptr
());
}
return
res
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment