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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
b8153269
Commit
b8153269
authored
Jun 17, 2012
by
Sergei Golubchik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix an overly agressive optimization in Item_func_conv_charset
parent
6cf8672f
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
43 additions
and
4 deletions
+43
-4
mysql-test/r/mdev316.result
mysql-test/r/mdev316.result
+15
-0
mysql-test/t/mdev316.test
mysql-test/t/mdev316.test
+8
-0
sql/item_strfunc.h
sql/item_strfunc.h
+20
-4
No files found.
mysql-test/r/mdev316.result
View file @
b8153269
...
...
@@ -5,3 +5,18 @@ select '' in ('',convert(0,time));
select case '' when '' then 1 when convert(0,time) then 2 end;
case '' when '' then 1 when convert(0,time) then 2 end
1
select convert(0x0030 using ucs2) div 1, concat(convert(0x0030 using ucs2)) div 1;
convert(0x0030 using ucs2) div 1 concat(convert(0x0030 using ucs2)) div 1
0 0
select cast(convert(0x0030 using ucs2) as double), cast(concat(convert(0x0030 using ucs2)) as double);
cast(convert(0x0030 using ucs2) as double) cast(concat(convert(0x0030 using ucs2)) as double)
0 0
select cast(convert(0x0030 using ucs2) as decimal(5.2)), cast(concat(convert(0x0030 using ucs2)) as decimal(5.2));
cast(convert(0x0030 using ucs2) as decimal(5.2)) cast(concat(convert(0x0030 using ucs2)) as decimal(5.2))
0 0
select cast(convert(_ucs2 0x0030 using latin1) as date), cast(concat(convert(_ucs2 0x0030 using latin1)) as date);
cast(convert(_ucs2 0x0030 using latin1) as date) cast(concat(convert(_ucs2 0x0030 using latin1)) as date)
NULL NULL
Warnings:
Warning 1292 Incorrect datetime value: '0'
Warning 1292 Incorrect datetime value: '0'
mysql-test/t/mdev316.test
View file @
b8153269
...
...
@@ -4,3 +4,11 @@
set
names
swe7
;
select
''
in
(
''
,
convert
(
0
,
time
));
select
case
''
when
''
then
1
when
convert
(
0
,
time
)
then
2
end
;
#
# Excessive optimization of Item_func_conv_charset:
#
select
convert
(
0x0030
using
ucs2
)
div
1
,
concat
(
convert
(
0x0030
using
ucs2
))
div
1
;
select
cast
(
convert
(
0x0030
using
ucs2
)
as
double
),
cast
(
concat
(
convert
(
0x0030
using
ucs2
))
as
double
);
select
cast
(
convert
(
0x0030
using
ucs2
)
as
decimal
(
5.2
)),
cast
(
concat
(
convert
(
0x0030
using
ucs2
))
as
decimal
(
5.2
));
select
cast
(
convert
(
_ucs2
0x0030
using
latin1
)
as
date
),
cast
(
concat
(
convert
(
_ucs2
0x0030
using
latin1
))
as
date
);
sql/item_strfunc.h
View file @
b8153269
...
...
@@ -855,13 +855,29 @@ class Item_func_conv_charset :public Item_str_func
}
String
*
val_str
(
String
*
);
longlong
val_int
()
{
return
args
[
0
]
->
val_int
();
}
{
if
(
args
[
0
]
->
result_type
()
==
STRING_RESULT
)
return
Item_str_func
::
val_int
();
return
args
[
0
]
->
val_int
();
}
double
val_real
()
{
return
args
[
0
]
->
val_real
();
}
{
if
(
args
[
0
]
->
result_type
()
==
STRING_RESULT
)
return
Item_str_func
::
val_real
();
return
args
[
0
]
->
val_real
();
}
my_decimal
*
val_decimal
(
my_decimal
*
d
)
{
return
args
[
0
]
->
val_decimal
(
d
);
}
{
if
(
args
[
0
]
->
result_type
()
==
STRING_RESULT
)
return
Item_str_func
::
val_decimal
(
d
);
return
args
[
0
]
->
val_decimal
(
d
);
}
bool
get_date
(
MYSQL_TIME
*
ltime
,
ulonglong
fuzzydate
)
{
return
args
[
0
]
->
get_date
(
ltime
,
fuzzydate
);
}
{
if
(
args
[
0
]
->
result_type
()
==
STRING_RESULT
)
return
Item_str_func
::
get_date
(
ltime
,
fuzzydate
);
return
args
[
0
]
->
get_date
(
ltime
,
fuzzydate
);
}
void
fix_length_and_dec
();
const
char
*
func_name
()
const
{
return
"convert"
;
}
virtual
void
print
(
String
*
str
,
enum_query_type
query_type
);
...
...
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