Utility 'TCOMPILE' (OpenInsight Specific)
At 03 JUN 1998 07:53:26AM Jeff Word wrote:
We are compiling all forms and stored procedures before deploying. After completing this process we are having some instances where a form that has worked, starts to have errors. Using the form designer, if we compile it manually then the errors go away. Is there any trick to using TCOMPILE? Any advice?
At 04 JUN 1998 11:04AM Cameron Revelation wrote:
Jeff,
We are compiling all forms and stored procedures before deploying. After completing this process we are having some instances where a form that has worked, starts to have errors. Using the form designer, if we compile it manually then the errors go away. Is there any trick to using TCOMPILE?
If you don't mind, could you post the code you use to call TCOMPILE?
Cameron Purdy
info@revelation.com
At 04 JUN 1998 02:31PM Jeff Word wrote:
This is just the gosub
<code> Compile_All: Printer On Declare Function Get_Repos_Entities App=@APPID ;* current application Class=' ;* Not Applicable GetFlags=True Expand=1 ;* 0 means entityname, 1 means app*type*class*entity Remote=0 List=' Cnt=0 ConditionalCompile=False Compiled=0 Total=0 For H=1 to 2 MoreInfo=' If H=1 then * Stored Procedures Type=STPROC' Method=COMPILE' End else * Windows and their scripts Type=OIWIN' Method=TCOMPILE' End Loop List=Get_Repos_Entities(App,Type,Class,GetFlags,Expand,Remote,MoreInfo) * compile repository entities ListCnt=Count(List,@fm) + (List ne '') For I=1 to ListCnt EntId=List Entity=Field( EntId, '*', 4 ) * check component If Entity1,3=CompPrefix:'_' then X=Set_Status(0) Call Repository( Method, EntId, ConditionalCompile ) If Get_Status(ErrCode) then Print EntId:' - ':ErrCode End else Compiled += 1 End Total += 1 End Next I Print 'Total of ':Total:' entities. ':Compiled:' compiled.' While Len(MoreInfo) Repeat Next H Printer Off Return</code>
At 04 JUN 1998 03:55PM Gene Gleyzer Revelation wrote:
Jeff,
here is a couple of notes regarding your code:
1) You have lines like:
GetFlags=TrueConditionalCompile=FalseI guess that True and False are defined somewhere above...2) FormDesigner call "TCOMPILE" with ConditionalCompile set to TRUE. You are calling it with ConditionalCompile set to 0 (or unassigned, which is the same) that could have an adverse effect if there are orphan refernces…
3) You should place the call
Set_Status(0)right after
if Get_Status() thento reset status. The way it's written now, it's possible that you leave the "for" loop with the status set, which, in turn, can cause the Get_Repos_Entities call to fail…
Hope this helps,
Gene
At 05 JUN 1998 05:28AM Oystein Reigem wrote:
Gene,
3) You should place the call Set_Status(0) right after if Get_Status() then to reset status. The way it's written now, it's possible that you leave the "for" loop with the status set, which, in turn, can cause the Get_Repos_Entities call to fail…
That's interesting. And worrisome for us who don't know these details and rely on the documentation to get our programming straight…
I know one should surround system routine calls with calls to Set_Status(0) and Get_Status(status_code) to catch possible errors. I do that often in my programming, but not always. Sometimes there are other ways to discover if an error occurred, and for some calls the error will never be critical and can be ignored. So I might produce code like
Set_Status(0)if Get_Status() then ... endwhere a first system call is surrounded but the second one not. According to you the second system call might fail if the first one fails because of the status set by Get_Status. Of course often in a real program the failure of the first one makes it meaningless to execute the second one, so one might get away with this kind of programming. But from now on I'll certainly surround my system calls in the more foolproof way
Set_Status(0)if Get_Status() then ...Set_Status(0)One important question: How long does the status from Get_Status() linger? Until the procedure where it's been called is finished? Until the whole handler or program is finished? Even longer?
- Oystein -
At 08 JUN 1998 04:03PM Gene Gleyzer wrote:
Oystein,
the status is not reset until the whole handler or program is finished (or someone calls set_status(0)).