Do select always mystify me in application engine . Today I did a small test to understand who it really work . This hands one need a small project in app designer
1. TEST record ( It has three rows)
2.TEST_AET
3.PS_AE Application engine :It will have a Do-Select statement and a subsequent Peoplecode
%Select (BUSINESS_UNIT )
SELECT BUSINESS_UNIT
FROM PS_TEST
Peoplecode :
Local File &myfile;
&myfile = GetFile("testfile.log", "a", %FilePath_Relative);
&myfile.WriteLine(" my name is ");
A) First I made it reselect .
What would be output : Yes it will go infine because reslect always open a new cursor every time . So after 10 min u will have a huge file and u need to kill the file . Now change the code
%Select (BUSINESS_UNIT )
SELECT BUSINESS_UNIT
FROM PS_TEST
where business_unit <> ' '
Local File &myfile;
&myfile = GetFile("testfile.log", "a", %FilePath_Relative);
&myfile.WriteLine(" my name is ");
SQLExec(" UPDATE PS_TEST SET BUSINESS_UNIT =' ' ");
I didnot put any exclusive commit and commit level was default . bingo it did work as charm .
B) Made it restartable
%Select (BUSINESS_UNIT )
SELECT BUSINESS_UNIT
FROM PS_TEST
Peoplecode :
Local File &myfile;
&myfile = GetFile("testfile.log", "a", %FilePath_Relative);
&myfile.WriteLine(" my name is ");
bingo it had only one line , because in restartable it keep same cursor for a long time .
and in last but not least
select fetch ... it is like restartable but no commit work in between ... ,
Thursday, March 11, 2010
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment