OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
Re: AW: Uninitialized local variables in triggers

From: Alexey Gaidukov (gaiddc.baikal.ru)
Date: Wed Aug 10 2005 - 20:06:22 CDT


7.6.00.12 has the same behaviour.

Zabach, Elke пишет:

>Alexey Gaidukov wrote:
>
>
>>test case for resource user TTT
>>
>>CREATE TABLE "TTT"."TEST"
>>(
>> ID Integer NOT NULL,
>> FAM Varchar (20) UNICODE NOT NULL,
>> NAME Varchar (20) UNICODE NOT NULL,
>> COMMENTS Varchar (1000) UNICODE,
>> PRIMARY KEY ("ID")
>>)
>>
>>//
>>
>>CREATE TABLE "TTT"."TEST_LOG"
>>(
>> ID Integer NOT NULL,
>> OS_USER Varchar (50) UNICODE NOT NULL,
>> TERMINAL Varchar (50) UNICODE,
>> UPDATED Timestamp NOT NULL,
>> TYPE_ACTION Varchar (2) UNICODE NOT NULL,
>> TEST_ID Integer NOT NULL,
>> COMMENTS Varchar (1000) UNICODE,
>> PRIMARY KEY ("ID")
>>)
>>
>>//
>>ALTER TABLE "TTT"."TEST_LOG" COLUMN "ID" ADD DEFAULT SERIAL(1)
>>//
>>CREATE TRIGGER TEST_U FOR "TTT"."TEST" AFTER UPDATE EXECUTE (
>>VAR
>> com varchar(1000);
>> terminal varchar(50);
>>BEGIN
>> TRY
>> SET com = 'F-'||new.fam||',И-'||new.name;
>> INSERT INTO ttt.test_log
>>(test_id,os_user,terminal,updated,type_action)
>> values (
>> :new.id,
>> USER,
>> :terminal,
>> timestamp,
>> 'U');
>> CATCH
>> STOP ($rc, $errmsg);
>>END;
>>)
>>//
>>insert into ttt.test(id,fam,name) values (1,'f','n')
>>//
>>update ttt.test set fam='nf' where id=1
>>//
>>update ttt.test set fam='nf1' where id=1
>>//
>>update ttt.test set fam='nf2' where id=1
>>
>>
>>
>>
>>
>>In the tigger TEST_U local variable 'terminal' is uninitialized. In the
>>field TEST_LOG.TERMINAL will be garbage.
>>For example
>>???)
>>????????
>>
>>MaxDB 7.6.00.10 and 7.6.00.14 (18.07.2005) were tested.
>>
>>
>
>Where is the problem?
>As with many programming languages no internally initialization is done for local variables. It is up to the user/programmer to set these variables to the values wanted.
>
>What do you want us to say with this example working as I (and I think many others) would expect it?
>
>Elke
>SAP Labs Berlin
>
>
>
>>--
>>MaxDB Discussion Mailing List
>>For list archives: http://lists.mysql.com/maxdb
>>To unsubscribe: http://lists.mysql.com/maxdb?unsub=elke.zabachsap.com
>>
>>
>
>
>
>

--
MaxDB Discussion Mailing List
For list archives: http://lists.mysql.com/maxdb