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
28f28591
Commit
28f28591
authored
Aug 22, 2016
by
Alexander Barkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-10411 Providing compatibility for basic PL/SQL constructs
Part 18: WHILE syntax
parent
4212039d
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
90 additions
and
10 deletions
+90
-10
mysql-test/suite/compat/oracle/r/sp.result
mysql-test/suite/compat/oracle/r/sp.result
+42
-4
mysql-test/suite/compat/oracle/t/sp.test
mysql-test/suite/compat/oracle/t/sp.test
+46
-4
sql/sql_yacc_ora.yy
sql/sql_yacc_ora.yy
+2
-2
No files found.
mysql-test/suite/compat/oracle/r/sp.result
View file @
28f28591
...
...
@@ -98,12 +98,12 @@ DROP FUNCTION f1;
CREATE FUNCTION f1 (a INT) RETURN INT AS
BEGIN
<<label1>>
WHILE a>0
DO
WHILE a>0
LOOP
IF a = 2 THEN
LEAVE label1;
END IF;
SET a= a-1;
END
WHILE
label1;
END
LOOP
label1;
RETURN a;
END;
/
...
...
@@ -427,10 +427,10 @@ i INT DEFAULT 5;
x INT DEFAULT 10;
BEGIN
<<label>>
WHILE i > 3
DO
WHILE i > 3
LOOP
i:= i - 1;
SELECT i;
END
WHILE
label;
END
LOOP
label;
END;
END
/
...
...
@@ -736,3 +736,41 @@ SELECT @v;
@v
100
DROP PROCEDURE p1;
# Testing WHILE loop
CREATE PROCEDURE p1 (a IN OUT INT)
AS
i INT:= 1;
j INT:= 3;
BEGIN
WHILE i<=j
LOOP
a:= a + i;
i:= i + 1;
END LOOP;
END;
/
SET @v=0;
CALL p1(@v);
SELECT @v;
@v
6
DROP PROCEDURE p1;
CREATE PROCEDURE p1 (a IN OUT INT)
AS
i INT:= 1;
j INT:= 3;
BEGIN
<<label>>
WHILE i<=j
LOOP
a:= a + i;
i:= i + 1;
END LOOP label;
END;
/
SET @v=0;
CALL p1(@v);
SELECT @v;
@v
6
DROP PROCEDURE p1;
mysql-test/suite/compat/oracle/t/sp.test
View file @
28f28591
...
...
@@ -91,12 +91,12 @@ DELIMITER /;
CREATE
FUNCTION
f1
(
a
INT
)
RETURN
INT
AS
BEGIN
<<
label1
>>
WHILE
a
>
0
DO
WHILE
a
>
0
LOOP
IF
a
=
2
THEN
LEAVE
label1
;
END
IF
;
SET
a
=
a
-
1
;
END
WHILE
label1
;
END
LOOP
label1
;
RETURN
a
;
END
;
/
...
...
@@ -454,10 +454,10 @@ BEGIN NOT ATOMIC
x
INT
DEFAULT
10
;
BEGIN
<<
label
>>
WHILE
i
>
3
DO
WHILE
i
>
3
LOOP
i
:=
i
-
1
;
SELECT
i
;
END
WHILE
label
;
END
LOOP
label
;
END
;
END
/
...
...
@@ -801,3 +801,45 @@ SET @v=10;
CALL
p1
(
@
v
);
SELECT
@
v
;
DROP
PROCEDURE
p1
;
--
echo
# Testing WHILE loop
DELIMITER
/
;
CREATE
PROCEDURE
p1
(
a
IN
OUT
INT
)
AS
i
INT
:=
1
;
j
INT
:=
3
;
BEGIN
WHILE
i
<=
j
LOOP
a
:=
a
+
i
;
i
:=
i
+
1
;
END
LOOP
;
END
;
/
DELIMITER
;
/
SET
@
v
=
0
;
CALL
p1
(
@
v
);
SELECT
@
v
;
DROP
PROCEDURE
p1
;
DELIMITER
/
;
CREATE
PROCEDURE
p1
(
a
IN
OUT
INT
)
AS
i
INT
:=
1
;
j
INT
:=
3
;
BEGIN
<<
label
>>
WHILE
i
<=
j
LOOP
a
:=
a
+
i
;
i
:=
i
+
1
;
END
LOOP
label
;
END
;
/
DELIMITER
;
/
SET
@
v
=
0
;
CALL
p1
(
@
v
);
SELECT
@
v
;
DROP
PROCEDURE
p1
;
sql/sql_yacc_ora.yy
View file @
28f28591
...
...
@@ -3485,7 +3485,7 @@ loop_body:
;
while_body:
expr
DO
_SYM
expr
LOOP
_SYM
{
LEX *lex= Lex;
sp_head *sp= lex->sphead;
...
...
@@ -3501,7 +3501,7 @@ while_body:
if (sp->restore_lex(thd))
MYSQL_YYABORT;
}
sp_proc_stmts1 END
WHILE
_SYM
sp_proc_stmts1 END
LOOP
_SYM
{
LEX *lex= Lex;
uint ip= lex->sphead->instructions();
...
...
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