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
30711c66
Commit
30711c66
authored
Sep 25, 2015
by
Alexander Barkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-8806 Numeric CAST produce different warnings for strings literals vs functions
parent
26e4403f
Changes
23
Show whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
169 additions
and
84 deletions
+169
-84
mysql-test/r/func_group.result
mysql-test/r/func_group.result
+3
-0
mysql-test/r/func_math.result
mysql-test/r/func_math.result
+3
-0
mysql-test/r/func_misc.result
mysql-test/r/func_misc.result
+2
-0
mysql-test/r/func_regexp_pcre.result
mysql-test/r/func_regexp_pcre.result
+4
-0
mysql-test/r/func_str.result
mysql-test/r/func_str.result
+11
-2
mysql-test/r/func_time.result
mysql-test/r/func_time.result
+40
-0
mysql-test/r/subselect_sj.result
mysql-test/r/subselect_sj.result
+3
-0
mysql-test/r/subselect_sj_jcl6.result
mysql-test/r/subselect_sj_jcl6.result
+3
-0
mysql-test/r/xml.result
mysql-test/r/xml.result
+4
-0
mysql-test/suite/rpl/r/rpl_row_create_select.result
mysql-test/suite/rpl/r/rpl_row_create_select.result
+2
-2
mysql-test/suite/rpl/t/rpl_switch_stm_row_mixed.test
mysql-test/suite/rpl/t/rpl_switch_stm_row_mixed.test
+2
-0
mysql-test/suite/rpl/t/rpl_temp_table_mix_row.test
mysql-test/suite/rpl/t/rpl_temp_table_mix_row.test
+2
-0
mysql-test/t/ctype_ucs.test
mysql-test/t/ctype_ucs.test
+3
-0
mysql-test/t/func_str.test
mysql-test/t/func_str.test
+7
-2
sql/field.h
sql/field.h
+17
-0
sql/item.cc
sql/item.cc
+6
-17
sql/item.h
sql/item.h
+34
-9
sql/item_func.cc
sql/item_func.cc
+7
-27
sql/item_geofunc.h
sql/item_geofunc.h
+0
-1
sql/item_strfunc.cc
sql/item_strfunc.cc
+9
-22
sql/item_strfunc.h
sql/item_strfunc.h
+5
-0
sql/item_sum.cc
sql/item_sum.cc
+1
-1
sql/sql_do.cc
sql/sql_do.cc
+1
-1
No files found.
mysql-test/r/func_group.result
View file @
30711c66
...
...
@@ -2107,6 +2107,9 @@ select avg(export_set( 3, 'y', sha(i))), group_concat(d) from t1 group by d orde
avg(export_set( 3, 'y', sha(i))) group_concat(d)
0 2008-10-02
0 2010-12-12
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: 'y,y,356a192b7913b04c54574d18c28d46e6395428ab,356a192b7913b04c54574d18c28d46e6395428ab,356a192b7913b04c54574d18c28d46e6395428ab,3'
Warning 1292 Truncated incorrect DOUBLE value: 'y,y,da4b9237bacccdf19c0760cab7aec4a8359010b0,da4b9237bacccdf19c0760cab7aec4a8359010b0,da4b9237bacccdf19c0760cab7aec4a8359010b0,d'
drop table t1;
#
# MDEV-4290: crash in st_select_lex::mark_as_dependent
...
...
mysql-test/r/func_math.result
View file @
30711c66
...
...
@@ -702,6 +702,9 @@ SELECT floor(log10(format(concat_ws(5445796E25, 5306463, 30837), -358821)))
as foo;
foo
2
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: '53064635.445796e3130837'
Warning 1292 Truncated incorrect DOUBLE value: '179,769,313,486,231,570,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,'
#
# Bug #58137 char(0) column cause:
# my_gcvt: Assertion `width > 0 && to != ((void *)0)' failed
...
...
mysql-test/r/func_misc.result
View file @
30711c66
...
...
@@ -295,6 +295,8 @@ INSERT INTO t1 VALUES ('', 0);
SELECT COALESCE(a) = COALESCE(b) FROM t1;
COALESCE(a) = COALESCE(b)
1
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: ''
DROP TABLE t1;
#
# Bug #54461: crash with longblob and union or update with subquery
...
...
mysql-test/r/func_regexp_pcre.result
View file @
30711c66
...
...
@@ -445,6 +445,8 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
Warnings:
Note 1003 select regexp_replace('abc','b','x') AS `REGEXP_REPLACE('abc','b','x')`
CREATE TABLE t1 AS SELECT REGEXP_REPLACE('abc','b','x')+0;
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: 'axc'
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
...
...
@@ -745,6 +747,8 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
Warnings:
Note 1003 select regexp_substr('abc','b') AS `REGEXP_SUBSTR('abc','b')`
CREATE TABLE t1 AS SELECT REGEXP_SUBSTR('abc','b')+0;
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: 'b'
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
...
...
mysql-test/r/func_str.result
View file @
30711c66
...
...
@@ -1160,6 +1160,8 @@ Warning 1292 Truncated incorrect DOUBLE value: 'notnumber'
SELECT * FROM t1, t2 WHERE num=substring(str from 1 for 6);
str num
notnumber 0
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: 'notnum'
DROP TABLE t1,t2;
CREATE TABLE t1(
id int(11) NOT NULL auto_increment,
...
...
@@ -1352,6 +1354,8 @@ cast(rtrim(' 20.06 ') as decimal(19,2))
select cast(ltrim(' 20.06 ') as decimal(19,2));
cast(ltrim(' 20.06 ') as decimal(19,2))
20.06
Warnings:
Note 1292 Truncated incorrect DECIMAL value: '20.06 '
select cast(rtrim(ltrim(' 20.06 ')) as decimal(19,2));
cast(rtrim(ltrim(' 20.06 ')) as decimal(19,2))
20.06
...
...
@@ -2915,7 +2919,7 @@ format(rpad('111111111.1',
1111111,
'999999999999999999999999999999999999999999'),0,'be_BY')
;
DO
SELECT
round(
concat( (
coalesce( (
...
...
@@ -2930,9 +2934,14 @@ sha1('P'),
)
)
)
);
) AS r;
r
0
Warnings:
Warning 1292 Truncated incorrect INTEGER value: '511993d3c99719e38a6779073019dacd7178ddb9'
Warning 1292 Truncated incorrect DECIMAL value: '[.DC2.]'
Warning 1292 Truncated incorrect INTEGER value: '511993d3c99719e38a6779073019dacd7178ddb9'
Warning 1292 Truncated incorrect DOUBLE value: '0.000000000000000000000000000000111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111'
SET @@global.max_allowed_packet:= @tmp_max;
SELECT @tmp_max:= @@global.max_allowed_packet;
@tmp_max:= @@global.max_allowed_packet
...
...
mysql-test/r/func_time.result
View file @
30711c66
...
...
@@ -163,6 +163,8 @@ Saturday 5
select monthname("1972-03-04"),monthname("1972-03-04")+0;
monthname("1972-03-04") monthname("1972-03-04")+0
March 0
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: 'March'
select time_format(000000,'%H|%I|%k|%l|%i|%p|%r|%S|%T'),date_format(19980131000000,'%H|%I|%k|%l|%i|%p|%r|%S|%T');
time_format(000000,'%H|%I|%k|%l|%i|%p|%r|%S|%T') date_format(19980131000000,'%H|%I|%k|%l|%i|%p|%r|%S|%T')
00|12|0|12|00|AM|12:00:00 AM|00|00:00:00 00|12|0|12|00|AM|12:00:00 AM|00|00:00:00
...
...
@@ -1966,6 +1968,9 @@ SELECT * FROM t1 GROUP BY SEC_TO_TIME(concat(a,'10'))*1;
a
2000-02-23
2005-05-04
Warnings:
Warning 1292 Truncated incorrect DECIMAL value: '2005-05-0410'
Warning 1292 Truncated incorrect DECIMAL value: '2000-02-2310'
DROP TABLE t1;
CREATE TABLE t1 (a DATE) ENGINE=MyISAM;
INSERT INTO t1 VALUES ('2005-05-04'),('2000-02-23');
...
...
@@ -2015,22 +2020,37 @@ SELECT * FROM t1 GROUP BY FROM_UNIXTIME(concat(a,'10'))*1;
a
2000-02-23
2005-05-04
Warnings:
Warning 1292 Truncated incorrect DECIMAL value: '2005-05-0410'
Warning 1292 Truncated incorrect DECIMAL value: '2000-02-2310'
SELECT * FROM t1 GROUP BY (-FROM_UNIXTIME(concat(a,'10')))*1;
a
2005-05-04
2000-02-23
Warnings:
Warning 1292 Truncated incorrect DECIMAL value: '2005-05-0410'
Warning 1292 Truncated incorrect DECIMAL value: '2000-02-2310'
SELECT * FROM t1 GROUP BY (-FROM_UNIXTIME(concat(a,'10')));
a
2005-05-04
2000-02-23
Warnings:
Warning 1292 Truncated incorrect DECIMAL value: '2005-05-0410'
Warning 1292 Truncated incorrect DECIMAL value: '2000-02-2310'
SELECT * FROM t1 GROUP BY ABS(FROM_UNIXTIME(concat(a,'10')));
a
2000-02-23
2005-05-04
Warnings:
Warning 1292 Truncated incorrect DECIMAL value: '2005-05-0410'
Warning 1292 Truncated incorrect DECIMAL value: '2000-02-2310'
SELECT * FROM t1 GROUP BY @a:=(FROM_UNIXTIME(concat(a,'10'))*1);
a
2000-02-23
2005-05-04
Warnings:
Warning 1292 Truncated incorrect DECIMAL value: '2005-05-0410'
Warning 1292 Truncated incorrect DECIMAL value: '2000-02-2310'
DROP TABLE t1;
SET TIME_ZONE='+02:00';
#
...
...
@@ -2042,10 +2062,18 @@ SELECT a, FROM_UNIXTIME(CONCAT(a,'10')) AS f1, FROM_UNIXTIME(CONCAT(a,'10'))+0 A
a f1 f2
2005-05-04 1970-01-01 02:33:25 19700101023325.000000
2000-02-23 1970-01-01 02:33:20 19700101023320.000000
Warnings:
Warning 1292 Truncated incorrect DECIMAL value: '2005-05-0410'
Warning 1292 Truncated incorrect DECIMAL value: '2005-05-0410'
Warning 1292 Truncated incorrect DECIMAL value: '2000-02-2310'
Warning 1292 Truncated incorrect DECIMAL value: '2000-02-2310'
SELECT * FROM t1 GROUP BY FROM_UNIXTIME(CONCAT(a,'10'))+0;
a
2000-02-23
2005-05-04
Warnings:
Warning 1292 Truncated incorrect DECIMAL value: '2005-05-0410'
Warning 1292 Truncated incorrect DECIMAL value: '2000-02-2310'
DROP TABLE t1;
CREATE TABLE t1 (a DATE) ENGINE=MyISAM;
INSERT INTO t1 VALUES ('2005-05-04'),('2000-02-23');
...
...
@@ -2053,16 +2081,28 @@ SELECT * FROM t1 GROUP BY FROM_UNIXTIME(concat(a,'10'))/1;
a
2000-02-23
2005-05-04
Warnings:
Warning 1292 Truncated incorrect DECIMAL value: '2005-05-0410'
Warning 1292 Truncated incorrect DECIMAL value: '2000-02-2310'
DROP TABLE t1;
CREATE TABLE t1 (a DATE);
INSERT INTO t1 VALUES ('2005-05-04');
SELECT CONCAT(FROM_UNIXTIME(CONCAT(a,'10')) MOD FROM_UNIXTIME(CONCAT(a,'10'))) AS f2 FROM t1;
f2
0.000000
Warnings:
Warning 1292 Truncated incorrect DECIMAL value: '2005-05-0410'
Warning 1292 Truncated incorrect DECIMAL value: '2005-05-0410'
SELECT CHAR_LENGTH(CONCAT(FROM_UNIXTIME(CONCAT(a,'10')) MOD FROM_UNIXTIME(CONCAT(a,'10')))) AS f2 FROM t1;
f2
8
Warnings:
Warning 1292 Truncated incorrect DECIMAL value: '2005-05-0410'
Warning 1292 Truncated incorrect DECIMAL value: '2005-05-0410'
CREATE TABLE t2 AS SELECT CONCAT(FROM_UNIXTIME(CONCAT(a,'10')) MOD FROM_UNIXTIME(CONCAT(a,'10'))) AS f2 FROM t1;
Warnings:
Warning 1292 Truncated incorrect DECIMAL value: '2005-05-0410'
Warning 1292 Truncated incorrect DECIMAL value: '2005-05-0410'
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
...
...
mysql-test/r/subselect_sj.result
View file @
30711c66
...
...
@@ -2094,6 +2094,9 @@ f1 f2 f3 f3
4 0 0 0
4 0 0 0
0 NULL NULL NULL
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: 'foo'
Warning 1292 Truncated incorrect DOUBLE value: 'foo'
DROP TABLE t1, t2, t3, t4;
set @tmp803457=@@optimizer_switch;
#
...
...
mysql-test/r/subselect_sj_jcl6.result
View file @
30711c66
...
...
@@ -2108,6 +2108,9 @@ f1 f2 f3 f3
4 0 0 0
4 0 0 0
0 NULL NULL NULL
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: 'foo'
Warning 1292 Truncated incorrect DOUBLE value: 'foo'
DROP TABLE t1, t2, t3, t4;
set @tmp803457=@@optimizer_switch;
#
...
...
mysql-test/r/xml.result
View file @
30711c66
...
...
@@ -1184,6 +1184,8 @@ aa bb
SELECT ExtractValue('
<a><b>
abc
</b><c>
2
</c><d>
1
</d></a>
','substring(/a/b,..)');
ExtractValue('
<a><b>
abc
</b><c>
2
</c><d>
1
</d></a>
','substring(/a/b,..)')
Warnings:
Warning 1292 Truncated incorrect INTEGER value: ''
#
# Bug#62429 XML: ExtractValue, UpdateXML max arg length 127 chars
#
...
...
@@ -1243,6 +1245,8 @@ DROP TABLE t1;
SELECT ExtractValue('
<a><b>
abc
</b><c>
2
</c><d>
1
</d></a>
','substring(/a/b,..)') AS e;
e
Warnings:
Warning 1292 Truncated incorrect INTEGER value: ''
SELECT ExtractValue('
<a><b>
abc
</b><c>
2
</c><d>
1
</d></a>
','substring(/a/b,/a/c)') AS e;
e
bc
...
...
mysql-test/suite/rpl/r/rpl_row_create_select.result
View file @
30711c66
...
...
@@ -8,7 +8,7 @@ include/master-slave.inc
#value of 21.
CREATE TABLE t1 AS SELECT REPEAT('A', 1000) DIV 1 AS a;
Warnings:
Warning 1
918 Encountered illegal value '' when converting to DECIMAL
Warning 1
292 Truncated incorrect DECIMAL value: 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
...
...
@@ -16,7 +16,7 @@ t1 CREATE TABLE `t1` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE t2 AS SELECT CONVERT(REPEAT('A', 255) USING UCS2) DIV 1 AS a;
Warnings:
Warning 1
918 Encountered illegal value '' when converting to DECIMAL
Warning 1
292 Truncated incorrect DECIMAL value: 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
...
...
mysql-test/suite/rpl/t/rpl_switch_stm_row_mixed.test
View file @
30711c66
...
...
@@ -149,7 +149,9 @@ insert into t1 select "yesterday_24_";
create
table
t2
ENGINE
=
MyISAM
select
rpad
(
UUID
(),
100
,
' '
);
create
table
t3
select
1
union
select
UUID
();
--
disable_warnings
create
table
t4
select
*
from
t1
where
3
in
(
select
1
union
select
2
union
select
UUID
()
union
select
3
);
--
enable_warnings
create
table
t5
select
*
from
t1
where
3
in
(
select
1
union
select
2
union
select
curdate
()
union
select
3
);
# what if UUID() is first:
--
disable_warnings
...
...
mysql-test/suite/rpl/t/rpl_temp_table_mix_row.test
View file @
30711c66
...
...
@@ -192,7 +192,9 @@ DROP TEMPORARY TABLE t1;
# INSERT INTO t1 VALUES(1);
--
echo
# The rows event will binlogged after 'INSERT INTO t1 VALUES(1)'
--
disable_warnings
INSERT
INTO
t1
VALUES
(
uuid
()
+
0
);
--
enable_warnings
COMMIT
;
source
include
/
show_binlog_events
.
inc
;
...
...
mysql-test/t/ctype_ucs.test
View file @
30711c66
...
...
@@ -737,7 +737,10 @@ DROP TABLE t1;
--
echo
#
--
echo
# Bug#59648 my_strtoll10_mb2: Assertion `(*endptr - s) % 2 == 0' failed.
--
echo
#
--
disable_warnings
# Enable warnings when "MDEV-8844 Unreadable control characters printed as is in warnings" is fixed
SELECT
HEX
(
CHAR
(
COALESCE
(
NULL
,
CHAR
(
COUNT
(
'%s'
)
USING
ucs2
),
1
,
@@
global
.
license
,
NULL
)
USING
cp850
));
--
enable_warnings
SELECT
CONVERT
(
QUOTE
(
CHAR
(
0xf5
using
ucs2
)),
SIGNED
);
--
echo
End
of
5.0
tests
...
...
mysql-test/t/func_str.test
View file @
30711c66
...
...
@@ -1549,7 +1549,12 @@ format(rpad('111111111.1',
'999999999999999999999999999999999999999999'
),
0
,
'be_BY'
)
;
DO
#
# Originally it was DO instead of SELECT here.
# But in mysqltest --disable_prepare_warnings affects SELECT queries only
# and can't suppress prepare time warnings for DO.
#
SELECT
round
(
concat
(
(
coalesce
(
(
...
...
@@ -1564,7 +1569,7 @@ round(
)
)
)
);
)
AS
r
;
--
connection
conn1
SET
@@
global
.
max_allowed_packet
:=
@
tmp_max
;
...
...
sql/field.h
View file @
30711c66
...
...
@@ -279,6 +279,23 @@ protected:
cs
,
cptr
,
end
-
cptr
,
decimal_value
);
return
decimal_value
;
}
longlong
longlong_from_string_with_check
(
const
String
*
str
)
const
{
return
longlong_from_string_with_check
(
str
->
charset
(),
str
->
ptr
(),
str
->
end
());
}
double
double_from_string_with_check
(
const
String
*
str
)
const
{
return
double_from_string_with_check
(
str
->
charset
(),
str
->
ptr
(),
str
->
end
());
}
my_decimal
*
decimal_from_string_with_check
(
my_decimal
*
decimal_value
,
const
String
*
str
)
{
return
decimal_from_string_with_check
(
decimal_value
,
str
->
charset
(),
str
->
ptr
(),
str
->
end
());
}
// End of String-to-number conversion methods
public:
...
...
sql/item.cc
View file @
30711c66
...
...
@@ -317,8 +317,7 @@ my_decimal *Item::val_decimal_from_string(my_decimal *decimal_value)
if
(
!
(
res
=
val_str
(
&
str_value
)))
return
0
;
return
decimal_from_string_with_check
(
decimal_value
,
res
->
charset
(),
res
->
ptr
(),
res
->
end
());
return
decimal_from_string_with_check
(
decimal_value
,
res
);
}
...
...
@@ -2955,10 +2954,7 @@ void Item_string::print(String *str, enum_query_type query_type)
double
Item_string
::
val_real
()
{
DBUG_ASSERT
(
fixed
==
1
);
return
double_from_string_with_check
(
str_value
.
charset
(),
str_value
.
ptr
(),
str_value
.
ptr
()
+
str_value
.
length
());
return
double_from_string_with_check
(
&
str_value
);
}
...
...
@@ -2969,8 +2965,7 @@ double Item_string::val_real()
longlong
Item_string
::
val_int
()
{
DBUG_ASSERT
(
fixed
==
1
);
return
longlong_from_string_with_check
(
str_value
.
charset
(),
str_value
.
ptr
(),
str_value
.
ptr
()
+
str_value
.
length
());
return
longlong_from_string_with_check
(
&
str_value
);
}
...
...
@@ -3408,10 +3403,7 @@ double Item_param::val_real()
case
STRING_VALUE
:
case
LONG_DATA_VALUE
:
{
int
dummy_err
;
char
*
end_not_used
;
return
my_strntod
(
str_value
.
charset
(),
(
char
*
)
str_value
.
ptr
(),
str_value
.
length
(),
&
end_not_used
,
&
dummy_err
);
return
double_from_string_with_check
(
&
str_value
);
}
case
TIME_VALUE
:
/*
...
...
@@ -3444,9 +3436,7 @@ longlong Item_param::val_int()
case
STRING_VALUE
:
case
LONG_DATA_VALUE
:
{
int
dummy_err
;
return
my_strntoll
(
str_value
.
charset
(),
str_value
.
ptr
(),
str_value
.
length
(),
10
,
(
char
**
)
0
,
&
dummy_err
);
return
longlong_from_string_with_check
(
&
str_value
);
}
case
TIME_VALUE
:
return
(
longlong
)
TIME_to_ulonglong
(
&
value
.
time
);
...
...
@@ -3472,8 +3462,7 @@ my_decimal *Item_param::val_decimal(my_decimal *dec)
return
dec
;
case
STRING_VALUE
:
case
LONG_DATA_VALUE
:
string2my_decimal
(
E_DEC_FATAL_ERROR
,
&
str_value
,
dec
);
return
dec
;
return
decimal_from_string_with_check
(
dec
,
&
str_value
);
case
TIME_VALUE
:
{
return
TIME_to_my_decimal
(
&
value
.
time
,
dec
);
...
...
sql/item.h
View file @
30711c66
...
...
@@ -1278,7 +1278,38 @@ public:
/*
Make sure the null_value member has a correct value.
*/
virtual
void
update_null_value
()
{
(
void
)
val_int
();
}
virtual
void
update_null_value
()
{
switch
(
cmp_type
())
{
case
INT_RESULT
:
(
void
)
val_int
();
break
;
case
REAL_RESULT
:
(
void
)
val_real
();
break
;
case
DECIMAL_RESULT
:
{
my_decimal
tmp
;
(
void
)
val_decimal
(
&
tmp
);
}
break
;
case
TIME_RESULT
:
{
MYSQL_TIME
ltime
;
(
void
)
get_temporal_with_sql_mode
(
&
ltime
);
}
break
;
case
STRING_RESULT
:
{
StringBuffer
<
MAX_FIELD_WIDTH
>
tmp
;
(
void
)
val_str
(
&
tmp
);
}
break
;
case
ROW_RESULT
:
DBUG_ASSERT
(
0
);
null_value
=
true
;
}
}
/*
Inform the item that there will be no distinction between its result
...
...
@@ -3231,18 +3262,12 @@ public:
longlong
val_int
()
{
DBUG_ASSERT
(
fixed
==
1
);
return
longlong_from_string_with_check
(
str_value
.
charset
(),
str_value
.
ptr
(),
str_value
.
ptr
()
+
str_value
.
length
());
return
longlong_from_string_with_check
(
&
str_value
);
}
double
val_real
()
{
DBUG_ASSERT
(
fixed
==
1
);
return
double_from_string_with_check
(
str_value
.
charset
(),
str_value
.
ptr
(),
str_value
.
ptr
()
+
str_value
.
length
());
return
double_from_string_with_check
(
&
str_value
);
}
my_decimal
*
val_decimal
(
my_decimal
*
decimal_value
)
{
...
...
sql/item_func.cc
View file @
30711c66
...
...
@@ -955,11 +955,8 @@ double Item_func_hybrid_result_type::val_real()
ltime
.
time_type
=
mysql_type_to_time_type
(
field_type
());
return
TIME_to_double
(
&
ltime
);
}
char
*
end_not_used
;
int
err_not_used
;
String
*
res
=
str_op
(
&
str_value
);
return
(
res
?
my_strntod
(
res
->
charset
(),
(
char
*
)
res
->
ptr
(),
res
->
length
(),
&
end_not_used
,
&
err_not_used
)
:
0.0
);
return
res
?
double_from_string_with_check
(
res
)
:
0.0
;
}
case
TIME_RESULT
:
case
ROW_RESULT
:
...
...
@@ -1000,14 +997,8 @@ longlong Item_func_hybrid_result_type::val_int()
ltime
.
time_type
=
mysql_type_to_time_type
(
field_type
());
return
TIME_to_ulonglong
(
&
ltime
);
}
int
err_not_used
;
String
*
res
;
if
(
!
(
res
=
str_op
(
&
str_value
)))
return
0
;
char
*
end
=
(
char
*
)
res
->
ptr
()
+
res
->
length
();
CHARSET_INFO
*
cs
=
res
->
charset
();
return
(
*
(
cs
->
cset
->
strtoll10
))(
cs
,
res
->
ptr
(),
&
end
,
&
err_not_used
);
String
*
res
=
str_op
(
&
str_value
);
return
res
?
longlong_from_string_with_check
(
res
)
:
0
;
}
case
TIME_RESULT
:
case
ROW_RESULT
:
...
...
@@ -1052,13 +1043,8 @@ my_decimal *Item_func_hybrid_result_type::val_decimal(my_decimal *decimal_value)
ltime
.
time_type
=
mysql_type_to_time_type
(
field_type
());
return
date2my_decimal
(
&
ltime
,
decimal_value
);
}
String
*
res
;
if
(
!
(
res
=
str_op
(
&
str_value
)))
return
NULL
;
str2my_decimal
(
E_DEC_FATAL_ERROR
,
(
char
*
)
res
->
ptr
(),
res
->
length
(),
res
->
charset
(),
decimal_value
);
break
;
String
*
res
=
str_op
(
&
str_value
);
return
res
?
decimal_from_string_with_check
(
decimal_value
,
res
)
:
0
;
}
case
ROW_RESULT
:
case
TIME_RESULT
:
...
...
@@ -5965,10 +5951,7 @@ longlong Item_func_get_system_var::val_int()
{
null_value
=
cached_null_value
;
if
(
!
null_value
)
cached_llval
=
longlong_from_string_with_check
(
cached_strval
.
charset
(),
cached_strval
.
c_ptr
(),
cached_strval
.
c_ptr
()
+
cached_strval
.
length
());
cached_llval
=
longlong_from_string_with_check
(
&
cached_strval
);
else
cached_llval
=
0
;
cache_present
|=
GET_SYS_VAR_CACHE_LONG
;
...
...
@@ -6043,10 +6026,7 @@ double Item_func_get_system_var::val_real()
{
null_value
=
cached_null_value
;
if
(
!
null_value
)
cached_dval
=
double_from_string_with_check
(
cached_strval
.
charset
(),
cached_strval
.
c_ptr
(),
cached_strval
.
c_ptr
()
+
cached_strval
.
length
());
cached_dval
=
double_from_string_with_check
(
&
cached_strval
);
else
cached_dval
=
0
;
cache_present
|=
GET_SYS_VAR_CACHE_DOUBLE
;
...
...
sql/item_geofunc.h
View file @
30711c66
...
...
@@ -41,7 +41,6 @@ public:
void
fix_length_and_dec
();
enum_field_types
field_type
()
const
{
return
MYSQL_TYPE_GEOMETRY
;
}
Field
*
tmp_table_field
(
TABLE
*
t_arg
);
bool
is_null
()
{
(
void
)
val_int
();
return
null_value
;
}
};
class
Item_func_geometry_from_text
:
public
Item_geometry_func
...
...
sql/item_strfunc.cc
View file @
30711c66
...
...
@@ -116,40 +116,27 @@ bool Item_str_func::fix_fields(THD *thd, Item **ref)
my_decimal
*
Item_str_func
::
val_decimal
(
my_decimal
*
decimal_value
)
{
DBUG_ASSERT
(
fixed
==
1
);
char
buff
[
64
];
String
*
res
,
tmp
(
buff
,
sizeof
(
buff
),
&
my_charset_bin
);
res
=
val_str
(
&
tmp
);
if
(
!
res
)
return
0
;
(
void
)
str2my_decimal
(
E_DEC_FATAL_ERROR
,
(
char
*
)
res
->
ptr
(),
res
->
length
(),
res
->
charset
(),
decimal_value
);
return
decimal_value
;
StringBuffer
<
64
>
tmp
;
String
*
res
=
val_str
(
&
tmp
);
return
res
?
decimal_from_string_with_check
(
decimal_value
,
res
)
:
0
;
}
double
Item_str_func
::
val_real
()
{
DBUG_ASSERT
(
fixed
==
1
);
int
err_not_used
;
char
*
end_not_used
,
buff
[
64
];
String
*
res
,
tmp
(
buff
,
sizeof
(
buff
),
&
my_charset_bin
);
res
=
val_str
(
&
tmp
);
return
res
?
my_strntod
(
res
->
charset
(),
(
char
*
)
res
->
ptr
(),
res
->
length
(),
&
end_not_used
,
&
err_not_used
)
:
0.0
;
StringBuffer
<
64
>
tmp
;
String
*
res
=
val_str
(
&
tmp
);
return
res
?
double_from_string_with_check
(
res
)
:
0.0
;
}
longlong
Item_str_func
::
val_int
()
{
DBUG_ASSERT
(
fixed
==
1
);
int
err
;
char
buff
[
22
];
String
*
res
,
tmp
(
buff
,
sizeof
(
buff
),
&
my_charset_bin
);
res
=
val_str
(
&
tmp
);
return
(
res
?
my_strntoll
(
res
->
charset
(),
res
->
ptr
(),
res
->
length
(),
10
,
NULL
,
&
err
)
:
(
longlong
)
0
);
StringBuffer
<
22
>
tmp
;
String
*
res
=
val_str
(
&
tmp
);
return
res
?
longlong_from_string_with_check
(
res
)
:
0
;
}
...
...
sql/item_strfunc.h
View file @
30711c66
...
...
@@ -67,6 +67,11 @@ public:
enum
Item_result
result_type
()
const
{
return
STRING_RESULT
;
}
void
left_right_max_length
();
bool
fix_fields
(
THD
*
thd
,
Item
**
ref
);
void
update_null_value
()
{
StringBuffer
<
MAX_FIELD_WIDTH
>
tmp
;
(
void
)
val_str
(
&
tmp
);
}
};
...
...
sql/item_sum.cc
View file @
30711c66
...
...
@@ -912,7 +912,7 @@ bool Aggregator_distinct::setup(THD *thd)
arg
=
item_sum
->
get_arg
(
0
);
if
(
arg
->
const_item
())
{
(
void
)
arg
->
val_int
();
(
void
)
arg
->
is_null
();
if
(
arg
->
null_value
)
always_null
=
true
;
}
...
...
sql/sql_do.cc
View file @
30711c66
...
...
@@ -32,7 +32,7 @@ bool mysql_do(THD *thd, List<Item> &values)
if
(
setup_fields
(
thd
,
0
,
values
,
MARK_COLUMNS_NONE
,
0
,
0
))
DBUG_RETURN
(
TRUE
);
while
((
value
=
li
++
))
value
->
val_int
();
(
void
)
value
->
is_null
();
free_underlaid_joins
(
thd
,
&
thd
->
lex
->
select_lex
);
if
(
thd
->
is_error
())
...
...
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