cursor/api

Ruslan Zasukhin sunshine at public.kherson.ua
Thu Feb 10 09:27:45 CST 2005


On 2/10/05 2:55 AM, "Ralf Sander" <ralf at end-if.de> wrote:

>>> The new api way is much more flexible, Adding records to a found set,
>>> sorting etc.
>>> But:
>>> Because its all based on RecIDs, which will be reused, does this work
>>> in an multiuser invironment?
>> 
>> 1) I see only one problem:
>> 
>>     API way do not have yet record locks.
>>     I think we need add yet Vtable.Lock()  .Unlock()  functions.
>> 
>> Ralf, it is not good idea do not use locks in the mutli-user
>> environment.
> 
> I thougth, I could create my own lock:
> try to write to "lock" field of record, if "lock" field is empty and no
> write error, write username to lock field of record...

But what sense?! You should use built-in locks.
And Later when we will get transactions develop will not need manually
control locks. 

 
>> 2) actually Cursor also is based on RecID, just you not see this.
>>     and cursor can/should lock selected records.
> But a deleted record does no longer contain any data in the cursor,
> even if the rec id is reused. Is there any build in check?

The correct way is:
    cursor -- lock its records.
    so issue with deleted record must never happens


>>> Example:
>>> 
>>> mDataBase.mPerson.Field("string_fld").FindContains("aa") returns a
>>> Vset
>>> with 10 records, which I use for displaying.
>>> If I delete the first record with mDataBase.mPerson.DeleteRecord, the
>>> iterator still loopes 10 times returning the value of record 2 for the
>>> deleted record 1.
>> In loop you should do safe check
>> 
>>     if( Table.RecordExist( recID ) )
> Ok, but the rec id is reused, so I will have to check for record
> creation date or something like that.

May be.

I think you must use locks.

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