Problems with V4RB have me beat.

Ruslan Zasukhin sunshine at public.kherson.ua
Tue Aug 24 03:58:39 CDT 2004


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

>> Hi Barney,
>> 
>> Look on this your code
>> 
>> 
>>   //Edges W1
>>   cur1 = app.db.SqlSelect( "select * from Componants WHERE Componant = '"
>> + Cs(Loop1) + "' AND tag = 'Edges X' " )  // Should only be the present
>> working module in there anyway.
>>   Cur2.field("Edges_X").setstring( DataOrResult(cur1) )
>>   
>>   
>>   //Edges W2
>>   cur1 = app.db.SqlSelect( "select * from Componants WHERE Componant = '"
>> + Cs(Loop1) + "' AND tag = 'Edges X2' " )  // Should only be the present
>> working module in there anyway.
>>   Cur2.field("Edges_X2").setstring( DataOrResult(cur1) )
>>   
>> 
>> ---------------------
>> It can be danger and cause problems because you DO NOT kill curs1
>> But assign to it new instance.
> 
> OK, I imagined that when you assign a new SQLSelect statement to a
> cursor, it just automatically overwrites what ever the cursor previously
> contained.

Right.

But the first object die AFTER-DURING assignment!!!

So while work SqlSelect() cuursor 1 still exists.
I.e. You have some time BOTH cursor live.

Even if you not stick into locks problem, you still eat more RAM and disk
then you could. Because cursor1 eat RAM and curor 2 eat RAM.
 
IF you kill cursor1 BEFORE you start build second cursor then only one
cursor exists in the RAM in the same time. (we consider hee only these 2).


>> This is all right from point of view REALbasic and Garbage collection.
>> This CAN BE not right, from point of view record locks.
>> 
>> 
>> Let curs1 in line W1
>>   lock record with RecID = 100
>> 
>> Let you start build cursor in line W2.
>> If this cursor ASLO will try to lock record RecID = 100
>> Then it will fail, because curs1 still is live.
>> 
>> If you kill cursor curs1 explicitly then NO PROBLEMS.
>> Second time you can lock that records.
>> 
>> 
>> You see?
>> 
>> 
>> This is not a problem in this your function,
>> Just danger code and danger habit.
>> Always think about allocated resources!

-- 
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