mirror of
https://github.com/MariaDB/server.git
synced 2026-05-15 19:37:16 +02:00
Bug#33798 prepared statements improperly handle large unsigned ints
The unsignedness of large integer user variables was not being properly preserved when feeded to prepared statements. This was happening because the unsigned flags wasn't being updated when converting the user variable is converted to a parameter. The solution is to copy the unsigned flag when converting the user variable to a parameter and take the unsigned flag into account when converting the integer to a string. mysql-test/r/binlog.result: Add test case result for Bug#33798 mysql-test/r/ps.result: Add test case result for Bug#33798 mysql-test/t/binlog.test: Add test case for Bug#33798 mysql-test/t/ps.test: Add test case for Bug#33798 sql/item.cc: Take the unsigned flag into account when converting the user variable.
This commit is contained in:
parent
32ae4aefe6
commit
7d98c21cdf
5 changed files with 70 additions and 1 deletions
|
|
@ -567,4 +567,19 @@ master-bin.000001 36585 Rotate 1 36629 master-bin.000002;pos=4
|
|||
drop table t1;
|
||||
set global binlog_cache_size=@bcs;
|
||||
set session autocommit = @ac;
|
||||
drop table if exists t1;
|
||||
reset master;
|
||||
create table t1 (a bigint unsigned, b bigint(20) unsigned);
|
||||
prepare stmt from "insert into t1 values (?,?)";
|
||||
set @a= 9999999999999999;
|
||||
set @b= 14632475938453979136;
|
||||
execute stmt using @a, @b;
|
||||
deallocate prepare stmt;
|
||||
drop table t1;
|
||||
show binlog events from 0;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 4 Format_desc 1 98 Server version, Binlog ver: 4
|
||||
master-bin.000001 98 Query 1 219 use `test`; create table t1 (a bigint unsigned, b bigint(20) unsigned)
|
||||
master-bin.000001 219 Query 1 343 use `test`; insert into t1 values (9999999999999999,14632475938453979136)
|
||||
master-bin.000001 343 Query 1 419 use `test`; drop table t1
|
||||
End of 5.0 tests
|
||||
|
|
|
|||
|
|
@ -1693,4 +1693,20 @@ t1 CREATE TABLE `t1` (
|
|||
`?` decimal(2,1) default NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table t1;
|
||||
drop table if exists t1;
|
||||
create table t1 (a bigint unsigned, b bigint(20) unsigned);
|
||||
prepare stmt from "insert into t1 values (?,?)";
|
||||
set @a= 9999999999999999;
|
||||
set @b= 14632475938453979136;
|
||||
insert into t1 values (@a, @b);
|
||||
select * from t1 where a = @a and b = @b;
|
||||
a b
|
||||
9999999999999999 14632475938453979136
|
||||
execute stmt using @a, @b;
|
||||
select * from t1 where a = @a and b = @b;
|
||||
a b
|
||||
9999999999999999 14632475938453979136
|
||||
9999999999999999 14632475938453979136
|
||||
deallocate prepare stmt;
|
||||
drop table t1;
|
||||
End of 5.0 tests.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue