Jump to content

Recommended Posts

Posted

Hello Friends,

 

I want to confirm this :

 

When you create an Object wich pilot a long CRUD transaction :

 

My_Object:=TMyClass.Create

Try

//************

//1. Sending properties

 

My_Object.F1:=xxx;

My_Object.F2:=yyy;

...

 

//2. Executing Methods

My_Object.DoSomething;

 

//***********

 

Finally

My_Object.Free

end;

 

 

DoSomething is a long SQL transaction (3-10 sec). Without DCallBack messages !

 

In my tests (local Desktop) all is OK (Unigui 1260);

and My_Object is Free after my long transaction ends. This is a correct behavior (as VCL)

And very important, otherwise, DoSomething could'nt work properly.

 

What i want to confirm : is there a risk, on a VPS in hight production,

that my object Free before ending transaction ?

(Manipulating threads ?!) :blink2:

 

Farshad; For beautiful code, I don't want to Create it on Form.Create and Free it on Destroy Form.

 

Related Topic :

http://forums.unigui.com/index.php?/topic/5559-houstonwe-have-a-problem/&do=findComment&comment=28426

 

Thank you...

Posted

"Finally" section will be always executed, so don't worry.

However you might consider changing to use DB stored procedures in such cases, it is a better practice.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...