1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

Implemented DEFAULT for DECLARE variables.

BitKeeper/etc/logging_ok:
  Logging to logging@openlogging.org accepted
This commit is contained in:
unknown
2003-03-30 13:25:43 +02:00
parent 771237ce30
commit cc0f1f15cd
4 changed files with 32 additions and 24 deletions

View File

@ -117,8 +117,7 @@ drop procedure inc2;
drop procedure inc;
create procedure cbv1()
begin
declare y int;
set y = 3;
declare y int default 3;
call cbv2(y+1, y);
insert into test.t1 values ("cbv1", y);
end;
@ -354,8 +353,7 @@ append("foo", "bar")
foobar
create function fac(n int unsigned) returns bigint unsigned
begin
declare f bigint unsigned;
set f = 1;
declare f bigint unsigned default 1;
while n > 1 do
set f = f * n;
set n = n - 1;
@ -396,8 +394,7 @@ drop table if exists fac;
create table fac (n int unsigned not null primary key, f bigint unsigned);
create procedure ifac(n int unsigned)
begin
declare i int unsigned;
set i = 1;
declare i int unsigned default 1;
if n > 20 then
set n = 20; # bigint overflow otherwise
end if;
@ -452,8 +449,7 @@ insert into primes values
create procedure opp(n bigint unsigned, out pp bool)
begin
declare r double;
declare b, s bigint unsigned;
set b = 0, s = 0;
declare b, s bigint unsigned default 0;
set r = sqrt(n);
again:
loop
@ -483,8 +479,7 @@ declare i int unsigned;
set i=45, p=201;
while i < m do
begin
declare pp bool;
set pp = 0;
declare pp bool default 0;
call opp(p, pp);
if pp then
insert into test.primes values (i, p);

View File

@ -153,9 +153,8 @@ drop procedure inc|
# ("cbv1", 4711)
create procedure cbv1()
begin
declare y int;
declare y int default 3;
set y = 3;
call cbv2(y+1, y);
insert into test.t1 values ("cbv1", y);
end|
@ -428,9 +427,8 @@ select append("foo", "bar")|
# A function with flow control
create function fac(n int unsigned) returns bigint unsigned
begin
declare f bigint unsigned;
declare f bigint unsigned default 1;
set f = 1;
while n > 1 do
set f = f * n;
set n = n - 1;
@ -479,8 +477,8 @@ create table fac (n int unsigned not null primary key, f bigint unsigned)|
create procedure ifac(n int unsigned)
begin
declare i int unsigned;
set i = 1;
declare i int unsigned default 1;
if n > 20 then
set n = 20; # bigint overflow otherwise
end if;
@ -524,9 +522,8 @@ insert into primes values
create procedure opp(n bigint unsigned, out pp bool)
begin
declare r double;
declare b, s bigint unsigned;
declare b, s bigint unsigned default 0;
set b = 0, s = 0;
set r = sqrt(n);
again:
@ -561,9 +558,8 @@ begin
while i < m do
begin
declare pp bool;
declare pp bool default 0;
set pp = 0;
call opp(p, pp);
if pp then
insert into test.primes values (i, p);