>>>>If you use semaphore (mutex?) then current values are not read to keys table.
>>>>So it is not possible to use some semaphore.
>>>
>>>Huh? I've been using semaphore files since dBaseIII to insure primary key validity.
>>
>>Why you don't use FLOCK() or RLOCK() ?
>>
>>Can you provide some sample code ?
>something like this:
>
>fhSemaphore = fopen("d:\path\file",12)
>if fhSemaphore > 0
> nKey2Use = VAL( fread(fhSemaphore,128) ) + 1
> insert into TARGET (field1,field2,fieldPK) values (cVar1, cVar2, nKey2Use)
> nWrote = fwrite(fhSemaphore, str( nKey2Use ))
> =fclose(fhSemaphore)
>else
> =messagebox("File not available for appending",0,"Try again")
>endif
>
Thank you. Is is interesting idea to use FOPEN( , 12) instead of FLOCK()
I will try it if there is not any possibility to put FLOCK() to work.
Will this technique work OK under a heavy load by many concurrent users ?
Andrus