mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
A fix and test case for Bug#6297 "prepared statement, wrong handling
of <parameter> IS NULL": we must not only set Item::null_value in Item_param, but implement Item_param::is_null() to work well with IS NULL/IS NOT NULL clauses. mysql-test/r/ps.result: Test case for Bug#6297: test results fixed. mysql-test/t/ps.test: A test case for Bug#6297 "prepared statement, wrong handling of <parameter> IS NULL" sql/item.h: A fix for Bug#6297: we must not only set null_value in Item_param, but also implement Item_param::is_null() to work well with IS NULL/ IS NOT NULL. Item::is_null() commented.
This commit is contained in:
@ -450,3 +450,24 @@ PREPARE stmt FROM 'UPDATE t1 AS P1 INNER JOIN (SELECT N FROM t1 GROUP BY N HAVIN
|
||||
EXECUTE stmt;
|
||||
DEALLOCATE PREPARE stmt;
|
||||
DROP TABLE t1;
|
||||
prepare stmt from "select ? is null, ? is not null, ?";
|
||||
select @no_such_var is null, @no_such_var is not null, @no_such_var;
|
||||
@no_such_var is null @no_such_var is not null @no_such_var
|
||||
1 0 NULL
|
||||
execute stmt using @no_such_var, @no_such_var, @no_such_var;
|
||||
? is null ? is not null ?
|
||||
1 0 NULL
|
||||
set @var='abc';
|
||||
select @var is null, @var is not null, @var;
|
||||
@var is null @var is not null @var
|
||||
0 1 abc
|
||||
execute stmt using @var, @var, @var;
|
||||
? is null ? is not null ?
|
||||
0 1 abc
|
||||
set @var=null;
|
||||
select @var is null, @var is not null, @var;
|
||||
@var is null @var is not null @var
|
||||
1 0 NULL
|
||||
execute stmt using @var, @var, @var;
|
||||
? is null ? is not null ?
|
||||
1 0 NULL
|
||||
|
Reference in New Issue
Block a user