TIP, cursor life circle

Ruslan Zasukhin sunshine at public.kherson.ua
Tue Aug 24 04:18:29 CDT 2004


On 8/24/04 12:13 AM, "Barney" <barney at custombased.com> wrote:

> Hi Ruslan,
> 
> Right OK, thanks for your time to look into this for me.
> 
> I never realised you had to kill an instance of the cursor.
> I thought that anything that is created using the Dim Statement
> within a method is automatically disposed of when that method
> is finished ?

But please look again on the your function below.

BEFORE function foo finish, you call OTHER function, you see?

So during work of setupcomp() cursor Pcur still will live. Rigth?

And I think this is not what you want.
Why it should live, eat RAM and keep record locked?

IF you will not have call setupcomp()
Then right, on finish of foo() cursor will die self.



>> Sub foo
>> 
>> Dim Pcur as VCursor
>> Dim Err as boolean
>> Dim S as string
>> 
>> S = Listbox1.cell(listbox1.listindex, 0)
>> 
>> 
>> 
>> Pcur = App.DB.SQLSelect(
>>          "Select * from componants where componant = '" + S + "'", 2,1,2)
>> 
>> If Pcur <> Nil and Pcur.RecordCount > 0 then
>>   Err = Pcur.deleteAll()
>> End if
>> 
>> setupcomp
>> end

-- 
Best regards,
Ruslan Zasukhin      [ I feel the need...the need for speed ]
-------------------------------------------------------------
e-mail: ruslan at paradigmasoft.com
web: http://www.paradigmasoft.com

To subscribe to the Valentina mail list go to:
http://lists.macserve.net/mailman/listinfo/valentina
-------------------------------------------------------------



More information about the Valentina mailing list