Jon, please correct this

Ruslan Zasukhin sunshine at public.kherson.ua
Thu Jul 22 18:50:27 CDT 2004


On 7/22/04 3:49 PM, "jda" <jda at his.com> wrote:

>> In the blue color above you see that when you have create one cursor the
>> previous start to die.
>> 
>> I am sure that you have code BY LOGIC as next
>> 
>>     curs = db.SqlSelect()
>>     ...
>> 
>>     curs = db.SqlSelect()
>> 
>> 
>> This is correct code from point of view of REALbasic, but this is not very
>> good from point of view Valentina, and more correctly say:
>>         functions that allocates/lock/eat resources
>> 
>> The first cursor LOCK records, so may happens that you simply will not be
>> able create second cursor because it also will want the same records.
> 
> But the second cursor is a selection from a different table, so it
> can't select the same records. I thought it wouldn't matter if I
> didn't nil out the first reference and it would be closed by RB. But
> I'll nil it out myself, as you suggest.

Points are:

1) YES in your case you do not have conflict between record locks.
But if you will use the same STYLE in other places you may get into trouble.
Better always to use the same good style.


2) in your project you keep cursor as property of window.
Yes, REALbasic will SELF kill it, but WHEN?

May happens that cursor will live 30 minutes, and all this time it will keep
records locked.

Cursors must be "good citizens" and they should release their resources AS
SOON AS POSSIBLE.


3) btw, this is why I recommend correct and db.VershionSchema access.

    it is always good idea consider ANY access to db kernel as
    HARD AND LONG TIME operation. Even if it happens in 0.0001 of second.
    
    This may prepare your app for multi-user way.
    When you have many users your simple call may take longer time
    because of waiting for other user. Not each call, but again
    better use good style always and keep self safe.


-- 
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-beta mailing list