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
eaae1305
Commit
eaae1305
authored
Jul 24, 2021
by
Sergei Golubchik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-25808 PREPARE/EXECUTE makes signed integer out of unsigned
Closes #1844
parent
9fde2bba
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
33 additions
and
5 deletions
+33
-5
mysql-test/main/prepare.result
mysql-test/main/prepare.result
+14
-0
mysql-test/main/prepare.test
mysql-test/main/prepare.test
+12
-0
sql/item.cc
sql/item.cc
+5
-3
sql/item.h
sql/item.h
+2
-2
No files found.
mysql-test/main/prepare.result
View file @
eaae1305
...
...
@@ -50,3 +50,17 @@ t1_first
deallocate prepare stmt1;
deallocate prepare stmt2;
drop table t1;
#
# MDEV-25808 PREPARE/EXECUTE makes signed integer out of unsigned
#
prepare p1 from 'select concat(?)';
execute p1 using 17864960750176564435;
concat(?)
17864960750176564435
prepare p1 from 'select SQRT(?) is not null';
execute p1 using 17864960750176564435;
SQRT(?) is not null
1
#
# End of 10.3 tests
#
mysql-test/main/prepare.test
View file @
eaae1305
...
...
@@ -40,3 +40,15 @@ execute stmt2;
deallocate
prepare
stmt1
;
deallocate
prepare
stmt2
;
drop
table
t1
;
--
echo
#
--
echo
# MDEV-25808 PREPARE/EXECUTE makes signed integer out of unsigned
--
echo
#
prepare
p1
from
'select concat(?)'
;
execute
p1
using
17864960750176564435
;
prepare
p1
from
'select SQRT(?) is not null'
;
execute
p1
using
17864960750176564435
;
--
echo
#
--
echo
# End of 10.3 tests
--
echo
#
sql/item.cc
View file @
eaae1305
...
...
@@ -4592,13 +4592,15 @@ bool Item_param::get_date(MYSQL_TIME *res, ulonglong fuzzydate)
}
double
Item_param
::
PValue
::
val_real
()
const
double
Item_param
::
PValue
::
val_real
(
const
Type_std_attributes
*
attr
)
const
{
switch
(
type_handler
()
->
cmp_type
())
{
case
REAL_RESULT
:
return
real
;
case
INT_RESULT
:
return
(
double
)
integer
;
return
attr
->
unsigned_flag
?
(
double
)
(
ulonglong
)
integer
:
(
double
)
integer
;
case
DECIMAL_RESULT
:
{
double
result
;
...
...
@@ -4680,7 +4682,7 @@ String *Item_param::PValue::val_str(String *str,
str
->
set_real
(
real
,
NOT_FIXED_DEC
,
&
my_charset_bin
);
return
str
;
case
INT_RESULT
:
str
->
set
(
integer
,
&
my_charset_bin
);
str
->
set
_int
(
integer
,
attr
->
unsigned_flag
,
&
my_charset_bin
);
return
str
;
case
DECIMAL_RESULT
:
if
(
my_decimal2string
(
E_DEC_FATAL_ERROR
,
&
m_decimal
,
0
,
0
,
0
,
str
)
<=
1
)
...
...
sql/item.h
View file @
eaae1305
...
...
@@ -3565,7 +3565,7 @@ class Item_param :public Item_basic_value,
m_string
.
swap
(
other
.
m_string
);
m_string_ptr
.
swap
(
other
.
m_string_ptr
);
}
double
val_real
()
const
;
double
val_real
(
const
Type_std_attributes
*
attr
)
const
;
longlong
val_int
(
const
Type_std_attributes
*
attr
)
const
;
my_decimal
*
val_decimal
(
my_decimal
*
dec
,
const
Type_std_attributes
*
attr
);
String
*
val_str
(
String
*
str
,
const
Type_std_attributes
*
attr
);
...
...
@@ -3619,7 +3619,7 @@ class Item_param :public Item_basic_value,
double
val_real
()
{
return
can_return_value
()
?
value
.
val_real
()
:
0e0
;
return
can_return_value
()
?
value
.
val_real
(
this
)
:
0e0
;
}
longlong
val_int
()
{
...
...
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