Subject | Unique Numbers |
---|---|
Author | rodbracher |
Post date | 2002-03-06T05:10:15Z |
Hi
I created a very simple app to test out locking on a record.
I have a tIBODateBase, and two tibotables, both pointing to the same
table .
I have set pessimisticLocking on each table to true.
Now I put table1 into edit state and read the 'salenum' value in the
table.
I then put table2 into edit state and read the 'salenum' value.
The two datasets are now reading the same value.
Now if I increment the 'salenum' by one and post with table1
and then do the same with table2, the both post the same value.
Hence if I'm needing this to generate unique salenum values it wont
work.
I was under the impression setting pessimisticLocking = true would
not
allow the second table to go into edit state. Are there any other
settings
I should consider. My tibodatabase.isolation = tiCommitted. I tried
setting
this to tiConsistency but then I got error 'lock conflict on no wait
transaction' even when both datasets started off 'Active = false'. I
get the
error when I set the first one to active and try to put it into edit
state.
Is this the way I should be trying to maintain a unique number ? Or
are there better methods. This came from when in Paradox you could
simply
check if a table was in exclusive edit state and wait a bit until it
was freed.
Thanks in advance for your suggestions.
Rod
I created a very simple app to test out locking on a record.
I have a tIBODateBase, and two tibotables, both pointing to the same
table .
I have set pessimisticLocking on each table to true.
Now I put table1 into edit state and read the 'salenum' value in the
table.
I then put table2 into edit state and read the 'salenum' value.
The two datasets are now reading the same value.
Now if I increment the 'salenum' by one and post with table1
and then do the same with table2, the both post the same value.
Hence if I'm needing this to generate unique salenum values it wont
work.
I was under the impression setting pessimisticLocking = true would
not
allow the second table to go into edit state. Are there any other
settings
I should consider. My tibodatabase.isolation = tiCommitted. I tried
setting
this to tiConsistency but then I got error 'lock conflict on no wait
transaction' even when both datasets started off 'Active = false'. I
get the
error when I set the first one to active and try to put it into edit
state.
Is this the way I should be trying to maintain a unique number ? Or
are there better methods. This came from when in Paradox you could
simply
check if a table was in exclusive edit state and wait a bit until it
was freed.
Thanks in advance for your suggestions.
Rod