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
6cde77e1
Commit
6cde77e1
authored
Feb 06, 2007
by
malff/marcsql@weblab.(none)
Browse files
Options
Browse Files
Download
Plain Diff
Merge weblab.(none):/home/marcsql/TREE/mysql-5.0-12976_b
into weblab.(none):/home/marcsql/TREE/mysql-5.1-12976-merge
parents
5dc4f103
b5f8b636
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
115 additions
and
14 deletions
+115
-14
mysql-test/r/sp-vars.result
mysql-test/r/sp-vars.result
+55
-7
mysql-test/t/sp-vars.test
mysql-test/t/sp-vars.test
+58
-7
sql/sp_head.cc
sql/sp_head.cc
+2
-0
No files found.
mysql-test/r/sp-vars.result
View file @
6cde77e1
...
...
@@ -431,17 +431,17 @@ SELECT HEX(v10);
END|
CALL p1();
HEX(v1)
0
1
1
HEX(v2)
0
0
0
HEX(v3)
0
5
5
HEX(v4)
5555555555555555
HEX(v5)
0
7
7
HEX(v6)
000000000000000
5
5
HEX(v7)
80
HEX(v8)
...
...
@@ -748,12 +748,60 @@ HEX(b) b = 0 b = FALSE b IS FALSE b = 1 b = TRUE b IS TRUE
1 0 0 0 1 1 1
call p2();
HEX(vb) vb = 0 vb = FALSE vb IS FALSE vb = 1 vb = TRUE vb IS TRUE
0
0
1 1 1 0 0 0
0 1 1 1 0 0 0
HEX(vb) vb = 0 vb = FALSE vb IS FALSE vb = 1 vb = TRUE vb IS TRUE
01 0 0 1 1 1 0
1 0 0 0 1 1 1
DROP TABLE t1;
DROP PROCEDURE p1;
DROP PROCEDURE p2;
DROP TABLE IF EXISTS table_12976_a;
DROP TABLE IF EXISTS table_12976_b;
DROP PROCEDURE IF EXISTS proc_12976_a;
DROP PROCEDURE IF EXISTS proc_12976_b;
CREATE TABLE table_12976_a (val bit(1));
CREATE TABLE table_12976_b(
appname varchar(15),
emailperm bit not null default 1,
phoneperm bit not null default 0);
insert into table_12976_b values ('A', b'1', b'1'), ('B', b'0', b'0');
CREATE PROCEDURE proc_12976_a()
BEGIN
declare localvar bit(1);
SELECT val INTO localvar FROM table_12976_a;
SELECT coalesce(localvar, 1)+1, coalesce(val, 1)+1 FROM table_12976_a;
END||
CREATE PROCEDURE proc_12976_b(
name varchar(15),
out ep bit,
out msg varchar(10))
BEGIN
SELECT emailperm into ep FROM table_12976_b where (appname = name);
IF ep is true THEN
SET msg = 'True';
ELSE
SET msg = 'False';
END IF;
END||
INSERT table_12976_a VALUES (0);
call proc_12976_a();
coalesce(localvar, 1)+1 coalesce(val, 1)+1
1 1
UPDATE table_12976_a set val=1;
call proc_12976_a();
coalesce(localvar, 1)+1 coalesce(val, 1)+1
2 2
call proc_12976_b('A', @ep, @msg);
select @ep, @msg;
@ep @msg
1 True
call proc_12976_b('B', @ep, @msg);
select @ep, @msg;
@ep @msg
0 False
DROP TABLE table_12976_a;
DROP TABLE table_12976_b;
DROP PROCEDURE proc_12976_a;
DROP PROCEDURE proc_12976_b;
---------------------------------------------------------------
BUG#9572
...
...
mysql-test/t/sp-vars.test
View file @
6cde77e1
...
...
@@ -500,8 +500,6 @@ DROP PROCEDURE p1;
#
# Test case for BUG#12976: Boolean values reversed in stored procedures?
#
# TODO: test case failed.
#
###########################################################################
--
echo
...
...
@@ -566,13 +564,8 @@ BEGIN
END
|
delimiter
;
|
# The expected and correct result.
call
p1
();
# The wrong result. Note that only hex(vb) works, but is printed with two
# digits for some reason in this case.
call
p2
();
#
...
...
@@ -583,6 +576,64 @@ DROP TABLE t1;
DROP
PROCEDURE
p1
;
DROP
PROCEDURE
p2
;
# Additional tests for Bug#12976
--
disable_warnings
DROP
TABLE
IF
EXISTS
table_12976_a
;
DROP
TABLE
IF
EXISTS
table_12976_b
;
DROP
PROCEDURE
IF
EXISTS
proc_12976_a
;
DROP
PROCEDURE
IF
EXISTS
proc_12976_b
;
--
enable_warnings
CREATE
TABLE
table_12976_a
(
val
bit
(
1
));
CREATE
TABLE
table_12976_b
(
appname
varchar
(
15
),
emailperm
bit
not
null
default
1
,
phoneperm
bit
not
null
default
0
);
insert
into
table_12976_b
values
(
'A'
,
b
'1'
,
b
'1'
),
(
'B'
,
b
'0'
,
b
'0'
);
delimiter
||
;
CREATE
PROCEDURE
proc_12976_a
()
BEGIN
declare
localvar
bit
(
1
);
SELECT
val
INTO
localvar
FROM
table_12976_a
;
SELECT
coalesce
(
localvar
,
1
)
+
1
,
coalesce
(
val
,
1
)
+
1
FROM
table_12976_a
;
END
||
CREATE
PROCEDURE
proc_12976_b
(
name
varchar
(
15
),
out
ep
bit
,
out
msg
varchar
(
10
))
BEGIN
SELECT
emailperm
into
ep
FROM
table_12976_b
where
(
appname
=
name
);
IF
ep
is
true
THEN
SET
msg
=
'True'
;
ELSE
SET
msg
=
'False'
;
END
IF
;
END
||
delimiter
;
||
INSERT
table_12976_a
VALUES
(
0
);
call
proc_12976_a
();
UPDATE
table_12976_a
set
val
=
1
;
call
proc_12976_a
();
call
proc_12976_b
(
'A'
,
@
ep
,
@
msg
);
select
@
ep
,
@
msg
;
call
proc_12976_b
(
'B'
,
@
ep
,
@
msg
);
select
@
ep
,
@
msg
;
DROP
TABLE
table_12976_a
;
DROP
TABLE
table_12976_b
;
DROP
PROCEDURE
proc_12976_a
;
DROP
PROCEDURE
proc_12976_b
;
###########################################################################
#
# Test case for BUG#9572: Stored procedures: variable type declarations
...
...
sql/sp_head.cc
View file @
6cde77e1
...
...
@@ -36,6 +36,7 @@ Item_result
sp_map_result_type
(
enum
enum_field_types
type
)
{
switch
(
type
)
{
case
MYSQL_TYPE_BIT
:
case
MYSQL_TYPE_TINY
:
case
MYSQL_TYPE_SHORT
:
case
MYSQL_TYPE_LONG
:
...
...
@@ -58,6 +59,7 @@ Item::Type
sp_map_item_type
(
enum
enum_field_types
type
)
{
switch
(
type
)
{
case
MYSQL_TYPE_BIT
:
case
MYSQL_TYPE_TINY
:
case
MYSQL_TYPE_SHORT
:
case
MYSQL_TYPE_LONG
:
...
...
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