Auto-increment fields - Should I Use Them? 
Author Message
 Auto-increment fields - Should I Use Them?

I caught the tail end of a post on this newsgroup that made some reference
that Paradox auto-increment fields shouldn't be used, and that instead a
normal integer field should be used, with the incrementing done in code.

Maybe this is a dumb question, but why should this be the case? What is
wrong with auto-increment fields?

Thanx

Graham Fountain
Fountain Computer & Office Technology
PO BOX 604
DALBY  QLD  4405
AUSTRALIA
Phone:  Within Australia: (07) 4662 4700  International: +61 7 4662 4700
Fax:       Within Australia: (07) 4662 1586  International: +61 7 4662 1586



Wed, 18 Jun 1902 08:00:00 GMT  
 Auto-increment fields - Should I Use Them?
Nothing wrong (really),  But the BDE can easily get confused.

Aage J.

Quote:

> I caught the tail end of a post on this newsgroup that made some reference
> that Paradox auto-increment fields shouldn't be used, and that instead a
> normal integer field should be used, with the incrementing done in code.

> Maybe this is a dumb question, but why should this be the case? What is
> wrong with auto-increment fields?
> Thanx
> Graham Fountain



Wed, 18 Jun 1902 08:00:00 GMT  
 Auto-increment fields - Should I Use Them?
On Fri, 25 Jun 1999 16:51:49 +1000, "Graham Fountain"

Quote:

>I caught the tail end of a post on this newsgroup that made some reference
>that Paradox auto-increment fields shouldn't be used, and that instead a
>normal integer field should be used, with the incrementing done in code.

>Maybe this is a dumb question, but why should this be the case? What is
>wrong with auto-increment fields?

There are some logical problems (that do not only concern Paradox)

 * If you define an auto-increment field on a specific table, you will
have no easy way of importing data from other tables maintaing the
field-values of the original tables.  If an auto-increment field is
used for a foreign key (such as in a master-detail situation), then
having different key values is catastrofic.  This alone, for me, is a
good enough reason not to use auto-increments in *any* db (although in
IB, for example, you can easily disactivate the BEFORE INSERT TRIGGER
responsible for the auto-increment).

 * In most cases it is not easy to reset the counter, even if you have
an empty table.  It seems that sooner or later resetting the counter
will be desired.

Then there are issues specific to Paradox.  I have no direct
experience, but I have seen *some* messages reporting Paradox
auto-increments getting messed up somehow.  I don't know if this is
due to bad programming habits (and can so be avoided) or to poor
internal handling of random catastrofic events such as power failures.
I seem to remem though that once they get messed up, it is not that
easy to get them working correctly again.  This could be a problem if
you have to provide support for many remote sites.

I suggest you look up "auto-increment" in dejanews, just to have an
idea of what the fuss is all about...

Regards,

--
Marco Rocci
MicroEra srl
Turin, Italy
-----------------
vota contro lo SPAM su: http://www.politik-digital.de/spam/



Wed, 18 Jun 1902 08:00:00 GMT  
 Auto-increment fields - Should I Use Them?
The problem manifests itself in multi-user situations. I fortunately don't
have any direct experience with the problem but my understanding is that
other records can be posted between the post of a record and the update of
the auto-increment counter. A search of deja will retrieve a large number of
posts on the subject.


Quote:
> I caught the tail end of a post on this newsgroup that made some reference
> that Paradox auto-increment fields shouldn't be used, and that instead a
> normal integer field should be used, with the incrementing done in code.

> Maybe this is a dumb question, but why should this be the case? What is
> wrong with auto-increment fields?

> Thanx

> Graham Fountain
> Fountain Computer & Office Technology
> PO BOX 604
> DALBY  QLD  4405
> AUSTRALIA
> Phone:  Within Australia: (07) 4662 4700  International: +61 7 4662 4700
> Fax:       Within Australia: (07) 4662 1586  International: +61 7 4662
1586




Wed, 18 Jun 1902 08:00:00 GMT  
 Auto-increment fields - Should I Use Them?


Quote:
>> I caught the tail end of a post on this newsgroup that made some
>> reference that Paradox auto-increment fields shouldn't be used, and
>> that instead a normal integer field should be used, with the
>> incrementing done in code.

>> Maybe this is a dumb question, but why should this be the case? What
>> is wrong with auto-increment fields?

> Nothing wrong (really),  But the BDE can easily get confused.

That is not quite true. At least in BDE 4.x the problem was quite a big
one: When performing a restructure on a table containing an auto-
increment field, and if there where holes in the number continuation
(i.e. no. 425 had been deleted), the numbers in the auto-increment
field would be renumbered (i.e. 426 would become 425 and so on). This
in itself is not a problem, but if you had other tables that used the
auto-increment field as a foreign key, you were up the creek, without a
padle.

-- Jens Bang

Quote:

> Aage J.


> > Thanx
> > Graham Fountain

Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Need help defining auto-incrementing field using TTable.Create

2. Auto increment field

3. Master-detail and auto-increment fields

4. Auto Increment Fields and Master Details Relationship

5. Question about auto increment field

6. MS Access Auto incrementing Key fields

7. Delphi 2 SQL Server 6 problem with identifier (auto-increment) fields

8. Obtaining value of Paradox's Auto-Incremented Field Type

9. How to reset auto- increment Fields

10. Auto-increment fields

11. Delphi3-auto-increment fields

12. Auto-increment field copy

 

 
Powered by phpBB® Forum Software