Many to many relation. How?
End If Software - Ralf Sander
ralf at end-if.de
Tue Dec 7 14:17:19 CST 2004
on 06.12.2004 12:11 Uhr, Robert Brenstein wrote:
>>> Develop simple make helper table where keep just 1-2 filed and one or few
>>> records
>>>
>>> table_id next_id
>>>
>>> t1 546
>>>
>>> So you can get value from this table, increment it, and save back 547
>>> 546 is the next id for use.
>>>
>>
>> Ok, but can I access this via base objects and with many users, will
>> it be processed one after another without errs or should I use a r/w
>> cursor and write an internal loop to be sure not to get a locked err?
>>
>> Cheers,
>> Ralf
>
> Actually, the table should really be used for storing it only through
> quits. In other words, when your program launches, it should read the
> value from the table into some global (persistent) variable and
> handle it through a function. Each time the function is called, it
> increases the id counter and saves the new value into the table
> before returning the value to caller. Such a single dispatch will
> eliminate any race conditions and the value in the table will be
> always matching the saved state of the db (regardless whether the
> program was properly shut down or crashed).
>
> Robert
Hm, that can't work in a multi user invironment (Vserver). If I store the id
local, it will be decreased by other users and I have not the latest in my
variable. And all users should have access to the latest id.
And the question is still there: If user 1 writes the new id, user 2 can't.
So do I have to perform a loop, that looks for a r/w cursor or can I use
baseobject and it will be processed one after another automatically or is
there another automatic possibility?
Cheers,
Ralf
More information about the Valentina
mailing list