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
72d83155
Commit
72d83155
authored
Mar 05, 2004
by
paul@ice.snake.net
Browse files
Options
Browse Files
Download
Plain Diff
Merge paul@bk-internal.mysql.com:/home/bk/mysql-4.1
into ice.snake.net:/Volumes/ice2/MySQL/bk/mysql-4.1
parents
cd1eecf9
d5208629
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
465 additions
and
50 deletions
+465
-50
client/mysqltest.c
client/mysqltest.c
+58
-10
mysql-test/r/insert.result
mysql-test/r/insert.result
+256
-0
mysql-test/r/mysqldump.result
mysql-test/r/mysqldump.result
+2
-0
mysql-test/t/insert.test
mysql-test/t/insert.test
+64
-0
sql/field.cc
sql/field.cc
+84
-36
strings/strtod.c
strings/strtod.c
+1
-4
No files found.
client/mysqltest.c
View file @
72d83155
...
@@ -128,6 +128,8 @@ static CHARSET_INFO *charset_info= &my_charset_latin1;
...
@@ -128,6 +128,8 @@ static CHARSET_INFO *charset_info= &my_charset_latin1;
static
int
embedded_server_arg_count
=
0
;
static
int
embedded_server_arg_count
=
0
;
static
char
*
embedded_server_args
[
MAX_SERVER_ARGS
];
static
char
*
embedded_server_args
[
MAX_SERVER_ARGS
];
static
my_bool
display_result_vertically
=
FALSE
;
static
const
char
*
embedded_server_groups
[]
=
{
static
const
char
*
embedded_server_groups
[]
=
{
"server"
,
"server"
,
"embedded"
,
"embedded"
,
...
@@ -213,6 +215,8 @@ Q_REQUIRE_VERSION,
...
@@ -213,6 +215,8 @@ Q_REQUIRE_VERSION,
Q_ENABLE_WARNINGS
,
Q_DISABLE_WARNINGS
,
Q_ENABLE_WARNINGS
,
Q_DISABLE_WARNINGS
,
Q_ENABLE_INFO
,
Q_DISABLE_INFO
,
Q_ENABLE_INFO
,
Q_DISABLE_INFO
,
Q_EXEC
,
Q_DELIMITER
,
Q_EXEC
,
Q_DELIMITER
,
Q_DISPLAY_VERTICAL_RESULTS
,
Q_DISPLAY_HORISONTAL_RESULTS
,
Q_QUERY_VERTICAL
,
Q_QUERY_HORISONTAL
,
Q_UNKNOWN
,
/* Unknown command. */
Q_UNKNOWN
,
/* Unknown command. */
Q_COMMENT
,
/* Comments, ignored. */
Q_COMMENT
,
/* Comments, ignored. */
...
@@ -286,6 +290,10 @@ const char *command_names[]=
...
@@ -286,6 +290,10 @@ const char *command_names[]=
"disable_info"
,
"disable_info"
,
"exec"
,
"exec"
,
"delimiter"
,
"delimiter"
,
"vertical_results"
,
"horisontal_results"
,
"query_vertical"
,
"query_horisontal"
,
0
0
};
};
...
@@ -2110,6 +2118,7 @@ static void append_result(DYNAMIC_STRING *ds, MYSQL_RES *res)
...
@@ -2110,6 +2118,7 @@ static void append_result(DYNAMIC_STRING *ds, MYSQL_RES *res)
{
{
MYSQL_ROW
row
;
MYSQL_ROW
row
;
uint
num_fields
=
mysql_num_fields
(
res
);
uint
num_fields
=
mysql_num_fields
(
res
);
MYSQL_FIELD
*
fields
=
!
display_result_vertically
?
0
:
mysql_fetch_fields
(
res
);
unsigned
long
*
lengths
;
unsigned
long
*
lengths
;
while
((
row
=
mysql_fetch_row
(
res
)))
while
((
row
=
mysql_fetch_row
(
res
)))
{
{
...
@@ -2130,10 +2139,21 @@ static void append_result(DYNAMIC_STRING *ds, MYSQL_RES *res)
...
@@ -2130,10 +2139,21 @@ static void append_result(DYNAMIC_STRING *ds, MYSQL_RES *res)
val
=
"NULL"
;
val
=
"NULL"
;
len
=
4
;
len
=
4
;
}
}
if
(
!
display_result_vertically
)
{
if
(
i
)
if
(
i
)
dynstr_append_mem
(
ds
,
"
\t
"
,
1
);
dynstr_append_mem
(
ds
,
"
\t
"
,
1
);
replace_dynstr_append_mem
(
ds
,
val
,
len
);
replace_dynstr_append_mem
(
ds
,
val
,
len
);
}
}
else
{
dynstr_append
(
ds
,
fields
[
i
].
name
);
dynstr_append_mem
(
ds
,
"
\t
"
,
1
);
replace_dynstr_append_mem
(
ds
,
val
,
len
);
dynstr_append_mem
(
ds
,
"
\n
"
,
1
);
}
}
if
(
!
display_result_vertically
)
dynstr_append_mem
(
ds
,
"
\n
"
,
1
);
dynstr_append_mem
(
ds
,
"
\n
"
,
1
);
}
}
free_replace_column
();
free_replace_column
();
...
@@ -2275,10 +2295,12 @@ int run_query(MYSQL* mysql, struct st_query* q, int flags)
...
@@ -2275,10 +2295,12 @@ int run_query(MYSQL* mysql, struct st_query* q, int flags)
if
(
!
disable_result_log
)
if
(
!
disable_result_log
)
{
{
if
(
res
)
if
(
res
)
{
if
(
!
display_result_vertically
)
{
{
int
num_fields
=
mysql_num_fields
(
res
);
int
num_fields
=
mysql_num_fields
(
res
);
MYSQL_FIELD
*
fields
=
mysql_fetch_fields
(
res
);
MYSQL_FIELD
*
fields
=
mysql_fetch_fields
(
res
);
for
(
i
=
0
;
i
<
num_fields
;
i
++
)
for
(
i
=
0
;
i
<
num_fields
;
i
++
)
{
{
if
(
i
)
if
(
i
)
...
@@ -2286,6 +2308,7 @@ int run_query(MYSQL* mysql, struct st_query* q, int flags)
...
@@ -2286,6 +2308,7 @@ int run_query(MYSQL* mysql, struct st_query* q, int flags)
dynstr_append
(
ds
,
fields
[
i
].
name
);
dynstr_append
(
ds
,
fields
[
i
].
name
);
}
}
dynstr_append_mem
(
ds
,
"
\n
"
,
1
);
dynstr_append_mem
(
ds
,
"
\n
"
,
1
);
}
append_result
(
ds
,
res
);
append_result
(
ds
,
res
);
}
}
...
@@ -2557,12 +2580,37 @@ int main(int argc, char **argv)
...
@@ -2557,12 +2580,37 @@ int main(int argc, char **argv)
strmake
(
delimiter
,
q
->
first_argument
,
sizeof
(
delimiter
)
-
1
);
strmake
(
delimiter
,
q
->
first_argument
,
sizeof
(
delimiter
)
-
1
);
delimiter_length
=
strlen
(
delimiter
);
delimiter_length
=
strlen
(
delimiter
);
break
;
break
;
case
Q_DISPLAY_VERTICAL_RESULTS
:
display_result_vertically
=
TRUE
;
break
;
case
Q_DISPLAY_HORISONTAL_RESULTS
:
display_result_vertically
=
FALSE
;
break
;
case
Q_LET
:
do_let
(
q
);
break
;
case
Q_LET
:
do_let
(
q
);
break
;
case
Q_EVAL_RESULT
:
eval_result
=
1
;
break
;
case
Q_EVAL_RESULT
:
eval_result
=
1
;
break
;
case
Q_EVAL
:
case
Q_EVAL
:
if
(
q
->
query
==
q
->
query_buf
)
if
(
q
->
query
==
q
->
query_buf
)
q
->
query
=
q
->
first_argument
;
q
->
query
=
q
->
first_argument
;
/* fall through */
/* fall through */
case
Q_QUERY_VERTICAL
:
case
Q_QUERY_HORISONTAL
:
{
my_bool
old_display_result_vertically
=
display_result_vertically
;
if
(
!
q
->
query
[
q
->
first_word_len
])
{
/* This happens when we use 'query_..' on it's own line */
q_send_flag
=
1
;
break
;
}
/* fix up query pointer if this is * first iteration for this line */
if
(
q
->
query
==
q
->
query_buf
)
q
->
query
+=
q
->
first_word_len
+
1
;
switch
(
q
->
type
)
{
case
Q_QUERY_VERTICAL
:
display_result_vertically
=
TRUE
;
break
;
case
Q_QUERY_HORISONTAL
:
display_result_vertically
=
FALSE
;
break
;
}
error
|=
run_query
(
&
cur_con
->
mysql
,
q
,
QUERY_REAP
|
QUERY_SEND
);
display_result_vertically
=
old_display_result_vertically
;
break
;
}
case
Q_QUERY
:
case
Q_QUERY
:
case
Q_REAP
:
case
Q_REAP
:
{
{
...
...
mysql-test/r/insert.result
View file @
72d83155
...
@@ -86,3 +86,259 @@ use mysqltest;
...
@@ -86,3 +86,259 @@ use mysqltest;
create table t1 (c int);
create table t1 (c int);
insert into mysqltest.t1 set mysqltest.t1.c = '1';
insert into mysqltest.t1 set mysqltest.t1.c = '1';
drop database mysqltest;
drop database mysqltest;
use test;
create table t1(
`number ` int auto_increment primary key,
`original_value ` varchar(50),
`f_double ` double,
`f_float ` float,
`f_double_7_2 ` double(7,2),
`f_float_4_3 ` float (4,3),
`f_double_u ` double unsigned,
`f_float_u ` float unsigned,
`f_double_15_1_u ` double(15,1) unsigned,
`f_float_3_1_u ` float (3,1) unsigned
);
set @value= "aa";
insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
Warnings:
Warning 1265 Data truncated for column 'f_double ' at row 1
Warning 1265 Data truncated for column 'f_float ' at row 1
Warning 1265 Data truncated for column 'f_double_7_2 ' at row 1
Warning 1265 Data truncated for column 'f_float_4_3 ' at row 1
Warning 1265 Data truncated for column 'f_double_u ' at row 1
Warning 1265 Data truncated for column 'f_float_u ' at row 1
Warning 1265 Data truncated for column 'f_double_15_1_u ' at row 1
Warning 1265 Data truncated for column 'f_float_3_1_u ' at row 1
select * from t1 where `number `=last_insert_id();
number 1
original_value aa
f_double 0
f_float 0
f_double_7_2 0.00
f_float_4_3 0.000
f_double_u 0
f_float_u 0
f_double_15_1_u 0.0
f_float_3_1_u 0.0
set @value= "1aa";
insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
Warnings:
Warning 1265 Data truncated for column 'f_double ' at row 1
Warning 1265 Data truncated for column 'f_float ' at row 1
Warning 1265 Data truncated for column 'f_double_7_2 ' at row 1
Warning 1265 Data truncated for column 'f_float_4_3 ' at row 1
Warning 1265 Data truncated for column 'f_double_u ' at row 1
Warning 1265 Data truncated for column 'f_float_u ' at row 1
Warning 1265 Data truncated for column 'f_double_15_1_u ' at row 1
Warning 1265 Data truncated for column 'f_float_3_1_u ' at row 1
select * from t1 where `number `=last_insert_id();
number 2
original_value 1aa
f_double 1
f_float 1
f_double_7_2 1.00
f_float_4_3 1.000
f_double_u 1
f_float_u 1
f_double_15_1_u 1.0
f_float_3_1_u 1.0
set @value= "aa1";
insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
Warnings:
Warning 1265 Data truncated for column 'f_double ' at row 1
Warning 1265 Data truncated for column 'f_float ' at row 1
Warning 1265 Data truncated for column 'f_double_7_2 ' at row 1
Warning 1265 Data truncated for column 'f_float_4_3 ' at row 1
Warning 1265 Data truncated for column 'f_double_u ' at row 1
Warning 1265 Data truncated for column 'f_float_u ' at row 1
Warning 1265 Data truncated for column 'f_double_15_1_u ' at row 1
Warning 1265 Data truncated for column 'f_float_3_1_u ' at row 1
select * from t1 where `number `=last_insert_id();
number 3
original_value aa1
f_double 0
f_float 0
f_double_7_2 0.00
f_float_4_3 0.000
f_double_u 0
f_float_u 0
f_double_15_1_u 0.0
f_float_3_1_u 0.0
set @value= "1e+1111111111a";
insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
Warnings:
Warning 1265 Data truncated for column 'f_double ' at row 1
Warning 1264 Data truncated, out of range for column 'f_double ' at row 1
Warning 1265 Data truncated for column 'f_float ' at row 1
Warning 1264 Data truncated, out of range for column 'f_float ' at row 1
Warning 1265 Data truncated for column 'f_double_7_2 ' at row 1
Warning 1264 Data truncated, out of range for column 'f_double_7_2 ' at row 1
Warning 1265 Data truncated for column 'f_float_4_3 ' at row 1
Warning 1264 Data truncated, out of range for column 'f_float_4_3 ' at row 1
Warning 1265 Data truncated for column 'f_double_u ' at row 1
Warning 1264 Data truncated, out of range for column 'f_double_u ' at row 1
Warning 1265 Data truncated for column 'f_float_u ' at row 1
Warning 1264 Data truncated, out of range for column 'f_float_u ' at row 1
Warning 1265 Data truncated for column 'f_double_15_1_u ' at row 1
Warning 1264 Data truncated, out of range for column 'f_double_15_1_u ' at row 1
Warning 1265 Data truncated for column 'f_float_3_1_u ' at row 1
Warning 1264 Data truncated, out of range for column 'f_float_3_1_u ' at row 1
select * from t1 where `number `=last_insert_id();
number 4
original_value 1e+1111111111a
f_double 1.79769313486232e+308
f_float 3.40282e+38
f_double_7_2 99999.99
f_float_4_3 9.999
f_double_u 1.79769313486232e+308
f_float_u 3.40282e+38
f_double_15_1_u 99999999999999.9
f_float_3_1_u 99.9
set @value= "-1e+1111111111a";
insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
Warnings:
Warning 1265 Data truncated for column 'f_double ' at row 1
Warning 1264 Data truncated, out of range for column 'f_double ' at row 1
Warning 1265 Data truncated for column 'f_float ' at row 1
Warning 1264 Data truncated, out of range for column 'f_float ' at row 1
Warning 1265 Data truncated for column 'f_double_7_2 ' at row 1
Warning 1264 Data truncated, out of range for column 'f_double_7_2 ' at row 1
Warning 1265 Data truncated for column 'f_float_4_3 ' at row 1
Warning 1264 Data truncated, out of range for column 'f_float_4_3 ' at row 1
Warning 1265 Data truncated for column 'f_double_u ' at row 1
Warning 1264 Data truncated, out of range for column 'f_double_u ' at row 1
Warning 1265 Data truncated for column 'f_float_u ' at row 1
Warning 1264 Data truncated, out of range for column 'f_float_u ' at row 1
Warning 1265 Data truncated for column 'f_double_15_1_u ' at row 1
Warning 1264 Data truncated, out of range for column 'f_double_15_1_u ' at row 1
Warning 1265 Data truncated for column 'f_float_3_1_u ' at row 1
Warning 1264 Data truncated, out of range for column 'f_float_3_1_u ' at row 1
select * from t1 where `number `=last_insert_id();
number 5
original_value -1e+1111111111a
f_double -1.79769313486232e+308
f_float -3.40282e+38
f_double_7_2 -99999.99
f_float_4_3 -9.999
f_double_u 0
f_float_u 0
f_double_15_1_u 0.0
f_float_3_1_u 0.0
set @value= 1e+1111111111;
insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
Warnings:
Warning 1264 Data truncated, out of range for column 'f_double ' at row 1
Warning 1264 Data truncated, out of range for column 'f_float ' at row 1
Warning 1264 Data truncated, out of range for column 'f_double_7_2 ' at row 1
Warning 1264 Data truncated, out of range for column 'f_float_4_3 ' at row 1
Warning 1264 Data truncated, out of range for column 'f_double_u ' at row 1
Warning 1264 Data truncated, out of range for column 'f_float_u ' at row 1
Warning 1264 Data truncated, out of range for column 'f_double_15_1_u ' at row 1
Warning 1264 Data truncated, out of range for column 'f_float_3_1_u ' at row 1
select * from t1 where `number `=last_insert_id();
number 6
original_value inf
f_double 1.79769313486232e+308
f_float 3.40282e+38
f_double_7_2 99999.99
f_float_4_3 9.999
f_double_u 1.79769313486232e+308
f_float_u 3.40282e+38
f_double_15_1_u 99999999999999.9
f_float_3_1_u 99.9
set @value= -1e+1111111111;
insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
Warnings:
Warning 1264 Data truncated, out of range for column 'f_double ' at row 1
Warning 1264 Data truncated, out of range for column 'f_float ' at row 1
Warning 1264 Data truncated, out of range for column 'f_double_7_2 ' at row 1
Warning 1264 Data truncated, out of range for column 'f_float_4_3 ' at row 1
Warning 1264 Data truncated, out of range for column 'f_double_u ' at row 1
Warning 1264 Data truncated, out of range for column 'f_float_u ' at row 1
Warning 1264 Data truncated, out of range for column 'f_double_15_1_u ' at row 1
Warning 1264 Data truncated, out of range for column 'f_float_3_1_u ' at row 1
select * from t1 where `number `=last_insert_id();
number 7
original_value -inf
f_double -1.79769313486232e+308
f_float -3.40282e+38
f_double_7_2 -99999.99
f_float_4_3 -9.999
f_double_u 0
f_float_u 0
f_double_15_1_u 0.0
f_float_3_1_u 0.0
set @value= 1e+111;
insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
Warnings:
Warning 1264 Data truncated, out of range for column 'f_float ' at row 1
Warning 1264 Data truncated, out of range for column 'f_double_7_2 ' at row 1
Warning 1264 Data truncated, out of range for column 'f_float_4_3 ' at row 1
Warning 1264 Data truncated, out of range for column 'f_float_u ' at row 1
Warning 1264 Data truncated, out of range for column 'f_double_15_1_u ' at row 1
Warning 1264 Data truncated, out of range for column 'f_float_3_1_u ' at row 1
select * from t1 where `number `=last_insert_id();
number 8
original_value 1e+111
f_double 1e+111
f_float 3.40282e+38
f_double_7_2 99999.99
f_float_4_3 9.999
f_double_u 1e+111
f_float_u 3.40282e+38
f_double_15_1_u 99999999999999.9
f_float_3_1_u 99.9
set @value= -1e+111;
insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
Warnings:
Warning 1264 Data truncated, out of range for column 'f_float ' at row 1
Warning 1264 Data truncated, out of range for column 'f_double_7_2 ' at row 1
Warning 1264 Data truncated, out of range for column 'f_float_4_3 ' at row 1
Warning 1264 Data truncated, out of range for column 'f_double_u ' at row 1
Warning 1264 Data truncated, out of range for column 'f_float_u ' at row 1
Warning 1264 Data truncated, out of range for column 'f_double_15_1_u ' at row 1
Warning 1264 Data truncated, out of range for column 'f_float_3_1_u ' at row 1
select * from t1 where `number `=last_insert_id();
number 9
original_value -1e+111
f_double -1e+111
f_float -3.40282e+38
f_double_7_2 -99999.99
f_float_4_3 -9.999
f_double_u 0
f_float_u 0
f_double_15_1_u 0.0
f_float_3_1_u 0.0
set @value= 1;
insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
select * from t1 where `number `=last_insert_id();
number 10
original_value 1
f_double 1
f_float 1
f_double_7_2 1.00
f_float_4_3 1.000
f_double_u 1
f_float_u 1
f_double_15_1_u 1.0
f_float_3_1_u 1.0
set @value= -1;
insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
Warnings:
Warning 1264 Data truncated, out of range for column 'f_double_u ' at row 1
Warning 1264 Data truncated, out of range for column 'f_float_u ' at row 1
Warning 1264 Data truncated, out of range for column 'f_double_15_1_u ' at row 1
Warning 1264 Data truncated, out of range for column 'f_float_3_1_u ' at row 1
select * from t1 where `number `=last_insert_id();
number 11
original_value -1
f_double -1
f_float -1
f_double_7_2 -1.00
f_float_4_3 -1.000
f_double_u 0
f_float_u 0
f_double_15_1_u 0.0
f_float_3_1_u 0.0
drop table t1;
mysql-test/r/mysqldump.result
View file @
72d83155
...
@@ -46,6 +46,8 @@ UNLOCK TABLES;
...
@@ -46,6 +46,8 @@ UNLOCK TABLES;
DROP TABLE t1;
DROP TABLE t1;
CREATE TABLE t1 (a double);
CREATE TABLE t1 (a double);
INSERT INTO t1 VALUES (-9e999999);
INSERT INTO t1 VALUES (-9e999999);
Warnings:
Warning 1264 Data truncated, out of range for column 'a' at row 1
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT, CHARACTER_SET_CLIENT=utf8 */;
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT, CHARACTER_SET_CLIENT=utf8 */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
...
...
mysql-test/t/insert.test
View file @
72d83155
...
@@ -87,3 +87,67 @@ use mysqltest;
...
@@ -87,3 +87,67 @@ use mysqltest;
create
table
t1
(
c
int
);
create
table
t1
(
c
int
);
insert
into
mysqltest
.
t1
set
mysqltest
.
t1
.
c
=
'1'
;
insert
into
mysqltest
.
t1
set
mysqltest
.
t1
.
c
=
'1'
;
drop
database
mysqltest
;
drop
database
mysqltest
;
#
# Test of wrong values for float data (bug #2082)
#
use
test
;
create
table
t1
(
`number `
int
auto_increment
primary
key
,
`original_value `
varchar
(
50
),
`f_double `
double
,
`f_float `
float
,
`f_double_7_2 `
double
(
7
,
2
),
`f_float_4_3 `
float
(
4
,
3
),
`f_double_u `
double
unsigned
,
`f_float_u `
float
unsigned
,
`f_double_15_1_u `
double
(
15
,
1
)
unsigned
,
`f_float_3_1_u `
float
(
3
,
1
)
unsigned
);
set
@
value
=
"aa"
;
insert
into
t1
values
(
null
,
@
value
,
@
value
,
@
value
,
@
value
,
@
value
,
@
value
,
@
value
,
@
value
,
@
value
);
--
query_vertical
select
*
from
t1
where
`number `
=
last_insert_id
()
set
@
value
=
"1aa"
;
insert
into
t1
values
(
null
,
@
value
,
@
value
,
@
value
,
@
value
,
@
value
,
@
value
,
@
value
,
@
value
,
@
value
);
--
query_vertical
select
*
from
t1
where
`number `
=
last_insert_id
()
set
@
value
=
"aa1"
;
insert
into
t1
values
(
null
,
@
value
,
@
value
,
@
value
,
@
value
,
@
value
,
@
value
,
@
value
,
@
value
,
@
value
);
--
query_vertical
select
*
from
t1
where
`number `
=
last_insert_id
()
set
@
value
=
"1e+1111111111a"
;
insert
into
t1
values
(
null
,
@
value
,
@
value
,
@
value
,
@
value
,
@
value
,
@
value
,
@
value
,
@
value
,
@
value
);
--
query_vertical
select
*
from
t1
where
`number `
=
last_insert_id
()
set
@
value
=
"-1e+1111111111a"
;
insert
into
t1
values
(
null
,
@
value
,
@
value
,
@
value
,
@
value
,
@
value
,
@
value
,
@
value
,
@
value
,
@
value
);
--
query_vertical
select
*
from
t1
where
`number `
=
last_insert_id
()
set
@
value
=
1
e
+
1111111111
;
insert
into
t1
values
(
null
,
@
value
,
@
value
,
@
value
,
@
value
,
@
value
,
@
value
,
@
value
,
@
value
,
@
value
);
--
query_vertical
select
*
from
t1
where
`number `
=
last_insert_id
()
set
@
value
=
-
1
e
+
1111111111
;
insert
into
t1
values
(
null
,
@
value
,
@
value
,
@
value
,
@
value
,
@
value
,
@
value
,
@
value
,
@
value
,
@
value
);
--
query_vertical
select
*
from
t1
where
`number `
=
last_insert_id
()
set
@
value
=
1
e
+
111
;
insert
into
t1
values
(
null
,
@
value
,
@
value
,
@
value
,
@
value
,
@
value
,
@
value
,
@
value
,
@
value
,
@
value
);
--
query_vertical
select
*
from
t1
where
`number `
=
last_insert_id
()
set
@
value
=
-
1
e
+
111
;
insert
into
t1
values
(
null
,
@
value
,
@
value
,
@
value
,
@
value
,
@
value
,
@
value
,
@
value
,
@
value
,
@
value
);
--
query_vertical
select
*
from
t1
where
`number `
=
last_insert_id
()
set
@
value
=
1
;
insert
into
t1
values
(
null
,
@
value
,
@
value
,
@
value
,
@
value
,
@
value
,
@
value
,
@
value
,
@
value
,
@
value
);
--
query_vertical
select
*
from
t1
where
`number `
=
last_insert_id
()
set
@
value
=
-
1
;
insert
into
t1
values
(
null
,
@
value
,
@
value
,
@
value
,
@
value
,
@
value
,
@
value
,
@
value
,
@
value
,
@
value
);
--
query_vertical
select
*
from
t1
where
`number `
=
last_insert_id
()
drop
table
t1
;
sql/field.cc
View file @
72d83155
...
@@ -2271,13 +2271,18 @@ void Field_longlong::sql_type(String &res) const
...
@@ -2271,13 +2271,18 @@ void Field_longlong::sql_type(String &res) const
int
Field_float
::
store
(
const
char
*
from
,
uint
len
,
CHARSET_INFO
*
cs
)
int
Field_float
::
store
(
const
char
*
from
,
uint
len
,
CHARSET_INFO
*
cs
)
{
{
int
err
;
int
err
;
Field_float
::
store
(
my_strntod
(
cs
,(
char
*
)
from
,
len
,(
char
**
)
NULL
,
&
err
));
char
*
end
;
if
(
err
||
current_thd
->
count_cuted_fields
&&
!
test_if_real
(
from
,
len
,
cs
))
double
nr
=
my_strntod
(
cs
,(
char
*
)
from
,
len
,
&
end
,
&
err
);
if
(
!
err
&&
(
!
current_thd
->
count_cuted_fields
||
end
-
from
==
len
))
{
return
Field_float
::
store
(
nr
);
}
else
{
{
set_warning
(
MYSQL_ERROR
::
WARN_LEVEL_WARN
,
ER_WARN_DATA_TRUNCATED
);
set_warning
(
MYSQL_ERROR
::
WARN_LEVEL_WARN
,
ER_WARN_DATA_TRUNCATED
);
Field_float
::
store
(
nr
);
return
1
;
return
1
;
}
}
return
(
err
)
?
1
:
0
;
}
}
...
@@ -2285,28 +2290,48 @@ int Field_float::store(double nr)
...
@@ -2285,28 +2290,48 @@ int Field_float::store(double nr)
{
{
float
j
;
float
j
;
int
error
=
0
;
int
error
=
0
;
if
(
dec
<
NOT_FIXED_DEC
)
nr
=
floor
(
nr
*
log_10
[
dec
]
+
0.5
)
/
log_10
[
dec
];
// To fixed point
if
(
isnan
(
nr
))
if
(
unsigned_flag
&&
nr
<
0
)
{
{
j
=
0
;
set_null
();
set_warning
(
MYSQL_ERROR
::
WARN_LEVEL_WARN
,
ER_WARN_DATA_OUT_OF_RANGE
);
error
=
1
;
}
else
if
(
unsigned_flag
&&
nr
<
0
)
{
j
=
0
;
set_warning
(
MYSQL_ERROR
::
WARN_LEVEL_WARN
,
ER_WARN_DATA_OUT_OF_RANGE
);
set_warning
(
MYSQL_ERROR
::
WARN_LEVEL_WARN
,
ER_WARN_DATA_OUT_OF_RANGE
);
nr
=
0
;
error
=
1
;
error
=
1
;
}
}
if
(
nr
<
-
FLT_MAX
)
else
{
double
max_value
;
if
(
dec
>=
NOT_FIXED_DEC
)
{
max_value
=
FLT_MAX
;
}
else
{
max_value
=
(
log_10
[
field_length
]
-
1
)
/
log_10
[
dec
];
nr
=
floor
(
nr
*
log_10
[
dec
]
+
0.5
)
/
log_10
[
dec
];
}
if
(
nr
<
-
max_value
)
{
{
j
=
-
FLT_MAX
;
j
=
(
float
)
-
max_value
;
set_warning
(
MYSQL_ERROR
::
WARN_LEVEL_WARN
,
ER_WARN_DATA_OUT_OF_RANGE
);
set_warning
(
MYSQL_ERROR
::
WARN_LEVEL_WARN
,
ER_WARN_DATA_OUT_OF_RANGE
);
error
=
1
;
error
=
1
;
}
}
else
if
(
nr
>
FLT_MAX
)
else
if
(
nr
>
max_value
)
{
{
j
=
FLT_MAX
;
j
=
(
float
)
max_value
;
set_warning
(
MYSQL_ERROR
::
WARN_LEVEL_WARN
,
ER_WARN_DATA_OUT_OF_RANGE
);
set_warning
(
MYSQL_ERROR
::
WARN_LEVEL_WARN
,
ER_WARN_DATA_OUT_OF_RANGE
);
error
=
1
;
error
=
1
;
}
}
else
else
j
=
(
float
)
nr
;
j
=
(
float
)
nr
;
}
#ifdef WORDS_BIGENDIAN
#ifdef WORDS_BIGENDIAN
if
(
table
->
db_low_byte_first
)
if
(
table
->
db_low_byte_first
)
{
{
...
@@ -2544,41 +2569,64 @@ void Field_float::sql_type(String &res) const
...
@@ -2544,41 +2569,64 @@ void Field_float::sql_type(String &res) const
int
Field_double
::
store
(
const
char
*
from
,
uint
len
,
CHARSET_INFO
*
cs
)
int
Field_double
::
store
(
const
char
*
from
,
uint
len
,
CHARSET_INFO
*
cs
)
{
{
int
err
;
int
err
;
double
j
=
my_strntod
(
cs
,(
char
*
)
from
,
len
,(
char
**
)
0
,
&
err
);
char
*
end
;
if
(
err
||
current_thd
->
count_cuted_fields
&&
!
test_if_real
(
from
,
len
,
cs
))
double
nr
=
my_strntod
(
cs
,(
char
*
)
from
,
len
,
&
end
,
&
err
);
{
if
(
!
err
&&
(
!
current_thd
->
count_cuted_fields
||
end
-
from
==
len
))
set_warning
(
MYSQL_ERROR
::
WARN_LEVEL_WARN
,
ER_WARN_DATA_TRUNCATED
);
err
=
1
;
}
if
(
unsigned_flag
&&
j
<
0
)
{
{
set_warning
(
MYSQL_ERROR
::
WARN_LEVEL_WARN
,
ER_WARN_DATA_OUT_OF_RANGE
);
return
Field_double
::
store
(
nr
);
j
=
0
;
err
=
1
;
}
}
#ifdef WORDS_BIGENDIAN
else
if
(
table
->
db_low_byte_first
)
{
{
float8store
(
ptr
,
j
);
set_warning
(
MYSQL_ERROR
::
WARN_LEVEL_WARN
,
ER_WARN_DATA_TRUNCATED
);
Field_double
::
store
(
nr
);
return
1
;
}
}
else
#endif
doublestore
(
ptr
,
j
);
return
err
;
}
}
int
Field_double
::
store
(
double
nr
)
int
Field_double
::
store
(
double
nr
)
{
{
int
error
=
0
;
int
error
=
0
;
if
(
dec
<
NOT_FIXED_DEC
)
nr
=
floor
(
nr
*
log_10
[
dec
]
+
0.5
)
/
log_10
[
dec
];
// To fixed point
if
(
isnan
(
nr
))
if
(
unsigned_flag
&&
nr
<
0
)
{
{
nr
=
0
;
set_null
();
set_warning
(
MYSQL_ERROR
::
WARN_LEVEL_WARN
,
ER_WARN_DATA_OUT_OF_RANGE
);
error
=
1
;
}
else
if
(
unsigned_flag
&&
nr
<
0
)
{
nr
=
0
;
set_warning
(
MYSQL_ERROR
::
WARN_LEVEL_WARN
,
ER_WARN_DATA_OUT_OF_RANGE
);
set_warning
(
MYSQL_ERROR
::
WARN_LEVEL_WARN
,
ER_WARN_DATA_OUT_OF_RANGE
);
nr
=
0
;
error
=
1
;
error
=
1
;
}
}
else
{
double
max_value
;
if
(
dec
>=
NOT_FIXED_DEC
)
{
max_value
=
DBL_MAX
;
}
else
{
max_value
=
(
log_10
[
field_length
]
-
1
)
/
log_10
[
dec
];
nr
=
floor
(
nr
*
log_10
[
dec
]
+
0.5
)
/
log_10
[
dec
];
}
if
(
nr
<
-
max_value
)
{
nr
=
-
max_value
;
set_warning
(
MYSQL_ERROR
::
WARN_LEVEL_WARN
,
ER_WARN_DATA_OUT_OF_RANGE
);
error
=
1
;
}
else
if
(
nr
>
max_value
)
{
nr
=
max_value
;
set_warning
(
MYSQL_ERROR
::
WARN_LEVEL_WARN
,
ER_WARN_DATA_OUT_OF_RANGE
);
error
=
1
;
}
}
#ifdef WORDS_BIGENDIAN
#ifdef WORDS_BIGENDIAN
if
(
table
->
db_low_byte_first
)
if
(
table
->
db_low_byte_first
)
{
{
...
...
strings/strtod.c
View file @
72d83155
...
@@ -93,7 +93,7 @@ double my_strtod(const char *str, char **end)
...
@@ -93,7 +93,7 @@ double my_strtod(const char *str, char **end)
if
(
neg
)
if
(
neg
)
result
=
0
.
0
;
result
=
0
.
0
;
else
else
result
=
DBL_MAX
;
result
=
DBL_MAX
*
10
;
goto
done
;
goto
done
;
}
}
while
(
exp
>=
100
)
while
(
exp
>=
100
)
...
@@ -113,9 +113,6 @@ done:
...
@@ -113,9 +113,6 @@ done:
if
(
end
)
if
(
end
)
*
end
=
(
char
*
)
str
;
*
end
=
(
char
*
)
str
;
if
(
isinf
(
result
))
result
=
DBL_MAX
;
return
negative
?
-
result
:
result
;
return
negative
?
-
result
:
result
;
}
}
...
...
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