Subject Re: Record lock for unique #
From Ken Mayer <dbase@nospam.goldenstag.net>
Date Mon, 25 Mar 2019 06:52:55 -0700
Newsgroups dbase.getting-started

On 3/21/2019 4:48 AM, Akshat Kapoor wrote:
> On 21/03/2019 00:27, Randy Waldman wrote:
>> Les - a simple and very informative reply.  Thank you.  No more than 4
>> users, so I s/b safe.
>>
>> Les Shewchuk Wrote:
>>
>>> Hi Randy,
>>>
>>> How many users and how frequent?
>>>
>>> I've used two techniques for this.
>>>
>>> 1. About a dozen users.  All of the Counters (Quote, Order, PO,
>>> Invoice) were in a single table.  That table was left closed until a
>>> number was needed.  Then very quickly,
>>> "Open-Fetch-Increment-Save-Close."  Very rarely had an issue, but
>>> there were glitches.  I think it had to do with people fetching
>>> different counters at the same time (Never did prove a cause)
>>>
>>> 2. As more user came on, I was also asked to add logs to the number,
>>> starting with WHO and WHEN a number was issued.  So each counter was
>>> split into it's own table.  Each Table started with an AutoInc field,
>>> Name and DatetimeStamp (more Columns were added later). Again, the
>>> tables were closed until needed.  Then
>>> "Open-Beginappend-StoreUser/Datetime-Save-get the new AutoInc
>>> value-Close." This eliminated the conflict with two users going for
>>> different counters at the same time and reduced the number of times
>>> each of the counter's tables were being accessed.
>>>
>>> There is a routine in the DUFLP for setting a preferred value of an
>>> AutoInc field.  So you can reset them to Zero, or a desired start value.
>>>
>
> I have been warned against using autoinc fields in dBase. There have
> been some grave errors with some people and worst is autoinc field
> cannot be edited to rectify the errors. We may be able to set the
> autoinc field to desired values but that will always be for new rows not
> for existing rows.

This is rare (the issue involved), and has usually to do with importing
data and not as much as every day use. Just because a couple of people
had some issues does not mean that everyone else has.

Ken

--
*Ken Mayer*
Ken's dBASE Page: http://www.goldenstag.net/dbase
The dUFLP: http://www.goldenstag.net/dbase/index.htm#duflp
dBASE Books: http://www.goldenstag.net/dbase/Books/dBASEBooks.htm
dBASE Tutorial: http://www.goldenstag.net/dbase/Tutorial/00_Preface.htm