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
cc0f1f15
Commit
cc0f1f15
authored
Mar 30, 2003
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implemented DEFAULT for DECLARE variables.
BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
parent
771237ce
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
32 additions
and
24 deletions
+32
-24
BitKeeper/etc/logging_ok
BitKeeper/etc/logging_ok
+1
-0
mysql-test/r/sp.result
mysql-test/r/sp.result
+5
-10
mysql-test/t/sp.test
mysql-test/t/sp.test
+6
-10
sql/sql_yacc.yy
sql/sql_yacc.yy
+20
-4
No files found.
BitKeeper/etc/logging_ok
View file @
cc0f1f15
...
@@ -72,6 +72,7 @@ papa@gbichot.local
...
@@ -72,6 +72,7 @@ papa@gbichot.local
paul@central.snake.net
paul@central.snake.net
paul@teton.kitebird.com
paul@teton.kitebird.com
pem@mysql.com
pem@mysql.com
pem@per-erik-martins-dator.local
peter@linux.local
peter@linux.local
peter@mysql.com
peter@mysql.com
pgulutzan@linux.local
pgulutzan@linux.local
...
...
mysql-test/r/sp.result
View file @
cc0f1f15
...
@@ -117,8 +117,7 @@ drop procedure inc2;
...
@@ -117,8 +117,7 @@ drop procedure inc2;
drop procedure inc;
drop procedure inc;
create procedure cbv1()
create procedure cbv1()
begin
begin
declare y int;
declare y int default 3;
set y = 3;
call cbv2(y+1, y);
call cbv2(y+1, y);
insert into test.t1 values ("cbv1", y);
insert into test.t1 values ("cbv1", y);
end;
end;
...
@@ -354,8 +353,7 @@ append("foo", "bar")
...
@@ -354,8 +353,7 @@ append("foo", "bar")
foobar
foobar
create function fac(n int unsigned) returns bigint unsigned
create function fac(n int unsigned) returns bigint unsigned
begin
begin
declare f bigint unsigned;
declare f bigint unsigned default 1;
set f = 1;
while n > 1 do
while n > 1 do
set f = f * n;
set f = f * n;
set n = n - 1;
set n = n - 1;
...
@@ -396,8 +394,7 @@ drop table if exists fac;
...
@@ -396,8 +394,7 @@ drop table if exists fac;
create table fac (n int unsigned not null primary key, f bigint unsigned);
create table fac (n int unsigned not null primary key, f bigint unsigned);
create procedure ifac(n int unsigned)
create procedure ifac(n int unsigned)
begin
begin
declare i int unsigned;
declare i int unsigned default 1;
set i = 1;
if n > 20 then
if n > 20 then
set n = 20; # bigint overflow otherwise
set n = 20; # bigint overflow otherwise
end if;
end if;
...
@@ -452,8 +449,7 @@ insert into primes values
...
@@ -452,8 +449,7 @@ insert into primes values
create procedure opp(n bigint unsigned, out pp bool)
create procedure opp(n bigint unsigned, out pp bool)
begin
begin
declare r double;
declare r double;
declare b, s bigint unsigned;
declare b, s bigint unsigned default 0;
set b = 0, s = 0;
set r = sqrt(n);
set r = sqrt(n);
again:
again:
loop
loop
...
@@ -483,8 +479,7 @@ declare i int unsigned;
...
@@ -483,8 +479,7 @@ declare i int unsigned;
set i=45, p=201;
set i=45, p=201;
while i < m do
while i < m do
begin
begin
declare pp bool;
declare pp bool default 0;
set pp = 0;
call opp(p, pp);
call opp(p, pp);
if pp then
if pp then
insert into test.primes values (i, p);
insert into test.primes values (i, p);
...
...
mysql-test/t/sp.test
View file @
cc0f1f15
...
@@ -153,9 +153,8 @@ drop procedure inc|
...
@@ -153,9 +153,8 @@ drop procedure inc|
# ("cbv1", 4711)
# ("cbv1", 4711)
create
procedure
cbv1
()
create
procedure
cbv1
()
begin
begin
declare
y
int
;
declare
y
int
default
3
;
set
y
=
3
;
call
cbv2
(
y
+
1
,
y
);
call
cbv2
(
y
+
1
,
y
);
insert
into
test
.
t1
values
(
"cbv1"
,
y
);
insert
into
test
.
t1
values
(
"cbv1"
,
y
);
end
|
end
|
...
@@ -428,9 +427,8 @@ select append("foo", "bar")|
...
@@ -428,9 +427,8 @@ select append("foo", "bar")|
# A function with flow control
# A function with flow control
create
function
fac
(
n
int
unsigned
)
returns
bigint
unsigned
create
function
fac
(
n
int
unsigned
)
returns
bigint
unsigned
begin
begin
declare
f
bigint
unsigned
;
declare
f
bigint
unsigned
default
1
;
set
f
=
1
;
while
n
>
1
do
while
n
>
1
do
set
f
=
f
*
n
;
set
f
=
f
*
n
;
set
n
=
n
-
1
;
set
n
=
n
-
1
;
...
@@ -479,8 +477,8 @@ create table fac (n int unsigned not null primary key, f bigint unsigned)|
...
@@ -479,8 +477,8 @@ create table fac (n int unsigned not null primary key, f bigint unsigned)|
create
procedure
ifac
(
n
int
unsigned
)
create
procedure
ifac
(
n
int
unsigned
)
begin
begin
declare
i
int
unsigned
;
declare
i
int
unsigned
default
1
;
set
i
=
1
;
if
n
>
20
then
if
n
>
20
then
set
n
=
20
;
# bigint overflow otherwise
set
n
=
20
;
# bigint overflow otherwise
end
if
;
end
if
;
...
@@ -524,9 +522,8 @@ insert into primes values
...
@@ -524,9 +522,8 @@ insert into primes values
create
procedure
opp
(
n
bigint
unsigned
,
out
pp
bool
)
create
procedure
opp
(
n
bigint
unsigned
,
out
pp
bool
)
begin
begin
declare
r
double
;
declare
r
double
;
declare
b
,
s
bigint
unsigned
;
declare
b
,
s
bigint
unsigned
default
0
;
set
b
=
0
,
s
=
0
;
set
r
=
sqrt
(
n
);
set
r
=
sqrt
(
n
);
again
:
again
:
...
@@ -561,9 +558,8 @@ begin
...
@@ -561,9 +558,8 @@ begin
while
i
<
m
do
while
i
<
m
do
begin
begin
declare
pp
bool
;
declare
pp
bool
default
0
;
set
pp
=
0
;
call
opp
(
p
,
pp
);
call
opp
(
p
,
pp
);
if
pp
then
if
pp
then
insert
into
test
.
primes
values
(
i
,
p
);
insert
into
test
.
primes
values
(
i
,
p
);
...
...
sql/sql_yacc.yy
View file @
cc0f1f15
...
@@ -622,7 +622,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
...
@@ -622,7 +622,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
table_wild opt_pad no_in_expr expr_expr simple_expr no_and_expr
table_wild opt_pad no_in_expr expr_expr simple_expr no_and_expr
using_list expr_or_default set_expr_or_default interval_expr
using_list expr_or_default set_expr_or_default interval_expr
param_marker singlerow_subselect singlerow_subselect_init
param_marker singlerow_subselect singlerow_subselect_init
exists_subselect exists_subselect_init
exists_subselect exists_subselect_init
sp_opt_default
%type <item_list>
%type <item_list>
expr_list udf_expr_list when_list ident_list ident_list_arg
expr_list udf_expr_list when_list ident_list ident_list_arg
...
@@ -1082,15 +1082,26 @@ sp_decls:
...
@@ -1082,15 +1082,26 @@ sp_decls:
;
;
sp_decl:
sp_decl:
DECLARE_SYM sp_decl_idents type
DECLARE_SYM sp_decl_idents type
sp_opt_default
{
{
LEX *lex= Lex;
LEX *lex= Lex;
uint max= lex->spcont->current_framesize();
uint max= lex->spcont->current_framesize();
enum enum_field_types type= (enum enum_field_types)$3;
Item *it= $4;
for (uint i = max-$2 ; i < max ; i++)
for (uint i = max-$2 ; i < max ; i++)
{
{
lex->spcont->set_type(i, (enum enum_field_types)$3);
lex->spcont->set_type(i, type);
lex->spcont->set_isset(i, FALSE);
if (! it)
lex->spcont->set_isset(i, FALSE);
else
{
sp_instr_set *in= new sp_instr_set(lex->sphead->instructions(),
i, it, type);
lex->sphead->add_instr(in);
lex->spcont->set_isset(i, TRUE);
}
}
}
$$= $2;
$$= $2;
}
}
...
@@ -1109,6 +1120,11 @@ sp_decl_idents:
...
@@ -1109,6 +1120,11 @@ sp_decl_idents:
}
}
;
;
sp_opt_default:
/* Empty */ { $$ = NULL; }
| DEFAULT expr { $$ = $2; }
;
sp_proc_stmt:
sp_proc_stmt:
{
{
Lex->sphead->reset_lex(YYTHD);
Lex->sphead->reset_lex(YYTHD);
...
...
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